> -----Original Message----- > From: Richard Biener [mailto:richard.guent...@gmail.com] > Sent: 08 January 2014 14:42 > To: Paulo Matos > Cc: Andrew Haley; gcc@gcc.gnu.org; Jan Hubicka > Subject: Re: Infinite number of iterations in loop [v850, mep] > > Well. We have > > Loop 2 is simple: > simple exit 5 -> 7 > infinite if: (expr_list:REG_DEP_TRUE (and:SI (reg:SI 76) > (const_int 1 [0x1])) > (nil)) > number of iterations: (lshiftrt:SI (plus:SI (minus:SI (reg:SI 68 [ D.1398 ]) > (reg:SI 64 [ ivtmp___6 ])) > (const_int -2 [0xfffffffffffffffe])) > (const_int 1 [0x1])) > upper bound: 2147483646 > realistic bound: -1 > Doloop: Possible infinite iteration case. > Doloop: The loop is not suitable. > > as we replaced the induction variable by a pointer induction with > step 2. So this might be a very common issue for RTL loop opts, > the upper bound of the IV is 2 * N in this case, so 2 * N & 1 > should be always false and thus "infinite" be optimized. > > (insn 34 33 36 3 (parallel [ > (set (reg:SI 76) > (plus:SI (reg/v:SI 71 [ N ]) > (reg/v:SI 71 [ N ]))) > (clobber (reg:CC 32 psw)) > ]) 21 {addsi3} > (expr_list:REG_UNUSED (reg:CC 32 psw) > (nil))) > > that doesn't look too difficult to do with the above definition. > nonzero_bits might be of use here, not sure (not my area of > expertise). >
You're right. After having had a look at the code this looks like something to be added to simplify_using_initial_values. I will try to patch it up and will post it upstream once complete for comments. Thanks, -- Paulo Matos