AMDGPU: Fix AMDGPUUnifyDivergentExitNodes with no normal returns
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 9 Dec 2019 11:04:00 +0000 (12:04 +0100)
committerConnor Abbott <cwabbott0@gmail.com>
Thu, 30 Jan 2020 09:55:02 +0000 (10:55 +0100)
commitce06d50756e9f59db50378753a42d03b9c3369c4
tree59cf243b67ba56daed7164f40e31004750ac94db
parentdd7148822bdc640f3a21a750e94b1fac0050d065
AMDGPU: Fix AMDGPUUnifyDivergentExitNodes with no normal returns

Summary:
The code was assuming in a few places that if there was only one exit
from the function that it was a normal return, which is invalid. It
could be an infinite loop, in which case we still need to insert the
usual fake edge so that the null export happens. This fixes shaders that
end with an infinite loop that discards.

Reviewers: arsenm, nhaehnle, critson

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71192
llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
llvm/test/CodeGen/AMDGPU/kill-infinite-loop.ll
llvm/test/CodeGen/AMDGPU/update-phi.ll