[PATCH] D43565: [SimplifyCFG] Expanding scope for hoisting common instructions after branch

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 03:34:17 PST 2018


inouehrs created this revision.
inouehrs added reviewers: hfinkel, efriedma, davidxl, davide, iteratee, kbarton, nemanjai.

SimplifyCFG scans common instructions in two basic blocks after conditional branch and hoist them before the branch. 
The current implementation finds common instructions if the common instruction sequence starts from the top of the BBs without other instructions.
This patch allows other instructions to be placed before the common instruction sequence by scanning more instructions in BBs. To avoid excessive cost, the scan is limited to up to 10 instructions from the top of the BB.
This additional hoisting gives code size reduction and also may result in further CFG optimizations, e.g. using a select instruction instead of the branch.

With this patch, about 67k more instructions are hoisted while bootstrap test (it is about 1.5x increase). The limit of the scan range (10 instructions) covers about 95% of the opportunity. The changes in the build time of the bootstrap test was almost negligible.


https://reviews.llvm.org/D43565

Files:
  lib/Transforms/Utils/SimplifyCFG.cpp
  test/Transforms/SimplifyCFG/phi-undef-loadstore.ll
  test/Transforms/SimplifyCFG/skip.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43565.135226.patch
Type: text/x-patch
Size: 10482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180221/7b04e6aa/attachment.bin>


More information about the llvm-commits mailing list