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)
commit167668f8c82fb49949a058c867ddabb0c1ec48fe
tree3b5fd5f9a958982f3ab2e70ba2f218e04bf5a556
parentcfee5b04bc510e90659eeb20127f9cda0b57f71f
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

llvm-svn: 235640
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
llvm/test/CodeGen/Thumb2/cbnz.ll [new file with mode: 0644]