* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
@ 2007-06-11 13:45 ` pranav dot bhandarkar at gmail dot com
2007-06-11 14:07 ` rguenth at gcc dot gnu dot org
` (28 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: pranav dot bhandarkar at gmail dot com @ 2007-06-11 13:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pranav dot bhandarkar at gmail dot com 2007-06-11 13:45 -------
Created an attachment (id=13676)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13676&action=view)
Testcase displaying the said behaviour
Added testcase that exposes the problem
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
2007-06-11 13:45 ` [Bug rtl-optimization/32283] " pranav dot bhandarkar at gmail dot com
@ 2007-06-11 14:07 ` rguenth at gcc dot gnu dot org
2007-06-11 14:33 ` pranav dot bhandarkar at gmail dot com
` (27 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-11 14:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2007-06-11 14:06 -------
What if you remove the pointless 'volatile' from a?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
2007-06-11 13:45 ` [Bug rtl-optimization/32283] " pranav dot bhandarkar at gmail dot com
2007-06-11 14:07 ` rguenth at gcc dot gnu dot org
@ 2007-06-11 14:33 ` pranav dot bhandarkar at gmail dot com
2007-06-11 18:46 ` pinskia at gcc dot gnu dot org
` (26 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: pranav dot bhandarkar at gmail dot com @ 2007-06-11 14:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pranav dot bhandarkar at gmail dot com 2007-06-11 14:33 -------
(In reply to comment #2)
> What if you remove the pointless 'volatile' from a?
>
No, removing the 'volatile' doesnt help either. The 'volatile' was because this
is part of a bigger test.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (2 preceding siblings ...)
2007-06-11 14:33 ` pranav dot bhandarkar at gmail dot com
@ 2007-06-11 18:46 ` pinskia at gcc dot gnu dot org
2007-06-13 12:36 ` pranav dot bhandarkar at gmail dot com
` (25 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-11 18:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2007-06-11 18:45 -------
Note this is most likely a dup of another bug which is talking about PPC.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (3 preceding siblings ...)
2007-06-11 18:46 ` pinskia at gcc dot gnu dot org
@ 2007-06-13 12:36 ` pranav dot bhandarkar at gmail dot com
2007-06-13 17:53 ` pinskia at gcc dot gnu dot org
` (24 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: pranav dot bhandarkar at gmail dot com @ 2007-06-13 12:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pranav dot bhandarkar at gmail dot com 2007-06-13 12:36 -------
Which RTL pass should take care of such induction variable optimization in 4.3
? For e.g In 4.1, It was old-loop that was doing it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (4 preceding siblings ...)
2007-06-13 12:36 ` pranav dot bhandarkar at gmail dot com
@ 2007-06-13 17:53 ` pinskia at gcc dot gnu dot org
2007-06-14 20:50 ` pranav dot bhandarkar at gmail dot com
` (23 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-13 17:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2007-06-13 17:53 -------
Look at PR 17108 also.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |17108
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (5 preceding siblings ...)
2007-06-13 17:53 ` pinskia at gcc dot gnu dot org
@ 2007-06-14 20:50 ` pranav dot bhandarkar at gmail dot com
2007-08-24 13:28 ` pranav dot bhandarkar at gmail dot com
` (22 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: pranav dot bhandarkar at gmail dot com @ 2007-06-14 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pranav dot bhandarkar at gmail dot com 2007-06-14 20:50 -------
I guess strength reduction should then be implemented at the RTL level ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (6 preceding siblings ...)
2007-06-14 20:50 ` pranav dot bhandarkar at gmail dot com
@ 2007-08-24 13:28 ` pranav dot bhandarkar at gmail dot com
2007-09-05 11:46 ` ramana dot radhakrishnan at celunite dot com
` (21 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: pranav dot bhandarkar at gmail dot com @ 2007-08-24 13:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pranav dot bhandarkar at gmail dot com 2007-08-24 13:28 -------
Created an attachment (id=14102)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14102&action=view)
Another testcase displaying the said behaviour
IMHO, the code generated for the following can benefit from Strength reduction.
It will be possible to generate post_inc due to strength reduction.
for (dp = i = 0; i < c; i++) {
dp += a[i] * b[i];
}
The RTL code generated for the loop is of the form ( numbers represent pseudo
reg numbers)
137 and 136 hold the base addresses of the two arrays before entry into the
loop.
132 = 0 ; #i,
133 = 132 ; #dp
Label:
139 = *(137 + 132)
140 = *(136 + 132)
141 = 140 * 139
133 += 141 ;#dp
132 += 2
conditional_jump back to Label.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (7 preceding siblings ...)
2007-08-24 13:28 ` pranav dot bhandarkar at gmail dot com
@ 2007-09-05 11:46 ` ramana dot radhakrishnan at celunite dot com
2007-09-06 17:57 ` rakdver at gcc dot gnu dot org
` (20 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ramana dot radhakrishnan at celunite dot com @ 2007-09-05 11:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from ramana dot radhakrishnan at celunite dot com 2007-09-05 11:46 -------
The above mentioned testcase works ok and generates auto-increments in Comment
#8 . I'd still be interested in looking at why the volatile case cannot work.
Adding Zdenek to the CC for this case.
--
ramana dot radhakrishnan at celunite dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rakdver at atrey dot karlin
| |dot mff dot cuni dot cz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (8 preceding siblings ...)
2007-09-05 11:46 ` ramana dot radhakrishnan at celunite dot com
@ 2007-09-06 17:57 ` rakdver at gcc dot gnu dot org
2007-09-08 13:19 ` rakdver at gcc dot gnu dot org
` (19 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2007-09-06 17:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rakdver at gcc dot gnu dot org 2007-09-06 17:57 -------
I'm testing a patch.
--
rakdver at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rakdver at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-09-06 17:57:43
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (9 preceding siblings ...)
2007-09-06 17:57 ` rakdver at gcc dot gnu dot org
@ 2007-09-08 13:19 ` rakdver at gcc dot gnu dot org
2007-09-10 18:29 ` dje at gcc dot gnu dot org
` (18 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2007-09-08 13:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from rakdver at gcc dot gnu dot org 2007-09-08 13:19 -------
Subject: Bug 32283
Author: rakdver
Date: Sat Sep 8 13:18:49 2007
New Revision: 128272
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128272
Log:
PR tree-optimization/32283
* tree-ssa-loop-ivopts.c (may_eliminate_iv): Use
estimated_loop_iterations.
(determine_use_iv_cost_condition): Decrease cost of expressions
used in iv elimination.
* gcc.dg/tree-ssa/loop-31.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-loop-ivopts.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (10 preceding siblings ...)
2007-09-08 13:19 ` rakdver at gcc dot gnu dot org
@ 2007-09-10 18:29 ` dje at gcc dot gnu dot org
2007-09-20 16:25 ` amonakov at gmail dot com
` (17 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: dje at gcc dot gnu dot org @ 2007-09-10 18:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from dje at gcc dot gnu dot org 2007-09-10 18:29 -------
Created an attachment (id=14185)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14185&action=view)
postreload.c preprocessed
The patch broke bootstrap on powerpc-aix, powerpc-darwin, sparc-solaris, and
hpux -- probably all big endian targets. reload_combine_note_store is
miscompiled.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (11 preceding siblings ...)
2007-09-10 18:29 ` dje at gcc dot gnu dot org
@ 2007-09-20 16:25 ` amonakov at gmail dot com
2007-11-27 11:00 ` ramana dot radhakrishnan at celunite dot com
` (16 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: amonakov at gmail dot com @ 2007-09-20 16:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from amonakov at gmail dot com 2007-09-20 16:25 -------
This patch sometimes confuses loop2_doloop. On ia64 this prevents use of
countable loop branch machine idiom (br.cloop). On the example used in this
thread loop2_doloop complains:
Loop 1 is simple:
simple exit 5 -> 6
infinite if: (expr_list:REG_DEP_TRUE (subreg:SI (and:DI (plus:DI (minus:DI
(reg:DI 391)
(reg:DI 370 [ ivtmp.16 ]))
(const:DI (plus:DI (symbol_ref:DI ("a") [flags 0x2] <var_decl
0x2aaaaabd7000 a>)
(const_int -2 [0xfffffffffffffffe]))))
(const_int 1 [0x1])) 0)
(nil))
number of iterations: (lshiftrt:DI (plus:DI (minus:DI (reg:DI 392)
(reg:DI 370 [ ivtmp.16 ]))
(const_int -2 [0xfffffffffffffffe]))
(const_int 1 [0x1]))
upper bound: -1
Doloop: Possible infinite iteration case.
Doloop: The loop is not suitable.
The "infinite if" condition is:
((r391 - r370) + ('a' - 2)) & 1 == 1
where r370 is &(a[i]) and r391 is len*sizeof(a[0]), so that r391+'a' is
&a[len]. Of course, such "infinite if" condition is always false, but
loop2_doloop does not see that.
--
amonakov at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amonakov at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (12 preceding siblings ...)
2007-09-20 16:25 ` amonakov at gmail dot com
@ 2007-11-27 11:00 ` ramana dot radhakrishnan at celunite dot com
2007-12-05 16:26 ` amonakov at gmail dot com
` (15 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ramana dot radhakrishnan at celunite dot com @ 2007-11-27 11:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from ramana dot radhakrishnan at celunite dot com 2007-11-27 11:00 -------
(In reply to comment #13)
> This patch sometimes confuses loop2_doloop. On ia64 this prevents use of
> countable loop branch machine idiom (br.cloop). On the example used in this
> thread loop2_doloop complains:
>
> Loop 1 is simple:
> simple exit 5 -> 6
> infinite if: (expr_list:REG_DEP_TRUE (subreg:SI (and:DI (plus:DI (minus:DI
> (reg:DI 391)
> (reg:DI 370 [ ivtmp.16 ]))
> (const:DI (plus:DI (symbol_ref:DI ("a") [flags 0x2] <var_decl
> 0x2aaaaabd7000 a>)
> (const_int -2 [0xfffffffffffffffe]))))
> (const_int 1 [0x1])) 0)
> (nil))
> number of iterations: (lshiftrt:DI (plus:DI (minus:DI (reg:DI 392)
> (reg:DI 370 [ ivtmp.16 ]))
> (const_int -2 [0xfffffffffffffffe]))
> (const_int 1 [0x1]))
> upper bound: -1
> Doloop: Possible infinite iteration case.
> Doloop: The loop is not suitable.
>
> The "infinite if" condition is:
> ((r391 - r370) + ('a' - 2)) & 1 == 1
> where r370 is &(a[i]) and r391 is len*sizeof(a[0]), so that r391+'a' is
> &a[len]. Of course, such "infinite if" condition is always false, but
> loop2_doloop does not see that.
>
This is pretty much the case that causes things to go worse even on the private
port I work on after this patch.
Debugging this on ia64 or my port shows the same point at which this detection
fails, though mine would fail for the SI case rather than the DI case.
The infinite if case is detected in loop_iv.c : iv_number_of_iterations when it
can't simplify the above mentioned expression. I looked through tree-ssa-ivopts
but I can't see how this can get fixed there unless we change it in loop_iv.c .
I wonder if we could use DF info to recursively figure out the reaching
definition at insn of r391 and r370 and substitute the RHS in this to simplify
this further.
However whether that effort would be worthwhile depends on the number of such
cases that we detect in any useful benchmark. My guess is that since this is a
pretty normal construct we'd find it in quite a number of loops that are rather
self-respecting.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (13 preceding siblings ...)
2007-11-27 11:00 ` ramana dot radhakrishnan at celunite dot com
@ 2007-12-05 16:26 ` amonakov at gmail dot com
2007-12-05 16:43 ` rakdver at kam dot mff dot cuni dot cz
` (14 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: amonakov at gmail dot com @ 2007-12-05 16:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from amonakov at gmail dot com 2007-12-05 16:26 -------
Zdenek,
please kindly share your thoughts on concerns expressed in previous comments.
The failures of number-of-iterations analysis prohibit applying modulo
scheduling to many simple loops that are otherwise eligible; in fact, I now
test SMS with either your patch reverted, or with -funsafe-loop-optimizations,
but I believe this is not a healthy state.
Please correct me if I am wrong, but I think that optimizing out the variable
that holds number of iterations is not desirable on targets that have doloop
machine idiom, because doloop rtl pass will re-introduce it in a specially
designated register. However, ia64 does not allow arithmetic operations with
loop counter, so it would be nice if iv-opts transformed the loop to the form
where decrement-and-branch-on-zero are the only uses of this variable, when
possible.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (14 preceding siblings ...)
2007-12-05 16:26 ` amonakov at gmail dot com
@ 2007-12-05 16:43 ` rakdver at kam dot mff dot cuni dot cz
2007-12-16 20:30 ` rakdver at gcc dot gnu dot org
` (13 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rakdver at kam dot mff dot cuni dot cz @ 2007-12-05 16:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from rakdver at kam dot mff dot cuni dot cz 2007-12-05 16:42 -------
Subject: Re: Missed induction variable optimization
> Please correct me if I am wrong, but I think that optimizing out the variable
> that holds number of iterations is not desirable on targets that have doloop
> machine idiom, because doloop rtl pass will re-introduce it in a specially
> designated register. However, ia64 does not allow arithmetic operations with
> loop counter, so it would be nice if iv-opts transformed the loop to the form
> where decrement-and-branch-on-zero are the only uses of this variable, when
> possible.
On the other hand, performing induction variable elimination is also
clearly desirable, as doloop idiom cannot be applied in many common
cases. At the moment, it does not seem feasible to introduce enough
target knowledge to ivopts to ensure that it can determine whether
it will be possible to determine whether the doloop pattern can be used.
I have no real idea how to solve this problem. Probably the cleanest
way would be to somehow preserve the information about the number of
iterations of the loop determined on trees, and pass it to doloop, but
we lack the means to do that reliably.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (15 preceding siblings ...)
2007-12-05 16:43 ` rakdver at kam dot mff dot cuni dot cz
@ 2007-12-16 20:30 ` rakdver at gcc dot gnu dot org
2008-10-30 14:52 ` [Bug rtl-optimization/32283] [4.3/4.4 regression] " dje at gcc dot gnu dot org
` (12 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2007-12-16 20:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from rakdver at gcc dot gnu dot org 2007-12-16 20:29 -------
A possible way how to solve the problem:
http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00769.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (16 preceding siblings ...)
2007-12-16 20:30 ` rakdver at gcc dot gnu dot org
@ 2008-10-30 14:52 ` dje at gcc dot gnu dot org
2008-10-30 16:33 ` rguenth at gcc dot gnu dot org
` (11 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: dje at gcc dot gnu dot org @ 2008-10-30 14:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #18 from dje at gcc dot gnu dot org 2008-10-30 14:49 -------
GCC no longer generates branch on count instructions on PowerPC.
--
dje at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC target triplet|arm-none-eabi |arm-none-eabi,powerpc-linux
Priority|P3 |P1
Summary|Missed induction variable |[4.3/4.4 regression] Missed
|optimization |induction variable
| |optimization
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (17 preceding siblings ...)
2008-10-30 14:52 ` [Bug rtl-optimization/32283] [4.3/4.4 regression] " dje at gcc dot gnu dot org
@ 2008-10-30 16:33 ` rguenth at gcc dot gnu dot org
2008-10-30 16:48 ` janis at gcc dot gnu dot org
` (10 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-30 16:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #19 from rguenth at gcc dot gnu dot org 2008-10-30 16:30 -------
Can someone please specify a Known-to-work version?
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Keywords| |missed-optimization
Priority|P1 |P3
Target Milestone|4.4.0 |4.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (18 preceding siblings ...)
2008-10-30 16:33 ` rguenth at gcc dot gnu dot org
@ 2008-10-30 16:48 ` janis at gcc dot gnu dot org
2008-10-30 16:58 ` rguenth at gcc dot gnu dot org
` (9 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: janis at gcc dot gnu dot org @ 2008-10-30 16:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #20 from janis at gcc dot gnu dot org 2008-10-30 16:46 -------
To add to comment #18, after r128272 GCC for powerpc-linux no longer generates
bdnz for:
int reg_values[1024];
void
clear_table (unsigned int n)
{
unsigned int i;
for (i = 0; i < n; i++)
reg_values[i] = 0;
}
The patch referenced in comment #17, applied to current 4.3 branch, generates
that instruction again for this test but causes gfortran to segfault often.
As for comment #19, known to work for which particular testcase?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (19 preceding siblings ...)
2008-10-30 16:48 ` janis at gcc dot gnu dot org
@ 2008-10-30 16:58 ` rguenth at gcc dot gnu dot org
2008-11-01 12:05 ` rguenth at gcc dot gnu dot org
` (8 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-30 16:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #21 from rguenth at gcc dot gnu dot org 2008-10-30 16:55 -------
Known-to-work for whatever testcase you want to see this PR as a regression.
As it sounds that this problem comes and goes for different testcases in
different releases more testing coverage in the testsuite would probably a good
idea, even
for cases where it works now.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (20 preceding siblings ...)
2008-10-30 16:58 ` rguenth at gcc dot gnu dot org
@ 2008-11-01 12:05 ` rguenth at gcc dot gnu dot org
2008-11-17 3:45 ` rakdver at gcc dot gnu dot org
` (7 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-11-01 12:05 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (21 preceding siblings ...)
2008-11-01 12:05 ` rguenth at gcc dot gnu dot org
@ 2008-11-17 3:45 ` rakdver at gcc dot gnu dot org
2008-11-20 8:08 ` rakdver at gcc dot gnu dot org
` (6 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2008-11-17 3:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #22 from rakdver at gcc dot gnu dot org 2008-11-17 03:44 -------
(In reply to comment #20)
> To add to comment #18, after r128272 GCC for powerpc-linux no longer generates
> bdnz for:
> ...
A patch for this testcase:
http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00792.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (22 preceding siblings ...)
2008-11-17 3:45 ` rakdver at gcc dot gnu dot org
@ 2008-11-20 8:08 ` rakdver at gcc dot gnu dot org
2008-12-22 6:01 ` cnstar9988 at gmail dot com
` (5 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2008-11-20 8:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #23 from rakdver at gcc dot gnu dot org 2008-11-20 08:06 -------
Subject: Bug 32283
Author: rakdver
Date: Thu Nov 20 08:05:12 2008
New Revision: 142035
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142035
Log:
PR rtl-optimization/32283
* tree-ssa-loop-niter.c (scev_probably_wraps_p): Use type of the base
of the induction variable to decide whether it may wrap.
* tree-ssa-loop-ivopts.c (rewrite_use_compare): Emit the initialization
of the bound before the loop.
* simplify-rtx.c (simplify_binary_operation_1): Add two simplifications
regarding AND.
(simplify_plus_minus): Only fail if no simplification is possible.
* loop-iv.c (simple_rhs_p): Consider reg + reg and reg << cst simple.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/loop-iv.c
trunk/gcc/simplify-rtx.c
trunk/gcc/tree-ssa-loop-ivopts.c
trunk/gcc/tree-ssa-loop-niter.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (23 preceding siblings ...)
2008-11-20 8:08 ` rakdver at gcc dot gnu dot org
@ 2008-12-22 6:01 ` cnstar9988 at gmail dot com
2009-01-15 10:34 ` ramana at icerasemi dot com
` (4 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: cnstar9988 at gmail dot com @ 2008-12-22 6:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #24 from cnstar9988 at gmail dot com 2008-12-22 05:57 -------
ping...
4.3.3
--
cnstar9988 at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cnstar9988 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (24 preceding siblings ...)
2008-12-22 6:01 ` cnstar9988 at gmail dot com
@ 2009-01-15 10:34 ` ramana at icerasemi dot com
2009-01-24 10:26 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: ramana at icerasemi dot com @ 2009-01-15 10:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #25 from ramana at icerasemi dot com 2009-01-15 10:34 -------
Redo CC addresses.
--
ramana at icerasemi dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|ramana at icerasemi dot com |ramana dot r at gmail dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (25 preceding siblings ...)
2009-01-15 10:34 ` ramana at icerasemi dot com
@ 2009-01-24 10:26 ` rguenth at gcc dot gnu dot org
2009-08-04 12:36 ` [Bug rtl-optimization/32283] [4.3/4.4/4.5 " rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-24 10:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #26 from rguenth at gcc dot gnu dot org 2009-01-24 10:19 -------
GCC 4.3.3 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.3 |4.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4/4.5 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (26 preceding siblings ...)
2009-01-24 10:26 ` rguenth at gcc dot gnu dot org
@ 2009-08-04 12:36 ` rguenth at gcc dot gnu dot org
2010-03-16 15:26 ` amonakov at gcc dot gnu dot org
2010-05-22 18:19 ` [Bug rtl-optimization/32283] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #27 from rguenth at gcc dot gnu dot org 2009-08-04 12:28 -------
GCC 4.3.4 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.4 |4.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4/4.5 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (27 preceding siblings ...)
2009-08-04 12:36 ` [Bug rtl-optimization/32283] [4.3/4.4/4.5 " rguenth at gcc dot gnu dot org
@ 2010-03-16 15:26 ` amonakov at gcc dot gnu dot org
2010-05-22 18:19 ` [Bug rtl-optimization/32283] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
29 siblings, 0 replies; 31+ messages in thread
From: amonakov at gcc dot gnu dot org @ 2010-03-16 15:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #28 from amonakov at gcc dot gnu dot org 2010-03-16 15:26 -------
To provide an update of the situation on 4.5 trunk:
AFAIK the situation has been generally improved with Zdenek's second commit (in
comment #23) and auto-inc-dec improvements in 4.5. However, on the particular
testcase discussed here (comment #20), we still don't DTRT on ia64 (powerpc is
OK, don't know about arm). There is unfortunate interplay between IVOPTS, RTL
PRE, RTL loop analysis and the auto-inc-dec pass.
First, ivopts produce harder-to-grok sequence in loop preheader, transforming
<bb 3>:
pretmp.2_8 = (short int) v_4(D);
<bb 4>:
# i_13 = PHI <i_6(5), 0(3)>
a[i_13] = pretmp.2_8;
i_6 = i_13 + 1;
if (len_3(D) > i_6)
goto <bb 5>;
else
goto <bb 6>;
<bb 5>:
goto <bb 4>;
to
<bb 3>:
pretmp.2_8 = (short int) v_4(D);
ivtmp.7_11 = (long unsigned int) &a[0];
D.2006_17 = (unsigned int) len_3(D);
D.2007_18 = D.2006_17 + 4294967295;
D.2008_19 = (long unsigned int) D.2007_18;
D.2009_20 = D.2008_19 * 2;
a.13_21 = (long unsigned int) &a;
D.2011_22 = a.13_21 + 2;
D.2012_23 = D.2009_20 + D.2011_22;
<bb 4>:
# ivtmp.7_1 = PHI <ivtmp.7_12(5), ivtmp.7_11(3)>
D.2005_16 = (void *) ivtmp.7_1;
MEM[base: D.2005_16]{a[i]} = pretmp.2_8;
ivtmp.7_12 = ivtmp.7_1 + 2;
if (ivtmp.7_12 != D.2012_23)
goto <bb 5>;
else
goto <bb 6>;
<bb 5>:
goto <bb 4>;
The preheader is not cleaned up until RTL PRE. Then, PRE transforms
L54:
51 NOTE_INSN_BASIC_BLOCK
52 [r371:DI]=r373:SI#0
53 r371:DI=r371:DI+0x2
55 r392:BI=r371:DI!=r381:DI
56 pc={(r392:BI!=0x0)?L54:pc}
to
L83:
82 NOTE_INSN_BASIC_BLOCK
77 r397:DI=r371:DI+0x2
L54:
51 NOTE_INSN_BASIC_BLOCK
52 [r371:DI]=r373:SI#0
75 r371:DI=r397:DI
REG_EQUAL: r371:DI+0x2
55 r392:BI=r371:DI!=r381:DI
56 pc={(r392:BI!=0x0)?L83:pc}
REG_DEAD: r392:BI
REG_BR_PROB: 0x26ac
... which is something auto-inc-dec pass is not able to handle. If I disable
rtl pre with -fdbg-cnt=pre:0, auto-inc is generated, but doloop pass is
confused instead:
Loop 1 is simple:
simple exit 4 -> 5
infinite if: (expr_list:REG_DEP_TRUE (subreg:SI (and:DI (plus:DI (minus:DI
(ashift:DI (reg:DI 390)
(const_int 1 [0x1]))
(reg:DI 371 [ ivtmp.7 ]))
(const:DI (plus:DI (symbol_ref:DI ("a") [flags 0x2] <var_decl
0x7ffff7968000 a>)
(const_int 2 [0x2]))))
(const_int 1 [0x1])) 0)
(nil))
number of iterations: (lshiftrt:DI (plus:DI (minus:DI (reg:DI 381 [ D.2012 ])
(reg:DI 371 [ ivtmp.7 ]))
(const_int -2 [0xfffffffffffffffe]))
(const_int 1 [0x1]))
upper bound: -2
Doloop: Possible infinite iteration case.
Doloop: The loop is not suitable.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread
* [Bug rtl-optimization/32283] [4.3/4.4/4.5/4.6 regression] Missed induction variable optimization
2007-06-11 13:43 [Bug rtl-optimization/32283] New: Missed induction variable optimization pranav dot bhandarkar at gmail dot com
` (28 preceding siblings ...)
2010-03-16 15:26 ` amonakov at gcc dot gnu dot org
@ 2010-05-22 18:19 ` rguenth at gcc dot gnu dot org
29 siblings, 0 replies; 31+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-22 18:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #29 from rguenth at gcc dot gnu dot org 2010-05-22 18:11 -------
GCC 4.3.5 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.5 |4.3.6
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32283
^ permalink raw reply [flat|nested] 31+ messages in thread