[llvm] 0cb80c4 - [AMDGPU] Avoid repeated hash lookups (NFC) (#113409)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 23:02:37 PDT 2024


Author: Kazu Hirata
Date: 2024-10-22T23:02:34-07:00
New Revision: 0cb80c4f00689ca00a85e1f38bc6ae9dd0bf980e

URL: https://github.com/llvm/llvm-project/commit/0cb80c4f00689ca00a85e1f38bc6ae9dd0bf980e
DIFF: https://github.com/llvm/llvm-project/commit/0cb80c4f00689ca00a85e1f38bc6ae9dd0bf980e.diff

LOG: [AMDGPU] Avoid repeated hash lookups (NFC) (#113409)

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp

Removed: 
    


################################################################################
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;
     }


        


More information about the llvm-commits mailing list