[LiveIntervals] Fix another asan debug build failure
authorJay Foad <jay.foad@amd.com>
Tue, 28 Sep 2021 10:07:29 +0000 (11:07 +0100)
committerJay Foad <jay.foad@amd.com>
Tue, 28 Sep 2021 10:09:38 +0000 (11:09 +0100)
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 D110335.

llvm/lib/CodeGen/TwoAddressInstructionPass.cpp

index a59c5b4d35cffaa3c6a15a63c571de0e9f28ae5a..0fa580fb4c13df20abbea5a80c906615ddec7489 100644 (file)
@@ -629,6 +629,8 @@ bool TwoAddressInstructionPass::convertInstTo3Addr(
       if (MO.isReg())
         OrigRegs.push_back(MO.getReg());
     }
+
+    LIS->RemoveMachineInstrFromMaps(*mi);
   }
 
   MBB->erase(mi); // Nuke the old inst.