aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopDependenceAnalysis.cpp
diff options
context:
space:
mode:
authorAndreas Bolka <a@bolka.at>2009-06-29 18:51:11 +0000
committerAndreas Bolka <a@bolka.at>2009-06-29 18:51:11 +0000
commit2fbb770d4078199326cd30b3201a67c6b99fb083 (patch)
tree4324b9af7028cad2d0ea46135e3b07a4e58c3c2f /lib/Analysis/LoopDependenceAnalysis.cpp
parent1970a89a49a76ef117c92e58a508e26ecc43ccdb (diff)
Relax LDA memory instruction checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopDependenceAnalysis.cpp')
-rw-r--r--lib/Analysis/LoopDependenceAnalysis.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Analysis/LoopDependenceAnalysis.cpp b/lib/Analysis/LoopDependenceAnalysis.cpp
index 779508dce4..020a8c77cc 100644
--- a/lib/Analysis/LoopDependenceAnalysis.cpp
+++ b/lib/Analysis/LoopDependenceAnalysis.cpp
@@ -36,8 +36,9 @@ char LoopDependenceAnalysis::ID = 0;
// Utility Functions
//===----------------------------------------------------------------------===//
-static inline bool IsMemRefInstr(const Value *I) {
- return isa<LoadInst>(I) || isa<StoreInst>(I);
+static inline bool IsMemRefInstr(const Value *V) {
+ const Instruction *I = dyn_cast<const Instruction>(V);
+ return I && (I->mayReadFromMemory() || I->mayWriteToMemory());
}
static void GetMemRefInstrs(
@@ -56,8 +57,10 @@ static void GetMemRefInstrs(
bool LoopDependenceAnalysis::isDependencePair(const Value *x,
const Value *y) const {
- return IsMemRefInstr(x) && IsMemRefInstr(y)
- && (isa<StoreInst>(x) || isa<StoreInst>(y));
+ return IsMemRefInstr(x) &&
+ IsMemRefInstr(y) &&
+ (cast<const Instruction>(x)->mayWriteToMemory() ||
+ cast<const Instruction>(y)->mayWriteToMemory());
}
bool LoopDependenceAnalysis::depends(Value *src, Value *dst) {