forked from OSchip/llvm-project
[GlobalISel][IRTranslator] Fix a use-after-free bug when translating trap-func-name traps.
This was using MachineFunction::createExternalSymbolName() before, which seems reasonable, but in fact this is freed before the asm emitter which tries to access the function name string. Switching it to use the string returned by the attribute seems to fix the problem.
This commit is contained in:
parent
08b3c0d995
commit
72ce310bf0
|
@ -2246,8 +2246,7 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
|
|||
Info.OrigArgs.push_back({getOrCreateVRegs(*CI.getArgOperand(0)),
|
||||
CI.getArgOperand(0)->getType(), 0});
|
||||
}
|
||||
Info.Callee =
|
||||
MachineOperand::CreateES(MF->createExternalSymbolName(TrapFuncName));
|
||||
Info.Callee = MachineOperand::CreateES(TrapFuncName.data());
|
||||
Info.CB = &CI;
|
||||
Info.OrigRet = {Register(), Type::getVoidTy(CI.getContext()), 0};
|
||||
return CLI->lowerCall(MIRBuilder, Info);
|
||||
|
|
Loading…
Reference in New Issue