aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-06 07:40:27 -0700
committerGitHub <noreply@github.com>2024-09-06 07:40:27 -0700
commitbd1559533d88f0d32b7ca17aa316b07b7924be2d (patch)
tree1119d749e7c9e1db9baeb847ec7e9152b28d3a10 /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
parent9528bcd5327c0120c82c84031b52b167037aa650 (diff)
downloadllvm-bd1559533d88f0d32b7ca17aa316b07b7924be2d.zip
llvm-bd1559533d88f0d32b7ca17aa316b07b7924be2d.tar.gz
llvm-bd1559533d88f0d32b7ca17aa316b07b7924be2d.tar.bz2
[IndVars] Avoid repeated hash lookups (NFC) (#107513)
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyIndVar.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index a950a4f..ff13c06 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1103,10 +1103,8 @@ class WidenIV {
void updatePostIncRangeInfo(Value *Def, Instruction *UseI, ConstantRange R) {
DefUserPair Key(Def, UseI);
- auto It = PostIncRangeInfos.find(Key);
- if (It == PostIncRangeInfos.end())
- PostIncRangeInfos.insert({Key, R});
- else
+ auto [It, Inserted] = PostIncRangeInfos.try_emplace(Key, R);
+ if (!Inserted)
It->second = R.intersectWith(It->second);
}