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.