This is an archive of the discontinued LLVM Phabricator instance.

[NewGVN] Update phi-of-ops def block when updating existing ValuePHI.
ClosedPublic

Authored by fhahn on Feb 26 2018, 11:06 AM.

Details

Summary

In case we update a ValuePHI node created earlier, we could update it
based on a different OpPHI which could be in a different block.
We need to update the TempToBlock mapping reflecting the new block,
otherwise we would end up placing the new phi node in a wrong block.

This problem is exposed by the test case in
https://bugs.llvm.org/show_bug.cgi?id=36504.

This patch fixes a slightly simpler problem than in the bug report. In
the bug's re-producer, the additional problem is that we are re-using a
ValuePHI node with to few incoming values for the new OpPHI. If this
patch makes sense, I will follow it up with a patch that creates a new
PHI node if the existing PHI node has a different number of incoming
values.

Diff Detail

Repository
rL LLVM

Event Timeline

fhahn created this revision.Feb 26 2018, 11:06 AM

This is definitely correct.
Note that this also means we are likely leaving around TempToBlock mappings for ops because we don't remove them in removePhiOfOps.
(But that would require reference counting ATM, i believe, because they may be reused).
This shouldn't hurt anything, i believe.

dberlin accepted this revision.Feb 26 2018, 11:21 AM

Can you just use update_test_checks to generate the CHECK lines? We are trying to use it for all the newgvn tests.

This revision is now accepted and ready to land.Feb 26 2018, 11:21 AM
fhahn updated this revision to Diff 136047.Feb 27 2018, 1:31 AM
fhahn edited the summary of this revision. (Show Details)

Create check lines using update_test_checks.py

This revision was automatically updated to reflect the committed changes.