diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2016-04-14 17:42:47 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2016-04-14 17:42:47 +0000 |
commit | 13d90f324c5169f67fcf72ae39426e2c826b9295 (patch) | |
tree | 45fae75866fda15e23cfef2aaae9960661bc4971 /llvm/lib/Analysis/DivergenceAnalysis.cpp | |
parent | 05b127da063133a2702c4399d97e14f43492a596 (diff) | |
download | bcm5719-llvm-13d90f324c5169f67fcf72ae39426e2c826b9295.tar.gz bcm5719-llvm-13d90f324c5169f67fcf72ae39426e2c826b9295.zip |
[DivergenceAnalysis] Treat PHI with incoming undef as constant
Summary:
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
pass.
This fixes a crash when Mesa radeonsi compiles a shader from
dEQP-GLES3.functional.shaders.switch.switch_in_for_loop_dynamic_vertex
Reviewers: arsenm, tstellarAMD, jingyue
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D19013
llvm-svn: 266347
Diffstat (limited to 'llvm/lib/Analysis/DivergenceAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/DivergenceAnalysis.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DivergenceAnalysis.cpp b/llvm/lib/Analysis/DivergenceAnalysis.cpp index 0e1cfcfe259..fd32b57c89e 100644 --- a/llvm/lib/Analysis/DivergenceAnalysis.cpp +++ b/llvm/lib/Analysis/DivergenceAnalysis.cpp @@ -146,7 +146,7 @@ void DivergencePropagator::exploreSyncDependency(TerminatorInst *TI) { for (auto I = IPostDom->begin(); isa<PHINode>(I); ++I) { // A PHINode is uniform if it returns the same value no matter which path is // taken. - if (!cast<PHINode>(I)->hasConstantValue() && DV.insert(&*I).second) + if (!cast<PHINode>(I)->hasConstantOrUndefValue() && DV.insert(&*I).second) Worklist.push_back(&*I); } |