[PATCH] D18443: [Verifier] Reject PHIs using definitions from own block.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 05:42:19 PDT 2016

Meinersbur created this revision.
Meinersbur added reviewers: majnemer, reames, sanjoy, JosephTremoulet, kparzysz, bkramer, grosser, jdoerfert.
Meinersbur added a subscriber: llvm-commits.
Meinersbur set the repository for this revision to rL LLVM.

Reject the following IR as malformed (assuming that %entry, %next are not in a loop):

      %y = phi i32 [ 0, %entry ]
      %x = phi i32 [ %y, %entry ]

Such PHI nodes came up in PR26718. While there was no consensus on whether or not this is valid IR, most opinions on that bug and in a discussion on the llvm-dev mailing list tended towards a "strict interpretation" (term by Joseph Tremoulet) of PHI node uses. Also, the language reference explicitly states that "the use of each incoming value is deemed to occur on the edge from the corresponding predecessor block to the current block."

For the code mentioned in PR15384, clang does not compile to such PHIs anymore. The test case therefore has been removed and if clang still generates such PHIs in other cases, it should be filed as a bug in clang. Therefore the test case for PR15384 is removed.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18443.51542.patch
Type: text/x-patch
Size: 3216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160324/f3ad06be/attachment.bin>

More information about the llvm-commits mailing list