[PATCH] D138333: [CHR] Add a threshold for the code duplication

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 15:07:44 PST 2022


xur created this revision.
xur added a reviewer: davidxl.
Herald added subscribers: Enna1, wenlei, hiraditya.
Herald added a project: All.
xur requested review of this revision.
Herald added a project: LLVM.

ControlHeightReduction (CHR) clones the code region to reduce the branches in the hot code path. The number of clones is linear to the depth of the region.

Currently it does not have control over the code size increase. We are seeing one ~9000 BB functions get expanded to ~250000 BBs, an 25x increase.
This creates a big compile time issue for the downstream optimizations.

This patch adds a cap for number of clones for one region.


https://reviews.llvm.org/D138333

Files:
  llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
  llvm/test/Transforms/PGOProfile/chr-dup-threshold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138333.476610.patch
Type: text/x-patch
Size: 9791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221118/95459fb6/attachment-0001.bin>


More information about the llvm-commits mailing list