]> granicus.if.org Git - llvm/commit
NewGVN: Fix PR 31686 and PR 31698 by rewriting store leader handling.
authorDaniel Berlin <dberlin@dberlin.org>
Fri, 20 Jan 2017 21:04:30 +0000 (21:04 +0000)
committerDaniel Berlin <dberlin@dberlin.org>
Fri, 20 Jan 2017 21:04:30 +0000 (21:04 +0000)
commitd130a4ccb6ae1485f9b24678f338b16d3b4878a6
treede3b5eb8839cd5dedb16cd24fc7d3a368730134f
parentd7767b21fb30244448df9ffcbff9a3075b2f674b
NewGVN: Fix PR 31686 and PR 31698 by rewriting store leader handling.

Summary:

This rewrites store expression/leader handling.  We no longer use the
value operand as the leader, instead, we store it separately.  We also
now store the stored value as part of the expression, and compare it
when comparing stores for equality.  This enables us to get rid of a
bunch of our previous hacks and machinations, as the existing
machinery takes care of everything *except* updating the stored value
on classes.  The only time we have to update it is if the storecount
goes to 0, and when we do, we destroy it.

Since we no longer use the value operand as the leader, during elimination, we have to use the value operand.  Doing this also fixes a bunch of store forwarding cases we were missing.

Any value operand we use is guaranteed to either be updated by previous eliminations, or minimized by future ones.

(IE the fact that we don't use the most dominating value operand when it's not a constant does not affect anything).

Sadly, this change also exposes that we didn't pay attention to the
output of the pr31594.ll test, as it also very clearly exposes the
same store leader bug we are fixing here.

(I added pr31682.ll anyway, but maybe we think that's too large to be useful)

On the plus side, propagate-ir-flags.ll now passes due to the
corrected store forwarding.

This change was 3 stage'd on darwin and linux, with the full test-suite.

Reviewers:
davide
Subscribers:
llvm-commits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292648 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Scalar/GVNExpression.h
lib/Transforms/Scalar/NewGVN.cpp
test/Transforms/NewGVN/loadforward.ll [new file with mode: 0644]
test/Transforms/NewGVN/pr31594.ll
test/Transforms/NewGVN/pr31686.ll [new file with mode: 0644]
test/Transforms/NewGVN/propagate-ir-flags.ll