[ARM] Search backwards for CMP when combining into CBZ
authorDavid Green <david.green@arm.com>
Sun, 17 Mar 2019 16:11:22 +0000 (16:11 +0000)
committerDavid Green <david.green@arm.com>
Sun, 17 Mar 2019 16:11:22 +0000 (16:11 +0000)
commite0b48a80150de2aab365f84f2c7613fdf4229947
tree20d2871bba4cf2cbf31eb3120114279fe97d46f9
parent30673299d45e667c5a0ffcbc632a78ca53dc1eea
[ARM] Search backwards for CMP when combining into CBZ

The constant island pass currently only looks at the instruction immediately
before a branch for a CMP to fold into a CBZ/CBNZ. This extends it to search
backwards for the instruction that defines CPSR. We need to ensure that the
register is not overridden between the CMP and the branch.

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

llvm-svn: 356336
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
llvm/test/CodeGen/Thumb2/constant-islands-cbz.ll
llvm/test/CodeGen/Thumb2/constant-islands-cbz.mir