Skip to content

Commit 1891281

Browse files
[X86] Avoid repeated hash lookups (NFC) (#129470)
1 parent ec66c87 commit 1891281

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30269,11 +30269,12 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
3026930269
if (A.isUndef() || A->getAsAPIntVal().uge(EltSizeInBits))
3027030270
continue;
3027130271
unsigned CstAmt = A->getAsAPIntVal().getZExtValue();
30272-
if (UniqueCstAmt.count(CstAmt)) {
30273-
UniqueCstAmt[CstAmt].setBit(I);
30272+
auto [It, Inserted] = UniqueCstAmt.try_emplace(CstAmt);
30273+
if (!Inserted) {
30274+
It->second.setBit(I);
3027430275
continue;
3027530276
}
30276-
UniqueCstAmt[CstAmt] = APInt::getOneBitSet(NumElts, I);
30277+
It->second = APInt::getOneBitSet(NumElts, I);
3027730278
}
3027830279
assert(!UniqueCstAmt.empty() && "Illegal constant shift amounts");
3027930280
}

0 commit comments

Comments
 (0)