[PATCH] D43256: [MBP] Move a latch block with conditional exit and multi predecessors to top of loop

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 14:15:36 PST 2018


Carrot created this revision.
Carrot added reviewers: davidxl, iteratee.
Herald added subscribers: javed.absar, nhaehnle, nemanjai.

Current findBestLoopTop can find and move one kind of block to top, a latch block has one successor. Another common case is:

- a latch block
- it has two successors, one is loop header, another is exit
- it has more than one predecessors

If it is below one of its predecessors P, only P can fall through to it, all other predecessors need a jump to it, and another conditional jump to loop header. If it is moved before loop header, all its predecessors jump to it, then fall through to loop header. So all its predecessors except P can reduce one taken branch.

It is tested by existing test cases with updated CHECK statements.


https://reviews.llvm.org/D43256

Files:
  lib/CodeGen/MachineBlockPlacement.cpp
  test/CodeGen/AArch64/neg-imm.ll
  test/CodeGen/AArch64/tailmerging_in_mbp.ll
  test/CodeGen/AMDGPU/branch-uniformity.ll
  test/CodeGen/AMDGPU/collapse-endcf.ll
  test/CodeGen/AMDGPU/global_smrd_cfg.ll
  test/CodeGen/AMDGPU/hoist-cond.ll
  test/CodeGen/AMDGPU/loop_break.ll
  test/CodeGen/AMDGPU/madmk.ll
  test/CodeGen/AMDGPU/multilevel-break.ll
  test/CodeGen/AMDGPU/valu-i1.ll
  test/CodeGen/ARM/code-placement.ll
  test/CodeGen/ARM/swifterror.ll
  test/CodeGen/PowerPC/cmp_elimination.ll
  test/CodeGen/SystemZ/atomicrmw-minmax-01.ll
  test/CodeGen/SystemZ/atomicrmw-minmax-02.ll
  test/CodeGen/SystemZ/loop-01.ll
  test/CodeGen/SystemZ/loop-02.ll
  test/CodeGen/SystemZ/swifterror.ll
  test/CodeGen/X86/block-placement.ll
  test/CodeGen/X86/branch_instruction_and_target_split_perf_nops.mir
  test/CodeGen/X86/code_placement_ignore_succ_in_inner_loop.ll
  test/CodeGen/X86/code_placement_loop_rotation2.ll
  test/CodeGen/X86/pr5145.ll
  test/CodeGen/X86/swifterror.ll
  test/CodeGen/X86/tail-dup-merge-loop-headers.ll
  test/CodeGen/X86/tail-dup-repeat.ll
  test/CodeGen/X86/x86-cmov-converter.ll
  test/DebugInfo/X86/dbg-value-transfer-order.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43256.134110.patch
Type: text/x-patch
Size: 25166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180213/f51cd70e/attachment.bin>


More information about the llvm-commits mailing list