OSDN Git Service

[ARM] ARMCodeGenPrepare backend pass
authorSam Parker <sam.parker@arm.com>
Mon, 23 Jul 2018 12:27:47 +0000 (12:27 +0000)
committerSam Parker <sam.parker@arm.com>
Mon, 23 Jul 2018 12:27:47 +0000 (12:27 +0000)
commit942fbb233085925cbfcefffe670c1a4af3844cd8
tree1df7d3718e78809831c2a45862e5543bf351baa3
parent576662c3d6b01d195a908a313559804f2fe45306
[ARM] ARMCodeGenPrepare backend pass

Arm specific codegen prepare is implemented to perform type promotion
on icmp operands, which can enable the removal of uxtb and uxth
(unsigned extend) instructions. This is possible because performing
type promotion before ISel alleviates this duty from the DAG builder
which has to perform legalisation, but has a limited view on data
ranges.

The pass visits any instruction operand of an icmp and creates a
worklist to traverse the use-def tree to determine whether the values
can simply be promoted. Our concern is values in the registers
overflowing the narrow (i8, i16) data range, so instructions marked
with nuw can be promoted easily. For add and sub instructions, we are
able to use the parallel dsp instructions to operate on scalar data
types and avoid overflowing bits. Underflowing adds and subs are also
permitted when the result is only used by an unsigned icmp.

Differential Revision: https://reviews.llvm.org/D48832

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337687 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARM.h
lib/Target/ARM/ARMCodeGenPrepare.cpp [new file with mode: 0644]
lib/Target/ARM/ARMTargetMachine.cpp
lib/Target/ARM/CMakeLists.txt
test/CodeGen/ARM/arm-cgp-icmps.ll [new file with mode: 0644]
test/CodeGen/ARM/arm-cgp-phis-calls-ret.ll [new file with mode: 0644]
test/CodeGen/ARM/arm-cgp-signed.ll [new file with mode: 0644]