Skip to content

Commit 66c31f5

Browse files
[AMDGPU] Avoid repeated hash lookups (NFC) (#126401)
This patch just cleans up the "if" condition. Further cleanups are left to subsequent patches.
1 parent 59cbe2f commit 66c31f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,11 @@ bool LiveRegOptimizer::optimizeLiveType(
367367
for (Instruction *U : Uses) {
368368
// Replace all converted operands for a use.
369369
for (auto [OpIdx, Op] : enumerate(U->operands())) {
370-
if (ValMap.contains(Op) && ValMap[Op]) {
370+
if (Value *Val = ValMap.lookup(Op)) {
371371
Value *NewVal = nullptr;
372372
if (BBUseValMap.contains(U->getParent()) &&
373-
BBUseValMap[U->getParent()].contains(ValMap[Op]))
374-
NewVal = BBUseValMap[U->getParent()][ValMap[Op]];
373+
BBUseValMap[U->getParent()].contains(Val))
374+
NewVal = BBUseValMap[U->getParent()][Val];
375375
else {
376376
BasicBlock::iterator InsertPt = U->getParent()->getFirstNonPHIIt();
377377
// We may pick up ops that were previously converted for users in

0 commit comments

Comments
 (0)