[llvm] 3ce97e4 - [ReachingDefAnalysis][NFC] Use at instead of lookup for DenseMap access

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 08:17:12 PST 2025


Author: Michael Maitland
Date: 2025-01-29T08:15:56-08:00
New Revision: 3ce97e4aa98ad6a3502528818ff11eee89ef2fae

URL: https://github.com/llvm/llvm-project/commit/3ce97e4aa98ad6a3502528818ff11eee89ef2fae
DIFF: https://github.com/llvm/llvm-project/commit/3ce97e4aa98ad6a3502528818ff11eee89ef2fae.diff

LOG: [ReachingDefAnalysis][NFC] Use at instead of lookup for DenseMap access

`at` has an assert that the key exists. Since we are assuming the key exists,
use `at` instead of `lookup`.

Added: 
    

Modified: 
    llvm/lib/CodeGen/ReachingDefAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
index 3d88c6815d51c9..f3855348c695cf 100644
--- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -348,8 +348,8 @@ int ReachingDefAnalysis::getReachingDef(MachineInstr *MI, Register Reg) const {
 
   if (Register::isStackSlot(Reg)) {
     int FrameIndex = Register::stackSlot2Index(Reg);
-    for (int Def : MBBFrameObjsReachingDefs.lookup(MBBNumber).lookup(
-             FrameIndex - ObjectIndexBegin)) {
+    int Key = FrameIndex - ObjectIndexBegin;
+    for (int Def : MBBFrameObjsReachingDefs.at(MBBNumber).at(Key)) {
       if (Def >= InstId)
         break;
       DefRes = Def;


        


More information about the llvm-commits mailing list