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/MachineDebugify.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/MachineDebugify.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineDebugify.cpp | 5 |
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?"); |