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>
Wed, 29 Jan 2020 14:08:46 +0000 (15:08 +0100)
commit323bfde20c5f3e63db3d6b385b394ed38542abe6
tree3e5cde721f70bf35691cac7cec97114f87b3d0c2
parent0994c485e61322a04e580d83617eab547292aba2
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