[PATCH] D73387: [MBP] Partial tail duplication into hot predecessors

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 15:59:31 PST 2020


Carrot created this revision.
Carrot added reviewers: davidxl, xur.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Current tail duplication embedded in MBP duplicates a BB into all or none of its predecessors without too much cost analysis. So sometimes it is duplicated into cold predecessors, and in other cases it may miss the duplication into hot predecessors.

This patch improves tail duplication in 3 aspects:

1. A successor can be duplicated into part of its predecessors.
2. A more fine-grained benefit analysis, combined with 1, now a successor is duplicated into hot predecessors only.
3. If a successor can't be duplicated into one predecessor, it doesn't impact the duplication into other predecessors.

It doesn't impact the performance of spec2006int like many other code layout changes, spec doesn't have large instruction work set.
Performance test with two Google's internal search benchmarks shows obvious improvement on large binaries. I got 0.30% and 0.18% on them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73387

Files:
  llvm/include/llvm/CodeGen/TailDuplicator.h
  llvm/lib/CodeGen/MachineBlockPlacement.cpp
  llvm/lib/CodeGen/TailDuplicator.cpp
  llvm/test/CodeGen/X86/partial-tail-dup.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73387.240308.patch
Type: text/x-patch
Size: 17905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200124/ba431369/attachment.bin>


More information about the llvm-commits mailing list