Thumb2: When applying branch optimizations, visit branches in reverse order.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 23 Apr 2015 20:31:35 +0000 (20:31 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 23 Apr 2015 20:31:35 +0000 (20:31 +0000)
commit391b2c39f7d738a9bf49fe404cdbf0fa0825e1a5
tree89009de21d22a202261d73af2e6fb687e10f48e2
parent1ad0f741557afc28b626cb6fde8113e8aa997332
Thumb2: When applying branch optimizations, visit branches in reverse order.

The order in which branches appear in ImmBranches is approximately their
order within the function body. By visiting later branches first, we reduce
the distance between earlier forward branches and their targets, making it
more likely that the cbn?z optimization, which can only apply to forward
branches, will succeed for those earlier branches.

Differential Revision: http://reviews.llvm.org/D9185

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235640 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMConstantIslandPass.cpp
test/CodeGen/Thumb2/cbnz.ll [new file with mode: 0644]