diff options
| author | Dan Gohman <gohman@apple.com> | 2010-02-14 18:50:49 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-02-14 18:50:49 +0000 |
| commit | bb7d52213ce50a3b292df10ab36e63d440d2a135 (patch) | |
| tree | 688c467617c95d316cbb6d9ab6017c961c52c506 /llvm/lib | |
| parent | d0413848ccc735afaea8cf2480e4a5cd9c8b1fd7 (diff) | |
| download | bcm5719-llvm-bb7d52213ce50a3b292df10ab36e63d440d2a135.tar.gz bcm5719-llvm-bb7d52213ce50a3b292df10ab36e63d440d2a135.zip | |
When complicated expressions are broken down into subexpressions
with multiplication by constants distributed through, occasionally
those subexpressions can include both x and -x. For now, if this
condition is discovered within LSR, just prune such cases away,
as they won't be profitable. This fixes a "zero allocated in a
base register" assertion failure.
llvm-svn: 96177
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index b6ef718ce16..11f21879347 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2012,8 +2012,14 @@ void LSRInstance::GenerateCombinations(LSRUse &LU, unsigned LUIdx, F.BaseRegs.push_back(BaseReg); } if (Ops.size() > 1) { - F.BaseRegs.push_back(SE.getAddExpr(Ops)); - (void)InsertFormula(LU, LUIdx, F); + const SCEV *Sum = SE.getAddExpr(Ops); + // TODO: If Sum is zero, it probably means ScalarEvolution missed an + // opportunity to fold something. For now, just ignore such cases + // rather than procede with zero in a register. + if (!Sum->isZero()) { + F.BaseRegs.push_back(Sum); + (void)InsertFormula(LU, LUIdx, F); + } } } |

