diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2021-01-29 00:45:04 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2021-01-29 01:11:33 +0300 |
commit | 2de2d84ed0b2e7cd27f4de9b98f5f8a38b1e6e57 (patch) | |
tree | 89dcb513110daee4364a0274ed23b807203f87cd /llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp | |
parent | f22f4557a749339e6865bbd16937c4f937eb4f6c (diff) | |
download | llvm-2de2d84ed0b2e7cd27f4de9b98f5f8a38b1e6e57.zip llvm-2de2d84ed0b2e7cd27f4de9b98f5f8a38b1e6e57.tar.gz llvm-2de2d84ed0b2e7cd27f4de9b98f5f8a38b1e6e57.tar.bz2 |
[NFC][EntryExitInstrumenter] Mark Dominator Tree as preserved in legacy-PM too
This is correctly handled in new-PM wrappers, but not in old-PM.
Diffstat (limited to 'llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp index 26f8e21..31d03e1 100644 --- a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp +++ b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp @@ -9,6 +9,7 @@ #include "llvm/Transforms/Utils/EntryExitInstrumenter.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/IR/DebugInfoMetadata.h" +#include "llvm/IR/Dominators.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" @@ -17,6 +18,7 @@ #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Transforms/Utils.h" + using namespace llvm; static void insertCall(Function &CurFn, StringRef Func, @@ -123,6 +125,7 @@ struct EntryExitInstrumenter : public FunctionPass { } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addPreserved<GlobalsAAWrapperPass>(); + AU.addPreserved<DominatorTreeWrapperPass>(); } bool runOnFunction(Function &F) override { return ::runOnFunction(F, false); } }; @@ -136,20 +139,34 @@ struct PostInlineEntryExitInstrumenter : public FunctionPass { } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addPreserved<GlobalsAAWrapperPass>(); + AU.addPreserved<DominatorTreeWrapperPass>(); } bool runOnFunction(Function &F) override { return ::runOnFunction(F, true); } }; char PostInlineEntryExitInstrumenter::ID = 0; } -INITIALIZE_PASS( +INITIALIZE_PASS_BEGIN( + EntryExitInstrumenter, "ee-instrument", + "Instrument function entry/exit with calls to e.g. mcount() (pre inlining)", + false, false) +INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) +INITIALIZE_PASS_END( EntryExitInstrumenter, "ee-instrument", "Instrument function entry/exit with calls to e.g. mcount() (pre inlining)", false, false) -INITIALIZE_PASS(PostInlineEntryExitInstrumenter, "post-inline-ee-instrument", - "Instrument function entry/exit with calls to e.g. mcount() " - "(post inlining)", - false, false) + +INITIALIZE_PASS_BEGIN( + PostInlineEntryExitInstrumenter, "post-inline-ee-instrument", + "Instrument function entry/exit with calls to e.g. mcount() " + "(post inlining)", + false, false) +INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) +INITIALIZE_PASS_END( + PostInlineEntryExitInstrumenter, "post-inline-ee-instrument", + "Instrument function entry/exit with calls to e.g. mcount() " + "(post inlining)", + false, false) FunctionPass *llvm::createEntryExitInstrumenterPass() { return new EntryExitInstrumenter(); |