Page MenuHomePhabricator

[SimplifyCFG] Don't fold conditional branches that contain calls to convergent functions.
ClosedPublic

Authored by jlebar on Feb 10 2016, 8:59 PM.

Details

Summary

Performing this optimization duplicates the call to the convergent
function and adds new control-flow dependencies, which is a no-no.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 47596.Feb 10 2016, 8:59 PM
jlebar retitled this revision from to [SimplifyCFG] Don't fold conditional branches that contain calls to convergent functions..
jlebar updated this object.
jlebar added a reviewer: jingyue.
jlebar added subscribers: mzolotukhin, llvm-commits, arsenm and 5 others.
jingyue added inline comments.Feb 11 2016, 5:20 PM
test/Transforms/SimplifyCFG/attr-convergent.ll
21 ↗(On Diff #47596)

This test doesn't directly reflect your change because %cmp is not a PHINode. In fact, SimplifyCFG optimizes %cmp to PHINode before it worries about whether @barrier is convergent.

It would be more straight-forward to write a test where the containing block of @barrier directly branches at a PHINode directly.

jlebar updated this revision to Diff 47837.Feb 12 2016, 12:56 PM
jlebar marked an inline comment as done.

Simplify test.

This is a lot better, thank you for the suggestion.

jingyue edited edge metadata.Feb 12 2016, 1:04 PM
jingyue added a subscriber: jingyue.

Lgtm

This revision was automatically updated to reflect the committed changes.