[PATCH] D136892: [AMDGPU] Unify uniform return and divergent unreachable blocks

Brendon Cahoon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 18:48:32 PDT 2022


bcahoon updated this revision to Diff 473386.
bcahoon added a comment.

I changed the patch based upon @ruiling comment. He's correct that my patch doesn't catch the case when there is a uniform exit and a divergent exit. I looked at adding a HasDivergentBranch condition suggested in his comments, but that seemed to be overly conservative and created a lot of lit test changes.. Instead, the patch checks for is there is any exit block (return/unreachable) that is not uniformly reached. If that condition occurs, then all returns and unreachable blocks are unify. That fixes the test case, and only effects a couple of existing test cases. Two of those test cases,  bool-legalization and skip-if-dead, are different because unreachable blocks are now added only if there is a divergent exit block. I think this conservatively will create a unified exit block correctly, but I'm interested in feedback.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136892/new/

https://reviews.llvm.org/D136892

Files:
  llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
  llvm/test/CodeGen/AMDGPU/GlobalISel/bool-legalization.ll
  llvm/test/CodeGen/AMDGPU/si-unify-exit-return-unreachable.ll
  llvm/test/CodeGen/AMDGPU/skip-if-dead.ll
  llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136892.473386.patch
Type: text/x-patch
Size: 28065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221105/4c576c38/attachment.bin>


More information about the llvm-commits mailing list