[SimpleLoopUnswitch] Fix reversed branch during condition injection
authorNikita Popov <npopov@redhat.com>
Wed, 20 Sep 2023 08:46:25 +0000 (10:46 +0200)
committerTobias Hieta <tobias@hieta.se>
Wed, 27 Sep 2023 15:53:17 +0000 (17:53 +0200)
commit773f136d6faa5b5120107cd5b79b16ee3a307d3a
tree4f8c9f713359a80d98220761e1de157f05c30392
parent4362f3e4cf4804da015be58f5514cb3a59254d49
[SimpleLoopUnswitch] Fix reversed branch during condition injection

The in-loop successor is only on the left after a potential condition
inversion. As we re-use the old condition as-is, we should also
reuse the old successors as-is.

Fixes https://github.com/llvm/llvm-project/issues/63962.

(cherry picked from commit afd7db48c55cb87566758e961f1ebac8af16b8bc)
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/test/Transforms/SimpleLoopUnswitch/inject-invariant-conditions.ll