[llvm] ac51ad2 - [LiveIntervals] Fix asan debug build failures

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 11:15:01 PDT 2021


Author: Jay Foad
Date: 2021-09-24T19:14:57+01:00
New Revision: ac51ad24a75c02152f8ece943d65de9a1c4e947a

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

LOG: [LiveIntervals] Fix asan debug build failures

Call RemoveMachineInstrFromMaps before erasing instrs.
repairIntervalsInRange will do this for you after erasing the
instruction, but it's not safe to rely on it because assertions in
SlotIndexes::removeMachineInstrFromMaps refer to fields in the erased
instruction.

This fixes asan buildbot failures caused by D110328.

Added: 
    

Modified: 
    llvm/lib/CodeGen/TwoAddressInstructionPass.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 200f9868cb75..3e2e6c9fd782 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1283,6 +1283,8 @@ tryInstructionTransform(MachineBasicBlock::iterator &mi,
               if (MO.isReg())
                 OrigRegs.push_back(MO.getReg());
             }
+
+            LIS->RemoveMachineInstrFromMaps(MI);
           }
 
           MI.eraseFromParent();
@@ -1717,6 +1719,9 @@ eliminateRegSequence(MachineBasicBlock::iterator &MBBI) {
     for (int j = MI.getNumOperands() - 1, ee = 0; j > ee; --j)
       MI.RemoveOperand(j);
   } else {
+    if (LIS)
+      LIS->RemoveMachineInstrFromMaps(MI);
+
     LLVM_DEBUG(dbgs() << "Eliminated: " << MI);
     MI.eraseFromParent();
   }


        


More information about the llvm-commits mailing list