mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-11 15:26:07 +00:00
[GISel]: Fix undefined behavior in IRTranslator
Make sure IRTranslator->MachineIRBuilder->DebugLoc doesn't outlive the DILocation. Clear it at the end of IRTranslator::runOnMachineFunction llvm-svn: 303277
This commit is contained in:
parent
82f1302263
commit
1b45675424
@ -1129,6 +1129,11 @@ void IRTranslator::finalizeFunction() {
|
|||||||
ValToVReg.clear();
|
ValToVReg.clear();
|
||||||
FrameIndices.clear();
|
FrameIndices.clear();
|
||||||
MachinePreds.clear();
|
MachinePreds.clear();
|
||||||
|
// MachineIRBuilder::DebugLoc can outlive the DILocation it holds. Clear it
|
||||||
|
// to avoid accessing free’d memory (in runOnMachineFunction) and to avoid
|
||||||
|
// destroying it twice (in ~IRTranslator() and ~LLVMContext())
|
||||||
|
EntryBuilder = MachineIRBuilder();
|
||||||
|
CurBuilder = MachineIRBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) {
|
bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user