[PATCH] D64376: [MBP] Avoid tail duplication if it can't bring benefit

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 16:02:38 PDT 2019


Carrot created this revision.
Carrot added a reviewer: davidxl.
Herald added subscribers: llvm-commits, jsji, jfb, MaskRay, javed.absar, nhaehnle, jvesely, nemanjai, qcolombet.
Herald added a project: LLVM.

Current tail duplication integrated in bb layout is designed to increase the fallthrough from a BB's predecessor to its successor, but we have observed cases that duplication doesn't increase fallthrough, or it brings too much size overhead.

To overcome these two issues in function canTailDuplicateUnplacedPreds I add two checks:

- make sure there is at least one duplication in current work set.
- the number of duplication should not exceed the number of successors.

The modification in hasBetterLayoutPredecessor fixes a bug that potential predecessor must be at the bottom of a chain.


Repository:
  rL LLVM

https://reviews.llvm.org/D64376

Files:
  lib/CodeGen/MachineBlockPlacement.cpp
  test/CodeGen/AArch64/swifterror.ll
  test/CodeGen/AArch64/tbz-tbnz.ll
  test/CodeGen/AMDGPU/uniform-cfg.ll
  test/CodeGen/PowerPC/branch-opt.ll
  test/CodeGen/PowerPC/expand-contiguous-isel.ll
  test/CodeGen/PowerPC/no-duplicate.ll
  test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
  test/CodeGen/Thumb2/cbnz.ll
  test/CodeGen/X86/mmx-coalescing.ll
  test/CodeGen/X86/pr38795.ll
  test/CodeGen/X86/ragreedy-hoist-spill.ll
  test/CodeGen/X86/reverse_branches.ll
  test/CodeGen/X86/shadow-stack.ll
  test/CodeGen/X86/speculative-load-hardening.ll
  test/CodeGen/X86/tail-dup-merge-loop-headers.ll
  test/CodeGen/X86/tail-dup-repeat.ll
  test/CodeGen/X86/tail-merge-after-mbp.mir
  test/CodeGen/X86/tail-opts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64376.208529.patch
Type: text/x-patch
Size: 37360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190708/7c5f0a04/attachment.bin>


More information about the llvm-commits mailing list