Hi,
I planed to use MemoryDependenceAnalysis in LoopStrengthReduction (LSR) pass. After I add MemoryDependenceAnalysis as a required analysis pass, the opt program always would incur endless loop error when compiling any file.
Can anyone give me some hints why I cannot use MemoryDependenceAnalysis in LSR?
Here is my very simple patch for adding MemoryDependenceAnalysis into LSR pass:
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index eff5268…8431db5 100644
— a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -64,6 +64,7 @@
#include “llvm/Analysis/LoopPass.h”
#include “llvm/Analysis/ScalarEvolutionExpander.h”
#include “llvm/Analysis/TargetTransformInfo.h”
+#include “llvm/Analysis/MemoryDependenceAnalysis.h”
#include “llvm/Assembly/Writer.h”
#include “llvm/IR/Constants.h”
#include “llvm/IR/DerivedTypes.h”
@@ -4875,6 +4876,7 @@ INITIALIZE_PASS_BEGIN(LoopStrengthReduce, “loop-reduce”,
“Loop Strength Reduction”, false, false)
INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
INITIALIZE_PASS_DEPENDENCY(DominatorTree)
+INITIALIZE_PASS_DEPENDENCY(MemoryDependenceAnalysis)
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
INITIALIZE_PASS_DEPENDENCY(IVUsers)
INITIALIZE_PASS_DEPENDENCY(LoopInfo)
@@ -4901,6 +4903,8 @@ void LoopStrengthReduce::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequiredID(LoopSimplifyID);
AU.addRequired();
AU.addPreserved();
- AU.addRequired();
- AU.addPreserved();
AU.addRequired();
AU.addPreserved();
// Requiring LoopSimplify a second time here prevents IVUsers from running
Thanks,
Star Tan