[PATCH] D131181: [AMDGPU] Fix si-annotate-control-flow for visited else branch

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 10:18:21 PDT 2022


yaxunl created this revision.
yaxunl added reviewers: arsenm, rampitec, foad, nhaehnle.
Herald added subscribers: kosarev, kerbowa, hiraditya, t-tye, tpr, dstuttard, jvesely, kzhuravl.
Herald added a project: All.
yaxunl requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

si-annotate-control-flow does depth first traversal of BB's of
a function to insert amdgcn if intrinsics for conditional
branches so that isel can generate correct instructions later.

si-annotate-control-flow checks whether the successor BB for the 'else'
branch of a conditional branch has been visited. If it has been
visited, si-annotate-control-flow assumes the conditional
branch has been handled and will not try to insert if intrinsic
for it.

This assumption is not correct. In IR's generated for HIP applications
it is possible that the successor BB in the 'else' branch has been
visited, but the conditional branch has not been handled.

This patch introduce a set to track the conditional branches
which has been handled, so that we do not miss conditional
branches even if its successor BB has been visited.


https://reviews.llvm.org/D131181

Files:
  llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
  llvm/test/CodeGen/AMDGPU/si-annotate-cf-else-visited.ll
  llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131181.450034.patch
Type: text/x-patch
Size: 5460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220804/5b5f157d/attachment.bin>


More information about the llvm-commits mailing list