[llvm-commits] [llvm] r74439 - /llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp

Andreas Bolka a at bolka.at
Mon Jun 29 11:51:14 PDT 2009


Author: abolka
Date: Mon Jun 29 13:51:11 2009
New Revision: 74439

URL: http://llvm.org/viewvc/llvm-project?rev=74439&view=rev
Log:
Relax LDA memory instruction checks.

Modified:
    llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=74439&r1=74438&r2=74439&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Mon Jun 29 13:51:11 2009
@@ -36,8 +36,9 @@
 //                             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 @@
 
 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) {





More information about the llvm-commits mailing list