[patch] Make niter analysis return COND_EXPRs

Richard Guenther richard.guenther@gmail.com
Thu May 27 16:54:00 GMT 2010


On Thu, May 27, 2010 at 6:25 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> On Thu, May 27, 2010 at 10:48, Richard Guenther <rguenther@suse.de> wrote:
>> +  if (COMPARISON_CLASS_P (may_be_zero))
>> +    return fold_build3 (COND_EXPR, TREE_TYPE (res), may_be_zero,
>> +                       build_int_cst (TREE_TYPE (res), 0), res);
>>
>> will still build a COND_EXPR then and _not_ cache it, so you'll
>> end up returning a non-COND_EXPR in the case where loop->nb_iterations
>> is set.
>>
>> Exactly my initial complaint.
>>
>> You cache a constant number of iterations while it isn't really
>> constant but may be zero.
>>
>
> Right, I inlined the helper function to see this better.
> What do you think about this revised patch?

Now the dumping of (set_nb_iterations ...) will be off.  Please
delay setting loop->nb_iterations and the dumping until the
very end of the function.

Richard.

> Thanks for your review,
> Sebastian
>



More information about the Gcc-patches mailing list