This is an archive of the discontinued LLVM Phabricator instance.

[MachineSink] Bail out if BreakPHIEdge is not consistent across iterations
AbandonedPublic

Authored by lkail on Apr 16 2020, 7:08 AM.

Details

Reviewers
qcolombet
jsji
nemanjai
alex-t
Group Reviewers
Restricted Project
Summary

Suppose we have CFG

                +-----------------+
                |%bb.0:           |
                |%r0, %r1 = OP ...|
         +------+-------------+---+
         |                    |
         |                    |
         |                    |
         |                    |
+--------v-------+            |
|%bb.1:          |            |
|%r2 = OP ...    |            |
+----------------+---+        |
                     |        |
                     |        |
                     |        |
                     |        |
                +----v--------v----+
                |%bb.2:            |
                |%r3 = PHI %r0, %r2|
                |USE %r1           |
                +------------------+

When testing if %bb.2 is a proper sink point for %r0, BreakPHIEdge is set true, a new BB is supposed to be added between bb.0 and bb.2. Then %r1 is also tested against %bb.2, however BreakPHIEdge is set false. This leads to sinking %r0, %r1 = OP ... after %r3 = PHI %r0, %r2 in %bb.2, which is not right. This patch checks consistency of BreakPHIEdge between adjacent iteration and bail out if it's inconsistent.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45557.

Diff Detail

Event Timeline

lkail created this revision.Apr 16 2020, 7:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 16 2020, 7:08 AM
lkail edited the summary of this revision. (Show Details)Apr 16 2020, 7:19 AM
lkail abandoned this revision.Apr 16 2020, 7:28 AM

Already fixed by https://reviews.llvm.org/D78087, but not landed now.