]> granicus.if.org Git - llvm/commit
NewGVN: Move leaders around properly to ensure we have a canonical dominating leader...
authorDaniel Berlin <dberlin@dberlin.org>
Fri, 13 Jan 2017 22:40:01 +0000 (22:40 +0000)
committerDaniel Berlin <dberlin@dberlin.org>
Fri, 13 Jan 2017 22:40:01 +0000 (22:40 +0000)
commite782760da1ef91b5116fb3fe90a423ea68caf9ef
tree8ca08db42adee0090f46de64f3124b424aa8a5b1
parentb24afca5bea91ce12c8689392718508b32f9e036
NewGVN: Move leaders around properly to ensure we have a canonical dominating leader. Fixes PR 31613.

Summary:
This is a testcase where phi node cycling happens, and because we do
not order the leaders by domination or anything similar, the leader
keeps changing.

Using std::set for the members is too expensive, and we actually don't
need them sorted all the time, only at leader changes.

We could keep both a set and a vector, and keep them mostly sorted and
resort as necessary, or use a set and a fibheap, but all of this seems
premature.

After running some statistics, we are able to avoid the vast majority
of sorting by keeping a "next leader" field.  Most congruence classes only have
leader changes once or twice during GVN.

Reviewers: davide

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291968 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/NewGVN.cpp
test/Transforms/NewGVN/pr31613.ll [new file with mode: 0644]