http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55273



--- Comment #8 from Jan Hubicka <hubicka at gcc dot gnu.org> 2013-01-16 
13:17:30 UTC ---

OK, the problem is that the "induction" variable here is not normal induction

variable but handed by xor.



PPC target seems to be only that translates  (flags & 0x80000000)

into 

(insn 47 45 54 11 (set (reg/v:SI 125 [ flags ])

        (plus:SI (reg/v:SI 125 [ flags ])

            (const_int -2147483648 [0xffffffff80000000]))) t.c:15 64

{*addsi3_internal1}

     (nil))

so turning it into normal IV var.



This makes loop-iv to get what tree level IV doesn't.  We could make tree level

IV to also handle this XOR as plus, but that is more an enhancement.

I am testing the following patch.



Index: loop-iv.c

===================================================================

--- loop-iv.c   (revision 195144)

+++ loop-iv.c   (working copy)

@@ -2819,7 +2819,8 @@ iv_number_of_iterations (struct loop *lo

   else

     {

       max = determine_max_iter (loop, desc, old_niter);

-      gcc_assert (max);

+      if (!max)

+       goto zero_iter_simplify;

       if (!desc->infinite

          && !desc->assumptions)

        record_niter_bound (loop, double_int::from_uhwi (max),

Reply via email to