Relax LDA memory instruction checks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74439 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andreas Bolka 2009-06-29 18:51:11 +00:00
parent 1970a89a49
commit 2fbb770d40

View File

@ -36,8 +36,9 @@ char LoopDependenceAnalysis::ID = 0;
// Utility Functions // Utility Functions
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
static inline bool IsMemRefInstr(const Value *I) { static inline bool IsMemRefInstr(const Value *V) {
return isa<LoadInst>(I) || isa<StoreInst>(I); const Instruction *I = dyn_cast<const Instruction>(V);
return I && (I->mayReadFromMemory() || I->mayWriteToMemory());
} }
static void GetMemRefInstrs( static void GetMemRefInstrs(
@ -56,8 +57,10 @@ static void GetMemRefInstrs(
bool LoopDependenceAnalysis::isDependencePair(const Value *x, bool LoopDependenceAnalysis::isDependencePair(const Value *x,
const Value *y) const { const Value *y) const {
return IsMemRefInstr(x) && IsMemRefInstr(y) return IsMemRefInstr(x) &&
&& (isa<StoreInst>(x) || isa<StoreInst>(y)); IsMemRefInstr(y) &&
(cast<const Instruction>(x)->mayWriteToMemory() ||
cast<const Instruction>(y)->mayWriteToMemory());
} }
bool LoopDependenceAnalysis::depends(Value *src, Value *dst) { bool LoopDependenceAnalysis::depends(Value *src, Value *dst) {