Skip to content

Commit

Permalink
Avoid allocating a value of zero in a register if the initial formula
Browse files Browse the repository at this point in the history
inputs happen to negate each other.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100828 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Dan Gohman committed Apr 8, 2010
1 parent dd98c4d commit e60bb15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Transforms/Scalar/LoopStrengthReduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,15 @@ void Formula::InitialMatch(const SCEV *S, Loop *L,
SmallVector<const SCEV *, 4> Bad;
DoInitialMatch(S, L, Good, Bad, SE, DT);
if (!Good.empty()) {
BaseRegs.push_back(SE.getAddExpr(Good));
const SCEV *Sum = SE.getAddExpr(Good);
if (!Sum->isZero())
BaseRegs.push_back(Sum);
AM.HasBaseReg = true;
}
if (!Bad.empty()) {
BaseRegs.push_back(SE.getAddExpr(Bad));
const SCEV *Sum = SE.getAddExpr(Bad);
if (!Sum->isZero())
BaseRegs.push_back(Sum);
AM.HasBaseReg = true;
}
}
Expand Down

0 comments on commit e60bb15

Please sign in to comment.