diff options
| author | Vedant Kumar <vsk@apple.com> | 2018-05-24 23:00:23 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2018-05-24 23:00:23 +0000 |
| commit | 4872535eb9573efb6b08a205458c845a988b74e2 (patch) | |
| tree | 955cd10f08254ab87591c8378f6587678e7059e1 /llvm/tools/opt/Debugify.cpp | |
| parent | b70e35686b18a23d7fffa3060ef37a2279306155 (diff) | |
| download | bcm5719-llvm-4872535eb9573efb6b08a205458c845a988b74e2.tar.gz bcm5719-llvm-4872535eb9573efb6b08a205458c845a988b74e2.zip | |
[Debugify] Set a DI version module flag for llc compatibility
Setting the "Debug Info Version" module flag makes it possible to pipe
synthetic debug info into llc, which is useful for testing backends.
llvm-svn: 333237
Diffstat (limited to 'llvm/tools/opt/Debugify.cpp')
| -rw-r--r-- | llvm/tools/opt/Debugify.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/tools/opt/Debugify.cpp b/llvm/tools/opt/Debugify.cpp index fb810da231f..ba8927fd19c 100644 --- a/llvm/tools/opt/Debugify.cpp +++ b/llvm/tools/opt/Debugify.cpp @@ -121,6 +121,12 @@ bool applyDebugifyMetadata(Module &M, addDebugifyOperand(NextVar - 1); // Original number of variables. assert(NMD->getNumOperands() == 2 && "llvm.debugify should have exactly 2 operands!"); + + // Claim that this synthetic debug info is valid. + StringRef DIVersionKey = "Debug Info Version"; + if (!M.getModuleFlag(DIVersionKey)) + M.addModuleFlag(Module::Warning, DIVersionKey, DEBUG_METADATA_VERSION); + return true; } @@ -270,10 +276,12 @@ struct CheckDebugifyFunctionPass : public FunctionPass { Module &M = *F.getParent(); auto FuncIt = F.getIterator(); return checkDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)), - NameOfWrappedPass, "CheckFunctionDebugify", Strip); + NameOfWrappedPass, "CheckFunctionDebugify", + Strip); } - CheckDebugifyFunctionPass(bool Strip = false, StringRef NameOfWrappedPass = "") + CheckDebugifyFunctionPass(bool Strip = false, + StringRef NameOfWrappedPass = "") : FunctionPass(ID), Strip(Strip), NameOfWrappedPass(NameOfWrappedPass) {} void getAnalysisUsage(AnalysisUsage &AU) const override { |

