aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineStripDebug.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel_l_sanders@apple.com>2020-04-17 10:24:35 -0700
committerDaniel Sanders <daniel_l_sanders@apple.com>2020-04-17 14:28:41 -0700
commit14ad8dc0761a1e440304a03a1f4828280cf112e2 (patch)
treec07dd9c8375e76e0560a4ad1edfbef86cd77cadf /llvm/lib/CodeGen/MachineStripDebug.cpp
parentef49b1d97e1ac75bff8ff7dec3097b43bcd07e73 (diff)
downloadllvm-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.cpp5
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;) {