This is an archive of the discontinued LLVM Phabricator instance.

SafepointIRVerifier is made unreachable block tolerant
ClosedPublic

Authored by yrouban on May 17 2018, 5:04 AM.

Details

Summary

SafepointIRVerifier crashed while traversing blocks without a DomTreeNode.
This could happen with a custom pipeline or when some optional passes were skipped by OptBisect.

SafepointIRVerifier is fixed to traverse basic blocks that are reachable from entry. Test are added.

Diff Detail

Repository
rL LLVM

Event Timeline

yrouban created this revision.May 17 2018, 5:04 AM
reames accepted this revision.May 17 2018, 9:55 AM

LGTM

This revision is now accepted and ready to land.May 17 2018, 9:55 AM

Without this patch following code leads to a crash

entry:
ptr = getPtr()
br exit

unreachable_bb:
ptr2 = getPtr()
br exit

exit:
p = phi [ptr, entry], [ptr2, unreachable_bb]
v = load p
ret v

But with your patch it's a false-positive. Verifier will report invalid use of poisoned value p here (since unreachable_bb isn't processed and thus ptr2 isn't in its AvailableOut set).
Could you please leave a FIXME about it?

yrouban planned changes to this revision.May 17 2018, 9:47 PM

Good catch Daniil! SafepointIRVerifier crashes with your case. I will improve the patch and add a test.

yrouban updated this revision to Diff 147443.May 18 2018, 12:02 AM
yrouban edited the summary of this revision. (Show Details)

considered a case with unreachable blocks connected to reachable ones

This revision is now accepted and ready to land.May 18 2018, 12:02 AM

LLVM committers, can you integrate this patch, please?

This revision was automatically updated to reflect the committed changes.