forked from OSchip/llvm-project
[VE][NFC] Fix use-after-free in VEInstrInfo
First call getOperand, then erase the MachineInstr. Not the other way round. Expected to fix test/CodeGen/VE/VELIntrinsics/lvm.ll Detected by asan buildbot: sanitizer-x86_64-linux-fast (https://lab.llvm.org/buildbot/#/builders/5/builds/15384)
This commit is contained in:
parent
b6f3c8de6a
commit
435d44bf8a
|
@ -942,11 +942,11 @@ bool VEInstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
|
|||
MachineInstrBuilder MIB =
|
||||
BuildMI(*MBB, MI, DL, get(VE::SVMmi), Dest).addReg(VMZ).addImm(Imm);
|
||||
MachineInstr *Inst = MIB.getInstr();
|
||||
MI.eraseFromParent();
|
||||
if (KillSrc) {
|
||||
const TargetRegisterInfo *TRI = &getRegisterInfo();
|
||||
Inst->addRegisterKilled(MI.getOperand(1).getReg(), TRI, true);
|
||||
}
|
||||
MI.eraseFromParent();
|
||||
return true;
|
||||
}
|
||||
case VE::VFMKyal:
|
||||
|
|
Loading…
Reference in New Issue