diff options
author | Nikita Popov <npopov@redhat.com> | 2024-09-02 09:09:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 09:09:21 +0200 |
commit | f044564db1cbc588d0cad4f953d38f6c787dadd4 (patch) | |
tree | 8f7018c2c5bd3e598540f16e389b8b59ae1824ea /llvm/lib/Support/APInt.cpp | |
parent | d2ce9dc85e5d94e19a69d4a72e7b9197447d480a (diff) | |
download | llvm-f044564db1cbc588d0cad4f953d38f6c787dadd4.zip llvm-f044564db1cbc588d0cad4f953d38f6c787dadd4.tar.gz llvm-f044564db1cbc588d0cad4f953d38f6c787dadd4.tar.bz2 |
[InstCombine] Make backedge check in op of phi transform more precise (#106075)
The op of phi transform wants to prevent moving an operation across a
backedge, as this may lead to an infinite combine loop.
Currently, this is done using isPotentiallyReachable(). The problem with
that is that all blocks inside a loop are reachable from each other.
This means that the op of phi transform is effectively completely
disabled for code inside loops, even when it's not actually operating on
a loop phi (just a phi that happens to be in a loop).
Fix this by explicitly computing the backedges inside the function
instead. Do this via RPOT, which is a bit more efficient than using
FindFunctionBackedges() (which does it without any pre-computed
analyses).
For irreducible cycles, there may be multiple possible choices of
backedge, and this just picks one of them. This is still sufficient to
prevent combine loops.
This also removes the last use of LoopInfo in InstCombine -- I'll drop
the analysis in a followup.
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
0 files changed, 0 insertions, 0 deletions