Commit Graph

8 Commits

Author SHA1 Message Date
Daniel Berlin
7098cc87ae GVNSink: Make ModelledPHIs constructor linear (and avoid edge case it worries about) by avoiding getIncomingValueForBlock
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313702 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 00:07:27 +00:00
Daniel Berlin
6562d76420 Revert "[GVNSink] Remove dependency on SmallPtrSet iteration order."
This reverts commit r312156, because now the op and block arrays are not in the same order :(.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313701 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 00:07:25 +00:00
Benjamin Kramer
065862a117 [GVNSink] Remove dependency on SmallPtrSet iteration order.
Found by LLVM_ENABLE_REVERSE_ITERATION.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312156 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30 18:46:37 +00:00
Frederich Munch
e49b209a9e Hide dbgs() stream for when built with -fmodules.
Summary: Make DebugCounter::print and dump methods to be const correct.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34214

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305408 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-14 19:16:22 +00:00
Galina Kistanova
6a9071188b Changed a comparison operator for std::stable_sort to implement strict weak ordering.
This is a temporarily fix which needs additional work, as it triggers a test3 failure.
test3 is commented out till then.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304993 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 17:27:40 +00:00
James Molloy
ac73777f2e [GVNSink] Pacify MSVC
Don't convert an unsigned to a pointer for a sentinel, use a size_t instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303855 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 13:14:10 +00:00
James Molloy
bb5d60d753 [GVNSink] Don't define operator<< in NDEBUG
Without debug macros enabled, the raw_ostream operator<< overload
is unused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303852 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 13:11:18 +00:00
James Molloy
9693a6db68 [GVNSink] GVNSink pass
This patch provides an initial prototype for a pass that sinks instructions based on GVN information, similar to GVNHoist. It is not yet ready for commiting but I've uploaded it to gather some initial thoughts.

This pass attempts to sink instructions into successors, reducing static
instruction count and enabling if-conversion.
We use a variant of global value numbering to decide what can be sunk.
Consider:

[ %a1 = add i32 %b, 1  ]   [ %c1 = add i32 %d, 1  ]
[ %a2 = xor i32 %a1, 1 ]   [ %c2 = xor i32 %c1, 1 ]
                 \           /
           [ %e = phi i32 %a2, %c2 ]
           [ add i32 %e, 4         ]

GVN would number %a1 and %c1 differently because they compute different
results - the VN of an instruction is a function of its opcode and the
transitive closure of its operands. This is the key property for hoisting
and CSE.

What we want when sinking however is for a numbering that is a function of
the *uses* of an instruction, which allows us to answer the question "if I
replace %a1 with %c1, will it contribute in an equivalent way to all
successive instructions?". The (new) PostValueTable class in GVN provides this
mapping.

This pass has some shown really impressive improvements especially for codesize already on internal benchmarks, so I have high hopes it can replace all the sinking logic in SimplifyCFG.

Differential revision: https://reviews.llvm.org/D24805

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 12:51:11 +00:00