[LoopPeel] Fix LCSSA phi node invalidation
commitaaa7027716ad347cda75865e99a2ff654bed6bf1
authorNikita Popov <npopov@redhat.com>
Fri, 20 Sep 2024 14:57:46 +0000 (20 16:57 +0200)
committerTobias Hieta <tobias@hieta.se>
Tue, 1 Oct 2024 06:52:08 +0000 (1 08:52 +0200)
tree9294ef1f4ea2dbe2e7b2ef0ccce2e59b91b57164
parent99058521d4c80635f60b2c1442b683395e0ee818
[LoopPeel] Fix LCSSA phi node invalidation

In the test case, the BECount of the second loop uses %load,
but we only have an LCSSA phi node for %add, so that is what
gets invalidated. Use the forgetLcssaPhiWithNewPredecessor()
API instead, which will invalidate the roots of the expression
instead.

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

(cherry picked from commit 5bcc82d43388bb0daa122d5fe7ecda5eca27fc16)
llvm/lib/Transforms/Utils/LoopPeel.cpp
llvm/test/Transforms/LoopUnroll/pr109333.ll [new file with mode: 0644]