[llvm] [AMDGPU] Avoid repeated hash lookups (NFC) (PR #113409)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 22 20:06:03 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/113409.diff
1 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp (+2-2)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
index 77350dbb6167cb..c80d60c3a52112 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
@@ -329,8 +329,8 @@ bool LiveRegOptimizer::optimizeLiveType(
Type *NewType = calculateConvertType(Phi->getType());
NewPhi->addIncoming(ConstantInt::get(NewType, 0, false),
Phi->getIncomingBlock(I));
- } else if (ValMap.contains(IncVal) && ValMap[IncVal])
- NewPhi->addIncoming(ValMap[IncVal], Phi->getIncomingBlock(I));
+ } else if (Value *Val = ValMap.lookup(IncVal))
+ NewPhi->addIncoming(Val, Phi->getIncomingBlock(I));
else
MissingIncVal = true;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/113409
More information about the llvm-commits
mailing list