summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-18 23:48:08 +0000
committerDan Gohman <gohman@apple.com>2010-05-18 23:48:08 +0000
commit50f8f2c23df7e8d8d2d3189f9943d18064f5fcd3 (patch)
treed642cbb6e94b4de1b4b5808239b38764bf10d64f /llvm/lib/Transforms
parent4cf99b530376723179253e549158a92d15146caf (diff)
downloadbcm5719-llvm-50f8f2c23df7e8d8d2d3189f9943d18064f5fcd3.tar.gz
bcm5719-llvm-50f8f2c23df7e8d8d2d3189f9943d18064f5fcd3.zip
Fix the predicate which checks for non-sensical formulae which have
constants in registers which partially cancel out their immediate fields. llvm-svn: 104088
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 6bab98bab77..921f0b9638b 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2572,10 +2572,11 @@ void LSRInstance::GenerateCrossUseConstantOffsets() {
J = NewF.BaseRegs.begin(), JE = NewF.BaseRegs.end();
J != JE; ++J)
if (const SCEVConstant *C = dyn_cast<SCEVConstant>(*J))
- if (C->getValue()->getValue().isNegative() !=
- (NewF.AM.BaseOffs < 0) &&
- C->getValue()->getValue().abs()
- .ule(abs64(NewF.AM.BaseOffs)))
+ if ((C->getValue()->getValue() + NewF.AM.BaseOffs).abs().slt(
+ abs64(NewF.AM.BaseOffs)) &&
+ (C->getValue()->getValue() +
+ NewF.AM.BaseOffs).countTrailingZeros() >=
+ CountTrailingZeros_64(NewF.AM.BaseOffs))
goto skip_formula;
// Ok, looks good.
OpenPOWER on IntegriCloud