diff options
author | Kazu Hirata <kazu@google.com> | 2025-04-19 09:09:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-19 09:09:20 -0700 |
commit | 5e80487dd63c53545560726583ef25a160cd8a40 (patch) | |
tree | 03ccb67e33193471c990e9c5c3c07de9adefbb7f /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
parent | 6196b4ee8c47dc4a2267b7c704d1811e68c7f1c1 (diff) | |
download | llvm-5e80487dd63c53545560726583ef25a160cd8a40.zip llvm-5e80487dd63c53545560726583ef25a160cd8a40.tar.gz llvm-5e80487dd63c53545560726583ef25a160cd8a40.tar.bz2 |
[Utils] Avoid repeated hash lookups (NFC) (#136414)
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 31d8acb..fb5e737 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -1633,13 +1633,13 @@ void SCEVExpander::replaceCongruentIVInc( // If this phi has the same width but is more canonical, replace the // original with it. As part of the "more canonical" determination, // respect a prior decision to use an IV chain. - if (OrigPhi->getType() == Phi->getType() && - !(ChainedPhis.count(Phi) || - isExpandedAddRecExprPHI(OrigPhi, OrigInc, L)) && - (ChainedPhis.count(Phi) || - isExpandedAddRecExprPHI(Phi, IsomorphicInc, L))) { - std::swap(OrigPhi, Phi); - std::swap(OrigInc, IsomorphicInc); + if (OrigPhi->getType() == Phi->getType()) { + bool Chained = ChainedPhis.contains(Phi); + if (!(Chained || isExpandedAddRecExprPHI(OrigPhi, OrigInc, L)) && + (Chained || isExpandedAddRecExprPHI(Phi, IsomorphicInc, L))) { + std::swap(OrigPhi, Phi); + std::swap(OrigInc, IsomorphicInc); + } } // Replacing the congruent phi is sufficient because acyclic |