This is an archive of the discontinued LLVM Phabricator instance.

NewGVN: Don't propagate over phi backedges where undef causes us to have >1 value.
ClosedPublic

Authored by dberlin on Apr 10 2017, 6:01 PM.

Details

Summary

Fixes PR 32607 by only ignoring undef when we can prove the phi is cycle-free

Event Timeline

dberlin created this revision.Apr 10 2017, 6:01 PM

Unfortunately, as you can see, we lose optimization in a few cases where the phis *are* cycle-free.
I could just bite the bullet and build scc's to determine cycle-freeness.
I'll do some performance testing.

  • Add SCC finding to discover cycle-free phis

(I'm performance testing a bunch of versions of this patch)

Fix small issue in SCC impl.

So far, i can't find any measurable time spent in the SCC version, so i think we will go with that.

davide accepted this revision.Apr 13 2017, 10:20 PM

LGTM. I'd split the SCC finder and move maybe to a separate file (as we may want to use it somewhere else), but we can move it later, so.

This revision is now accepted and ready to land.Apr 13 2017, 10:20 PM

At some point i'm going to try to make the graph-traits'ish version work.
The main issue for us is that we have to iterate through all parts, because it's really stateless from our perspective.

IE every time you call scc_begin, it is starting the SCC finding from scratch.

That turned out to be pretty expensive for us vs doing this.

davide closed this revision.Apr 14 2017, 8:16 AM