[all-commits] [llvm/llvm-project] 729424: [MBP] Avoid tail duplication if it can't bring ben...

weiguozhi via All-commits all-commits at lists.llvm.org
Fri Dec 6 09:56:15 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 72942459d070cbfe6f3524e89c3ac37440be7890
      https://github.com/llvm/llvm-project/commit/72942459d070cbfe6f3524e89c3ac37440be7890
  Author: Guozhi Wei <carrot at google.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M llvm/lib/CodeGen/MachineBlockPlacement.cpp
    M llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
    M llvm/test/CodeGen/AArch64/swifterror.ll
    M llvm/test/CodeGen/AArch64/tbz-tbnz.ll
    M llvm/test/CodeGen/AMDGPU/loop_header_nopred.mir
    M llvm/test/CodeGen/AMDGPU/uniform-cfg.ll
    M llvm/test/CodeGen/PowerPC/block-placement.mir
    M llvm/test/CodeGen/PowerPC/branch-opt.ll
    M llvm/test/CodeGen/PowerPC/expand-contiguous-isel.ll
    A llvm/test/CodeGen/PowerPC/no-duplicate.ll
    M llvm/test/CodeGen/RISCV/atomic-rmw.ll
    M llvm/test/CodeGen/RISCV/remat.ll
    M llvm/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-float-loops.ll
    M llvm/test/CodeGen/Thumb2/cbnz.ll
    M llvm/test/CodeGen/X86/mmx-coalescing.ll
    M llvm/test/CodeGen/X86/pr38795.ll
    M llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll
    M llvm/test/CodeGen/X86/reverse_branches.ll
    M llvm/test/CodeGen/X86/shadow-stack.ll
    M llvm/test/CodeGen/X86/speculative-load-hardening.ll
    M llvm/test/CodeGen/X86/tail-dup-merge-loop-headers.ll
    M llvm/test/CodeGen/X86/tail-dup-repeat.ll
    M llvm/test/CodeGen/X86/tail-merge-after-mbp.mir
    M llvm/test/CodeGen/X86/tail-opts.ll

  Log Message:
  -----------
  [MBP] Avoid tail duplication if it can't bring benefit

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.

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




More information about the All-commits mailing list