OSDN Git Service

[GVNHoist] Factor out reachability to search for anticipable instructions quickly
authorAditya Kumar <hiraditya@msn.com>
Wed, 13 Sep 2017 05:28:03 +0000 (05:28 +0000)
committerAditya Kumar <hiraditya@msn.com>
Wed, 13 Sep 2017 05:28:03 +0000 (05:28 +0000)
commitf844eaced2fd24719e8ad752a85932df49547baf
treef25dc51509213814a0628725c1483c9d31152d8b
parent16aceb828ae693d23787b1b6d7f692d8e19351cf
[GVNHoist] Factor out reachability to search for anticipable instructions quickly

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

Differential Revision: https://reviews.llvm.org/D35918
Reviewers: dberlin, sebpop, gberry,

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313116 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/GVNHoist.cpp
test/Transforms/GVNHoist/hoist-more-than-two-branches.ll [new file with mode: 0644]
test/Transforms/GVNHoist/hoist-mssa.ll
test/Transforms/GVNHoist/hoist-newgvn.ll [new file with mode: 0644]
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 [new file with mode: 0644]
test/Transforms/GVNHoist/infinite-loop-indirect.ll [new file with mode: 0644]