8 Commits

Author SHA1 Message Date
Daniel Berlin
4ddfe6915d PredicateInfo: Support switch statements
Summary:
Depends on D29606 and D29682

Makes us pass GVN's edge.ll (we also will pass a few other testcases
they just need cleaning up).

Thoughts on the Predicate* hiearchy of classes especially welcome :)
(it's not clear to me how best to organize it, and currently, the getBlock* seems ... uglier than maybe wasting a field somewhere or something).

Reviewers: davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295889 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 22:20:58 +00:00
Simon Pilgrim
7bbcf1cec3 Removed extra ';'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295603 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 12:32:44 +00:00
Daniel Berlin
2287817fa9 Add a DebugCounter for PredicateInfo renaming, and an associated test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295594 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 04:29:01 +00:00
Simon Pilgrim
3da1c311ba Fix unused variable warning when assertions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295587 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-19 00:33:37 +00:00
Daniel Berlin
33e17b4040 PredicateInfo: Clean up predicate info a little, using insertion
helpers, and fixing support for the renaming the comparison.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-18 23:06:38 +00:00
Daniel Berlin
8697d189a9 PredicateInfo: Handle critical edges
Summary:
This adds support for placing predicateinfo such that it affects critical edges.

This fixes the issues mentioned by Nuno on the mailing list.

Depends on D29519

Reviewers: davide, nlopes

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-12 22:12:20 +00:00
Daniel Berlin
17b4ddbad6 PredicateInfo: Some compilers are unhappy with naming Use *'s Use. Change the name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294364 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-07 22:11:43 +00:00
Daniel Berlin
94f2e5a1f1 Add PredicateInfo utility and printing pass
Summary:
This patch adds a utility to build extended SSA (see "ABCD: eliminating
array bounds checks on demand"), and an intrinsic to support it. This
is then used to get functionality equivalent to propagateEquality in
GVN, in NewGVN (without having to replace instructions as we go). It
would work similarly in SCCP or other passes. This has been talked
about a few times, so i built a real implementation and tried to
productionize it.

Copies are inserted for operands used in assumes and conditional
branches that are based on comparisons (see below for more)

Every use affected by the predicate is renamed to the appropriate
intrinsic result.

E.g.
%cmp = icmp eq i32 %x, 50
br i1 %cmp, label %true, label %false
true:
ret i32 %x
false:
ret i32 1

will become

%cmp = icmp eq i32, %x, 50
br i1 %cmp, label %true, label %false
true:
; Has predicate info
; branch predicate info { TrueEdge: 1 Comparison: %cmp = icmp eq i32 %x, 50 }
%x.0 = call @llvm.ssa_copy.i32(i32 %x)
ret i32 %x.0
false:
ret i23 1

(you can use -print-predicateinfo to get an annotated-with-predicateinfo dump)

This enables us to easily determine what operations are affected by a
given predicate, and how operations affected by a chain of
predicates.

Reviewers: davide, sanjoy

Subscribers: mgorny, llvm-commits, Prazek

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

Update for review comments

Fix a bug Nuno noticed where we are giving information about and/or on edges where the info is not useful and easy to use wrong

Update for review comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294351 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-07 21:10:46 +00:00