[llvm] 2de2d84 - [NFC][EntryExitInstrumenter] Mark Dominator Tree as preserved in legacy-PM too

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 14:12:04 PST 2021


Author: Roman Lebedev
Date: 2021-01-29T01:11:33+03:00
New Revision: 2de2d84ed0b2e7cd27f4de9b98f5f8a38b1e6e57

URL: https://github.com/llvm/llvm-project/commit/2de2d84ed0b2e7cd27f4de9b98f5f8a38b1e6e57
DIFF: https://github.com/llvm/llvm-project/commit/2de2d84ed0b2e7cd27f4de9b98f5f8a38b1e6e57.diff

LOG: [NFC][EntryExitInstrumenter] Mark Dominator Tree as preserved in legacy-PM too

This is correctly handled in new-PM wrappers, but not in old-PM.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp b/llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
index 26f8e21952cc..31d03e1e86af 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();


        


More information about the llvm-commits mailing list