[PATCH] D50591: [PGO] Control Height Reduction

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 10 16:51:12 PDT 2018


yamauchi created this revision.
yamauchi added a reviewer: davidxl.
Herald added subscribers: mgorny, mehdi_amini.

Control height reduction merges conditional blocks of code and reduces the
number of conditional branches in the hot path based on profiles.

if (hot_cond1) { // Likely true.

  do_stg_hot1();

}
if (hot_cond2) { // Likely true.

  do_stg_hot2();

}

->

if (hot_cond1 && hot_cond2) { // Hot path.

  do_stg_hot1();
  do_stg_hot2();

} else { // Cold path.

  if (hot_cond1) {
    do_stg_hot1();
  }
  if (hot_cond2) {
    do_stg_hot2();
  }

}

This speeds up some internal benchmarks up to ~30%.


Repository:
  rL LLVM

https://reviews.llvm.org/D50591

Files:
  include/llvm/InitializePasses.h
  include/llvm/LinkAllPasses.h
  include/llvm/Transforms/Instrumentation/ControlHeightReduction.h
  include/llvm/Transforms/Utils.h
  lib/Passes/PassBuilder.cpp
  lib/Passes/PassRegistry.def
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Instrumentation/CMakeLists.txt
  lib/Transforms/Instrumentation/ControlHeightReduction.cpp
  lib/Transforms/Instrumentation/Instrumentation.cpp
  test/Transforms/PGOProfile/chr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50591.160210.patch
Type: text/x-patch
Size: 131479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180810/5b115c23/attachment.bin>


More information about the llvm-commits mailing list