[PATCH] D43743: StructurizeCFG: Test for branch divergence correctly

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 25 07:27:57 PST 2018

nhaehnle created this revision.
nhaehnle added reviewers: arsenm, rampitec, jlebar, alex-t.

Fixes cases like the new test @nonuniform. In that test, %cc itself
is a uniform value; however, when reading it after the end of the loop in
basic block %if, its value is effectively non-uniform, so the branch is

This problem was encountered in
https://bugs.freedesktop.org/show_bug.cgi?id=103743; however, this change
in itself is not sufficient to fix that bug, as there is another issue
in the AMDGPU backend.

As discovered after committing an earlier version of this change, this
exposes a subtle interaction between this pass and DivergenceAnalysis:
since we remove and re-create branch instructions, we can no longer rely
on DivergenceAnalysis for branches in subregions that were already
processed by the pass.

Explicitly remove branch instructions from DivergenceAnalysis to
avoid dangling pointers as a matter of defensive programming, and
change how we detect non-uniform subregions.

Change-Id: I32bbffece4a32f686fab54964dae1a5dd72949d4




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43743.135825.patch
Type: text/x-patch
Size: 8111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180225/86376de9/attachment.bin>

More information about the llvm-commits mailing list