From fc8a04aebe88b88db9059b5c20423014f9d043ab Mon Sep 17 00:00:00 2001 From: Andreas Bolka Date: Mon, 29 Jun 2009 18:51:11 +0000 Subject: Relax LDA memory instruction checks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74439 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/LoopDependenceAnalysis.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/Analysis/LoopDependenceAnalysis.cpp') 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(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) { -- cgit v1.2.3