ARM: correct isPredicable for MULS in ThHUMB mode
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 10 Aug 2014 22:20:37 +0000 (22:20 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 10 Aug 2014 22:20:37 +0000 (22:20 +0000)
commit3e5734dc382a4b6835f12e972c3fc5ad429fff34
tree201e847cfdb87c8b67bd4d70ff59bd0ef84d7d1c
parent4417c25b03b2b8a4e29507117823c557027976b3
ARM: correct isPredicable for MULS in ThHUMB mode

The ARM ARM states that CPSR may not be updated by a MUL in thumb mode.  Due to
an ordering of Thumb 2 Size Reduction and If Conversion, we would end up
generating a THUMB MULS inside an IT block.

The If Conversion pass uses the TTI isPredicable method to ensure that it can
transform a Basic Block.  However, because we only check for IT handling on
Thumb2 functions, we may miss some cases.  Even then, it only validates that the
CPSR is not *live* rather than it is not accessed.  This corrects the handling
for that particular case since the same restriction does not hold on the vast
majority of the instructions.

This does prevent the IfConversion optimization from kicking in in certain
cases, but generating correct code is more valuable.  Addresses PR20555.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215328 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMBaseInstrInfo.cpp
test/CodeGen/ARM/2014-08-04-muls-it.ll [new file with mode: 0644]