[PATCH] D19013: [DivergenceAnalysis] Treat PHI with incoming undef as constant

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 08:23:57 PDT 2016


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, tstellarAMD, jingyue.
nhaehnle added a subscriber: llvm-commits.

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

http://reviews.llvm.org/D19013

Files:
  include/llvm/IR/Instructions.h
  lib/Analysis/DivergenceAnalysis.cpp
  lib/IR/Instructions.cpp
  test/Analysis/DivergenceAnalysis/AMDGPU/phi-undef.ll
  test/CodeGen/AMDGPU/branch-uniformity.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19013.53403.patch
Type: text/x-patch
Size: 5149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/367ff941/attachment.bin>


More information about the llvm-commits mailing list