From: Andreas Bolka Date: Mon, 29 Jun 2009 18:51:11 +0000 (+0000) Subject: Relax LDA memory instruction checks. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=2fbb770d4078199326cd30b3201a67c6b99fb083;p=oota-llvm.git Relax LDA memory instruction checks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74439 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/LoopDependenceAnalysis.cpp b/lib/Analysis/LoopDependenceAnalysis.cpp index 779508dce41..020a8c77ccc 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(I) || isa(I); +static inline bool IsMemRefInstr(const Value *V) { + const Instruction *I = dyn_cast(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(x) || isa(y)); + return IsMemRefInstr(x) && + IsMemRefInstr(y) && + (cast(x)->mayWriteToMemory() || + cast(y)->mayWriteToMemory()); } bool LoopDependenceAnalysis::depends(Value *src, Value *dst) {