diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-04-17 10:24:35 -0700 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-04-17 14:28:41 -0700 |
commit | 14ad8dc0761a1e440304a03a1f4828280cf112e2 (patch) | |
tree | c07dd9c8375e76e0560a4ad1edfbef86cd77cadf /llvm/lib/CodeGen/MachineStripDebug.cpp | |
parent | ef49b1d97e1ac75bff8ff7dec3097b43bcd07e73 (diff) | |
download | llvm-14ad8dc0761a1e440304a03a1f4828280cf112e2.zip llvm-14ad8dc0761a1e440304a03a1f4828280cf112e2.tar.gz llvm-14ad8dc0761a1e440304a03a1f4828280cf112e2.tar.bz2 |
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.
Diffstat (limited to 'llvm/lib/CodeGen/MachineStripDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineStripDebug.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineStripDebug.cpp b/llvm/lib/CodeGen/MachineStripDebug.cpp index 48b50ce..a1cb12f 100644 --- a/llvm/lib/CodeGen/MachineStripDebug.cpp +++ b/llvm/lib/CodeGen/MachineStripDebug.cpp @@ -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;) { |