[PATCH] D98316: [rs4gc] Simplify code by cloning existing instructions when inserting base chain [NFC]

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 18 09:21:01 PDT 2021


reames added a comment.

In D98316#2630701 <https://reviews.llvm.org/D98316#2630701>, @skatkov wrote:

>> For the phi case, the new pattern is actually safer.  Consider the case where we miss an operand.  With the old code, we'd have a syntactically valid phi node with the wrong input.  With the new code, the verifier would reject the phi as it would be missing an operand.
>
> May be I'm missing something but to me it looks opposite :)
> In case some operand is missed, old code will produce incorrect phi node while new one will contain wrong input...

The key difference is between setIncomingValue and addIncomingValue.  If incorrect, the new code will fail to add an incoming edge.  That will produce a PHI which immediately fails verification.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98316



More information about the llvm-commits mailing list