https://bugs.llvm.org/show_bug.cgi?id=26302

Hans Wennborg <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #7 from Hans Wennborg <[email protected]> ---
(In reply to Nikita Kniazev from comment #6)
> Correct me if I am wrong. The example in the first post is not affected by
> this comment, as folding will not change the branch direction in it.

But it does. Before the optimization:

        testb   $1, 4(%esp)
        je      .LBB0_2
        jmp     foo
  .LBB0_2:
        jmp     bar

The "je" branches "forward" due to the code layout.

After folding:

        testb   $1, 4(%esp)
        je      bar
        jmp     foo

The "je" might branch "forward" or "backward" depending on where the linker
puts "bar" in relation to the current code. The code layout done by the
compiler is lost.

At least that was the motivation for restricting this to optsize.

If you want to make the case that this optimization should fire also without
optsize, please open another bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to