forked from OSchip/llvm-project
Don't accidentally create MachineFunctions in mir-debugify/mir-strip-debugify
We should only modify existing ones. Previously, we were creating MachineFunctions for externally-available functions. AFAICT this was benign in tree but ultimately led to asan bugs in our out of tree target.
This commit is contained in:
parent
ef49b1d97e
commit
14ad8dc076
|
@ -27,7 +27,10 @@ using namespace llvm;
|
|||
namespace {
|
||||
bool applyDebugifyMetadataToMachineFunction(MachineModuleInfo &MMI,
|
||||
DIBuilder &DIB, Function &F) {
|
||||
MachineFunction &MF = MMI.getOrCreateMachineFunction(F);
|
||||
MachineFunction *MaybeMF = MMI.getMachineFunction(F);
|
||||
if (!MaybeMF)
|
||||
return false;
|
||||
MachineFunction &MF = *MaybeMF;
|
||||
|
||||
DISubprogram *SP = F.getSubprogram();
|
||||
assert(SP && "IR Debugify just created it?");
|
||||
|
|
|
@ -45,7 +45,10 @@ struct StripDebugMachineModule : public ModulePass {
|
|||
|
||||
bool Changed = false;
|
||||
for (Function &F : M.functions()) {
|
||||
MachineFunction &MF = MMI.getOrCreateMachineFunction(F);
|
||||
MachineFunction *MaybeMF = MMI.getMachineFunction(F);
|
||||
if (!MaybeMF)
|
||||
continue;
|
||||
MachineFunction &MF = *MaybeMF;
|
||||
for (MachineBasicBlock &MBB : MF) {
|
||||
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
|
||||
I != E;) {
|
||||
|
|
Loading…
Reference in New Issue