[PATCH] D35918: [GVNHoist] Factor out reachability to search for anticipable instructions quickly

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 14:37:43 PDT 2017


hiraditya created this revision.
Herald added a subscriber: Prazek.

Factor out the reachability such that multiple queries to find reachability of values are fast. This is based on finding the ANTIC points
in the CFG which do not change during hoisting. The ANTIC points are basically the dominance-frontiers in the inverse graph. So we introduce a data structure (CHI nodes)
to keep track of values flowing out of a basic block. We only do this for values with multiple occurrences in the function as they are the potential hoistable candidates.

This patch allows us to hoist instructions to a basic block with >2 successors, as well as deal with infinite loops in a trivial way.
Relevant test cases are added to show the functionality as well as regression fixes from PR32821.

Regression from previous GVNHoist:
We do not hoist fully redundant expressions because fully redundant expressions are already handled by NewGVN

Based on the suggestions from @dberlin and @sebpop


https://reviews.llvm.org/D35918

Files:
  lib/Transforms/Scalar/GVNHoist.cpp
  test/Transforms/GVNHoist/hoist-more-than-two-branches.ll
  test/Transforms/GVNHoist/hoist-mssa.ll
  test/Transforms/GVNHoist/hoist-newgvn.ll
  test/Transforms/GVNHoist/hoist-pr20242.ll
  test/Transforms/GVNHoist/hoist-pr28933.ll
  test/Transforms/GVNHoist/hoist-recursive-geps.ll
  test/Transforms/GVNHoist/hoist.ll
  test/Transforms/GVNHoist/infinite-loop-direct.ll
  test/Transforms/GVNHoist/infinite-loop-indirect.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35918.108360.patch
Type: text/x-patch
Size: 43394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170726/615741db/attachment.bin>


More information about the llvm-commits mailing list