Don't assume that two identical instructions that read from memory
authorDan Gohman <gohman@apple.com>
Tue, 25 Aug 2009 17:56:57 +0000 (17:56 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 25 Aug 2009 17:56:57 +0000 (17:56 +0000)
will always return the same value. This isn't currently necessary,
since this code doesn't currently ever get called under circumstances
where it would matter, but it may some day.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80017 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 33d8a18412d0eee477f7d96de9d411493ac92289..d639aee70993d0b7b6fb42e3cbb3c1e8f4f79118 100644 (file)
@@ -4349,7 +4349,7 @@ static bool HasSameValue(const SCEV *A, const SCEV *B) {
     if (const SCEVUnknown *BU = dyn_cast<SCEVUnknown>(B))
       if (const Instruction *AI = dyn_cast<Instruction>(AU->getValue()))
         if (const Instruction *BI = dyn_cast<Instruction>(BU->getValue()))
-          if (AI->isIdenticalTo(BI))
+          if (AI->isIdenticalTo(BI) && !AI->mayReadFromMemory())
             return true;
 
   // Otherwise assume they may have a different value.