[PATCH] D92247: [IR][LoopRotate] avoid leaving phi with no operands (PR48296)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 29 07:46:29 PST 2020


spatel added a comment.

In D92247#2421208 <https://reviews.llvm.org/D92247#2421208>, @lattner wrote:

> I don't think this is the right way to go, this breaks the invariant that # inputs to a phi node should match the # predecessors to a block.  I'd recommend allowing zero input phi nodes in zero-predecessor blocks.  I'm not sure why we ban zero input phi nodes right now.

I'm not seeing how this would break the assumption (and maybe that's clearer with the updated patch?), but that's an interesting question and independent of this fix IIUC.

The verifier assertion says:

  // Ensure that PHI nodes have at least one entry!
  Assert(PN.getNumIncomingValues() != 0,
         "PHI nodes must have at least one entry.  If the block is dead, "
         "the PHI should be removed!",
         &PN);

But if we're in an unreachable block, then we allow other IR forms that are even less expected (self-reference), so we should loosen this restriction?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92247/new/

https://reviews.llvm.org/D92247



More information about the llvm-commits mailing list