[PATCH] D47441: SafepointIRVerifier should ignore dead blocks

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 28 00:33:50 PDT 2018


yrouban created this revision.
yrouban added reviewers: anna, reames, DaniilSuchkov, skatkov.
Herald added a reviewer: dberlin.

Not only should SafepointIRVerifier ignore unreachable blocks
(as suggested in https://reviews.llvm.org/D47011) but it also
has to ignore dead blocks.

In @test2 (see the new tests):

  br i1 true, label %right, label %left

left:

  ...

right:

  ...

merge:

  %val = phi i8 addrspace(1)* [ ..., %left ], [ ..., %right ]
  use %val

both left and right branches are reachable.
If they collide then SafepointIRVerifier reports an error.

Because of the foldable branch condition GVN finds the left
branch dead and removes the phi node entry that merges values
from right and left. Then the use comes from the right branch.
This results in no collision.

So, SafepointIRVerifier ends up in different results depending
on either GVN is run or not.

To solve this issue this patch adds Dead Block detection to
SafepointIRVerifier which can ignore dead blocks while
validating IR. The Dead Block detection algorithm is taken
from GVN but modified to not split critical edges. That is
needed to keep CFG unchanged by SafepointIRVerifier.


https://reviews.llvm.org/D47441

Files:
  lib/IR/SafepointIRVerifier.cpp
  test/SafepointIRVerifier/dead-block-tolerant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47441.148780.patch
Type: text/x-patch
Size: 11819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180528/6aa24da2/attachment.bin>


More information about the llvm-commits mailing list