[llvm] r237978 - MergedLoadStoreMotion preserves MemoryDependenceAnalysis, it does not require it.

Daniel Berlin dberlin at dberlin.org
Thu May 21 17:13:05 PDT 2015


Author: dannyb
Date: Thu May 21 19:13:05 2015
New Revision: 237978

URL: http://llvm.org/viewvc/llvm-project?rev=237978&view=rev
Log:
MergedLoadStoreMotion preserves MemoryDependenceAnalysis, it does not require it.
(It already was coded assuming it can sometimes be null, so no other changes are necessary)

Modified:
    llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp?rev=237978&r1=237977&r2=237978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp Thu May 21 19:13:05 2015
@@ -117,8 +117,8 @@ private:
   // This transformation requires dominator postdominator info
   void getAnalysisUsage(AnalysisUsage &AU) const override {
     AU.addRequired<TargetLibraryInfoWrapperPass>();
-    AU.addRequired<MemoryDependenceAnalysis>();
     AU.addRequired<AliasAnalysis>();
+    AU.addPreserved<MemoryDependenceAnalysis>();
     AU.addPreserved<AliasAnalysis>();
   }
 
@@ -580,7 +580,7 @@ bool MergedLoadStoreMotion::mergeStores(
 /// \brief Run the transformation for each function
 ///
 bool MergedLoadStoreMotion::runOnFunction(Function &F) {
-  MD = &getAnalysis<MemoryDependenceAnalysis>();
+  MD = getAnalysisIfAvailable<MemoryDependenceAnalysis>();
   AA = &getAnalysis<AliasAnalysis>();
 
   bool Changed = false;





More information about the llvm-commits mailing list