This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/32283] Missed induction variable optimization
- From: "amonakov at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Sep 2007 16:25:04 -0000
- Subject: [Bug rtl-optimization/32283] Missed induction variable optimization
- References: <bug-32283-14263@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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