aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineDebugify.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/MachineDebugify.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/MachineDebugify.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineDebugify.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineDebugify.cpp b/llvm/lib/CodeGen/MachineDebugify.cpp
index bee9b63..bc607ca 100644
--- a/llvm/lib/CodeGen/MachineDebugify.cpp
+++ b/llvm/lib/CodeGen/MachineDebugify.cpp
@@ -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?");