ARM: don't try to hoist constant RHS out of a division.
authorTim Northover <tnorthover@apple.com>
Fri, 15 Apr 2016 18:17:18 +0000 (18:17 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 15 Apr 2016 18:17:18 +0000 (18:17 +0000)
commit903f81ba184d45341f8f5b8b3227242cc168e535
treece9f92d8728653aa3e465e394d818795897899b0
parent9cfd8cea6b8172e32a76a59125f13a6662a18c86
ARM: don't try to hoist constant RHS out of a division.

Divisions by a constant can be converted into multiplies which are usually
cheaper, but this isn't possible if the constant gets separated (particularly
in loops). Fix this by telling ConstantHoisting that the immediate in a DIV is
cheap.

I considered making the check generic, but neither AArch64 (strangely) nor x86
showed any benefit on the tests I had.

llvm-svn: 266464
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
llvm/test/Transforms/ConstantHoisting/ARM/bad-cases.ll