[llvm] r299707 - [PGO] Preserve GlobalsAA in pgo-memop-opt pass.

Rong Xu via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 13:56:00 PDT 2017


Author: xur
Date: Thu Apr  6 15:56:00 2017
New Revision: 299707

URL: http://llvm.org/viewvc/llvm-project?rev=299707&view=rev
Log:
[PGO] Preserve GlobalsAA in pgo-memop-opt pass.

Preserve GlobalsAA analysis in memory intrinsic calls optimization based on
profiled size.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp

Modified: llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp?rev=299707&r1=299706&r2=299707&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp Thu Apr  6 15:56:00 2017
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Analysis/BlockFrequencyInfo.h"
+#include "llvm/Analysis/GlobalsModRef.h"
 #include "llvm/Analysis/IndirectCallPromotionAnalysis.h"
 #include "llvm/Analysis/IndirectCallSiteVisitor.h"
 #include "llvm/IR/BasicBlock.h"
@@ -187,6 +188,7 @@ private:
   bool runOnFunction(Function &F) override;
   void getAnalysisUsage(AnalysisUsage &AU) const override {
     AU.addRequired<BlockFrequencyInfoWrapperPass>();
+    AU.addPreserved<GlobalsAAWrapperPass>();
   }
 };
 } // end anonymous namespace
@@ -1016,6 +1018,8 @@ PreservedAnalyses PGOMemOPSizeOpt::run(F
   bool Changed = PGOMemOPSizeOptImpl(F, BFI);
   if (!Changed)
     return PreservedAnalyses::all();
-  return PreservedAnalyses::none();
+  auto  PA = PreservedAnalyses();
+  PA.preserve<GlobalsAA>();
+  return PA;
 }
 } // namespace llvm




More information about the llvm-commits mailing list