Skip to content

Commit bd15595

Browse files
[IndVars] Avoid repeated hash lookups (NFC) (#107513)
1 parent 9528bcd commit bd15595

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Transforms/Utils/SimplifyIndVar.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,10 +1103,8 @@ class WidenIV {
11031103

11041104
void updatePostIncRangeInfo(Value *Def, Instruction *UseI, ConstantRange R) {
11051105
DefUserPair Key(Def, UseI);
1106-
auto It = PostIncRangeInfos.find(Key);
1107-
if (It == PostIncRangeInfos.end())
1108-
PostIncRangeInfos.insert({Key, R});
1109-
else
1106+
auto [It, Inserted] = PostIncRangeInfos.try_emplace(Key, R);
1107+
if (!Inserted)
11101108
It->second = R.intersectWith(It->second);
11111109
}
11121110

0 commit comments

Comments
 (0)