[llvm] 5e80487 - [Utils] Avoid repeated hash lookups (NFC) (#136414)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 19 09:09:23 PDT 2025
Author: Kazu Hirata
Date: 2025-04-19T09:09:20-07:00
New Revision: 5e80487dd63c53545560726583ef25a160cd8a40
URL: https://github.com/llvm/llvm-project/commit/5e80487dd63c53545560726583ef25a160cd8a40
DIFF: https://github.com/llvm/llvm-project/commit/5e80487dd63c53545560726583ef25a160cd8a40.diff
LOG: [Utils] Avoid repeated hash lookups (NFC) (#136414)
Added:
Modified:
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index 31d8acb706997..fb5e73727b2ef 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
More information about the llvm-commits
mailing list