[PATCH] D67383: Add new optimization pass of Tree-Height-Reduction

Masakazu Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 18:52:41 PDT 2019


masakazu.ueno created this revision.
masakazu.ueno added reviewers: mkuper, karthikthecool, TylerNowicki, mcrosier, hsaito, t.p.northover, fhahn, RKSimon, dcaballe.
Herald added subscribers: llvm-commits, mgrang, mgorny, mehdi_amini.
Herald added a project: LLVM.

The tree-height-reduction optimization increases the instruction-level parallelism by changing the order of calculations in a loop to keep the
calculation tree as short as possible.
For example, the following code is improved.
for (int i = 0; i < N; ++i){ a[i] = b[i] + c[i] + d[i] + e[i] + f[i] + g[i] + h[i] + k[i] ; }

- Conditions for optimization
  - Integer arithmetic: -O1 or higher is effective
  - Floating point arithmetic -O1 or higher is effective, AND -ffast-math is effective, AND -mllvm -enable-fp-thr is effective


Repository:
  rL LLVM

https://reviews.llvm.org/D67383

Files:
  include/llvm/InitializePasses.h
  include/llvm/Transforms/IPO/PassManagerBuilder.h
  include/llvm/Transforms/Scalar.h
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Scalar/CMakeLists.txt
  lib/Transforms/Scalar/Scalar.cpp
  lib/Transforms/Scalar/TreeHeightReduction.cpp
  test/Other/opt-O2-pipeline.ll
  test/Other/opt-O3-pipeline.ll
  test/Other/opt-Os-pipeline.ll
  test/Other/pass-pipelines.ll
  test/Transforms/TreeHeightReduction/AArch64/fp16-add-with-constant.ll
  test/Transforms/TreeHeightReduction/AArch64/fp16-add.c
  test/Transforms/TreeHeightReduction/AArch64/fp16-mult.c
  test/Transforms/TreeHeightReduction/AArch64/fp16-sub.ll
  test/Transforms/TreeHeightReduction/AArch64/long-double-add-with-constant.ll
  test/Transforms/TreeHeightReduction/AArch64/long-double-add.ll
  test/Transforms/TreeHeightReduction/AArch64/long-double-mult.ll
  test/Transforms/TreeHeightReduction/AArch64/long-double-sub.ll
  test/Transforms/TreeHeightReduction/X86/long-double-add-with-constant.ll
  test/Transforms/TreeHeightReduction/X86/long-double-add.ll
  test/Transforms/TreeHeightReduction/X86/long-double-mult.c
  test/Transforms/TreeHeightReduction/X86/long-double-sub-only.ll
  test/Transforms/TreeHeightReduction/floating-point-add-only.ll
  test/Transforms/TreeHeightReduction/floating-point-add-with-constant.ll
  test/Transforms/TreeHeightReduction/floating-point-mult-only.ll
  test/Transforms/TreeHeightReduction/floating-point-sub-only.ll
  test/Transforms/TreeHeightReduction/integer-add-only.ll
  test/Transforms/TreeHeightReduction/integer-add-with-constant.ll
  test/Transforms/TreeHeightReduction/integer-mult-only.ll
  test/Transforms/TreeHeightReduction/integer-sub-only.ll
  test/Transforms/TreeHeightReduction/leaf-num-check.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67383.219463.patch
Type: text/x-patch
Size: 142681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190910/f72090e9/attachment-0001.bin>


More information about the llvm-commits mailing list