diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-18 23:48:08 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-18 23:48:08 +0000 |
commit | 360026f07fcf35eee9fcfbf7b9c1afda41d4b148 (patch) | |
tree | d265d6e1323f5eb523ffafc2af1b7f1b04b70994 /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | b2df433f713c5ae9ddf95bd9d47cb3e7b0c6c8ba (diff) |
Fix the predicate which checks for non-sensical formulae which have
constants in registers which partially cancel out their immediate fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 6bab98bab7..921f0b9638 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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. |