diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-09 19:14:31 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-09 19:14:31 +0000 |
commit | f8d0578e4cbd5922696c92f5068c5513d8e8d60e (patch) | |
tree | 6562115b4f1b7ba1d4010c5b579b4d65a72dbf59 /lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | 4a2a68336638e99a475b09a9278399db6749618f (diff) |
When emitting code for an add, don't force a SCEVUnknown wrapper around
a hoisted intermediate result if the intermediate result isn't an
Instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100884 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolutionExpander.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index 24825bf5e5..1d1339078d 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -705,10 +705,11 @@ Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) { Sum = expandAddToGEP(NewOps.begin(), NewOps.end(), PTy, Ty, Sum); } else if (const PointerType *PTy = dyn_cast<PointerType>(Op->getType())) { // The running sum is an integer, and there's a pointer at this level. - // Try to form a getelementptr. Use a SCEVUnknown so that we don't - // re-analyze the instructions that we just emitted. + // Try to form a getelementptr. If the running sum is instructions, + // use a SCEVUnknown to avoid re-analyzing them. SmallVector<const SCEV *, 4> NewOps; - NewOps.push_back(SE.getUnknown(Sum)); + NewOps.push_back(isa<Instruction>(Sum) ? SE.getUnknown(Sum) : + SE.getSCEV(Sum)); for (++I; I != E && I->first == CurLoop; ++I) NewOps.push_back(I->second); Sum = expandAddToGEP(NewOps.begin(), NewOps.end(), PTy, Ty, expand(Op)); |