Re: [PATCH] PR tree-optimization/55079: Don't remove all exits of a loop during loop unroll

2012-11-10 Thread Siddhesh Poyarekar
On Fri, 9 Nov 2012 22:51:45 +0530, Siddhesh wrote: I had reckoned that the behaviour could be reverted to what was before while I figure out a way to get the warning in place for both cases, i.e. with tree-vrp (where max_loop_iterations now causes the loop to be folded away in -O2) and this

[PATCH] PR tree-optimization/55079: Don't remove all exits of a loop during loop unroll

2012-11-09 Thread Siddhesh Poyarekar
Hi, r193098 introduced a change to the loop unroll behaviour, where exits beyond nb_iterations_upper_bound were removed as being redundant. This assumption is not true for an undefined behaviour, which is when a loop causes access beyond bounds of an array. In such a case, all exits are removed

Re: [PATCH] PR tree-optimization/55079: Don't remove all exits of a loop during loop unroll

2012-11-09 Thread Ian Lance Taylor
On Fri, Nov 9, 2012 at 5:11 AM, Siddhesh Poyarekar siddh...@redhat.com wrote: I understand that the behaviour is undefined, but this is easily avoidable by skipping removal of the exits if it results in an infinite loop. Attached patch does exactly that. I don't mind saying that GCC should

Re: [PATCH] PR tree-optimization/55079: Don't remove all exits of a loop during loop unroll

2012-11-09 Thread Siddhesh Poyarekar
On Fri, 9 Nov 2012 17:34:26 +0100, Jan wrote: I don't mind saying that GCC should define cases that the language standards leave undefined. But that does not seem to be what this patch does. I don't see why this is a good idea. It seems to produce a program that is unpredictable in a