Page MenuHomePhabricator

[DivergenceAnalysis] Treat PHI with incoming undef as constant

Authored by nhaehnle on Apr 12 2016, 8:23 AM.



If a PHI has an incoming undef, we can pretend that it is equal to one
non-undef, non-self incoming value.

This is particularly relevant in combination with the StructurizeCFG
pass, which introduces PHI nodes with undefs. Previously, this lead to
branch conditions that were uniform before StructurizeCFG to become
non-uniform afterwards, which confused the SIAnnotateControlFlow

This fixes a crash when Mesa radeonsi compiles a shader from

Diff Detail


Event Timeline

nhaehnle updated this revision to Diff 53403.Apr 12 2016, 8:23 AM
nhaehnle retitled this revision from to [DivergenceAnalysis] Treat PHI with incoming undef as constant.
nhaehnle updated this object.
nhaehnle added a subscriber: llvm-commits.

It turns out that this change manages to lead to the same assertion in test/CodeGen/AMDGPU/si-spill-cf.ll, which previously didn't assert only through sheer luck as far as I can tell.

So this commit should come after D19018, which implements the more thorough and robust fix for this problem that I had originally written.

jingyue accepted this revision.Apr 12 2016, 10:12 AM
jingyue edited edge metadata.


160 ↗(On Diff #53403)

two spaces => one space

19 ↗(On Diff #53403)

Traditionally, basic block names are lower-case.

This revision is now accepted and ready to land.Apr 12 2016, 10:12 AM
This revision was automatically updated to reflect the committed changes.