Merging r259228:
authorTim Northover <tnorthover@apple.com>
Fri, 29 Jan 2016 22:00:06 +0000 (22:00 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 29 Jan 2016 22:00:06 +0000 (22:00 +0000)
commitaad888f28ee3e920b6e1a3828398f6c9c256f3d3
treea07d4b1ae52045627cbe6fbc779c6eee0bbe2d24
parent5ad5d2c5359a4e878c732db59ee7fc6e0a25dc00
Merging r259228:
------------------------------------------------------------------------
r259228 | tnorthover | 2016-01-29 11:18:46 -0800 (Fri, 29 Jan 2016) | 13 lines

ARM: don't mangle DAG constant if it has more than one use

The basic optimisation was to convert (mul $LHS, $complex_constant) into
roughly "(shl (mul $LHS, $simple_constant), $simple_amt)" when it was expected
to be cheaper. The original logic checks that the mul only has one use (since
we're mangling $complex_constant), but when used in even more complex
addressing modes there may be an outer addition that can pick up the wrong
value too.

I *think* the ARM addressing-mode problem is actually unreachable at the
moment, but that depends on complex assessments of the profitability of
pre-increment addressing modes so I've put a real check in there instead of an
assertion.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@259247 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelDAGToDAG.cpp
test/CodeGen/ARM/shifter_operand.ll