On 04/02/2012 08:42 AM, Richard Guenther wrote:
On Mon, 2 Apr 2012, Richard Guenther wrote:

After going through a gazillion of candidate fixes for PR52756, a
case where jump threading destroys loops in a non-recoverable way,
I settled with the following.  The issue is that we thread both
the loop latch and the loop entry edge but the code is not prepared
for that.  Another possible fix would be to unconditionally throw
away threadings if we threaded the latch based on the fact that
the rest of the edges no longer are loop entry edges (but threading
them may create one, I think even still one that will end up
creating a multiple entry loop).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

And revealed one missed optimization, gcc.dg/tree-ssa/ssa-dom-thread-2.c

Thus the following is another try to fix things.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.


2012-04-02  Richard Guenther<rguent...@suse.de>

        PR tree-optimization/52756
        * tree-ssa-threadupdate.c (def_split_header_continue_p): New function.
        (thread_through_loop_header): After threading through the loop latch
        remove the split part from the loop and clear further threading
        opportunities that would create a multiple entry loop.

        * gcc.dg/torture/pr52756.c: New testcase.
No objections assuming it tests OK.


Reply via email to