Pass the right sign to TLI->isLegalICmpImmediate.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 5 Apr 2012 03:10:56 +0000 (03:10 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 5 Apr 2012 03:10:56 +0000 (03:10 +0000)
commit9243c4f7c54b8d0be22a4c9d411b15f462039d06
tree768ec2f4128b47e5a5f7e1557309c3c1664afc1d
parent63246de68653ce330c55453cf9a18a306a4d2319
Pass the right sign to TLI->isLegalICmpImmediate.

LSR can fold three addressing modes into its ICmpZero node:

  ICmpZero BaseReg + Offset      => ICmp BaseReg, -Offset
  ICmpZero -1*ScaleReg + Offset  => ICmp ScaleReg, Offset
  ICmpZero BaseReg + -1*ScaleReg => ICmp BaseReg, ScaleReg

The first two cases are only used if TLI->isLegalICmpImmediate() likes
the offset.

Make sure the right Offset sign is passed to this method in the second
case. The ARM version is not symmetric.

<rdar://problem/11184260>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154079 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/CodeGen/ARM/commute-movcc.ll