[llvm] d03e812 - [RISCV] Update LiveIntervals before erasing instr in RISCVInsertVSETVLI

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 30 23:03:09 PDT 2024


Author: Luke Lau
Date: 2024-07-01T14:02:48+08:00
New Revision: d03e8120577a8cee2950f8c48005d71619342c30

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

LOG: [RISCV] Update LiveIntervals before erasing instr in RISCVInsertVSETVLI

Hopefully fixes a use-after-poison reported from the asan buildbots. I
wasn't able to recreate the assertion locally though.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index d94ca8484ced4..7abd7dc4957a0 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -1704,11 +1704,11 @@ void RISCVInsertVSETVLI::coalesceVSETVLIs(MachineBasicBlock &MBB) const {
             MachineInstr *VLOpDef = MRI->getUniqueVRegDef(OldVLReg);
             if (VLOpDef && TII->isAddImmediate(*VLOpDef, OldVLReg) &&
                 MRI->use_nodbg_empty(OldVLReg)) {
-              VLOpDef->eraseFromParent();
               if (LIS) {
                 LIS->removeInterval(OldVLReg);
                 LIS->RemoveMachineInstrFromMaps(*VLOpDef);
               }
+              VLOpDef->eraseFromParent();
             }
           }
           MI.setDesc(NextMI->getDesc());


        


More information about the llvm-commits mailing list