[PATCH] D46340: AMDGPU/SI: Handle infinite loop for the structurizer to work with CFG with infinite loops.

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 16:11:41 PDT 2018


cfang created this revision.
cfang added reviewers: arsenm, nhaehnle, rampitec.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, wdng, kzhuravl.
Herald added a reviewer: a.sidorin.

The current StructurizeCFG pass only works for CFG with one exit. AMDGPUUnifyDivergentExitNodes combines multiple "return" blocks and/or "unreachable" blocks
to one exit block for the Structurizer to work. However, infinite loop is another kind of special "exit", and if we don't handle it, the case of multiple exits will prevent the structurizer from working.

In this work, for each infinite loop, we add a dummy edge to the "return" block, and thus the  AMDGPUUnifyDivergentExitNodes pass will work with infinite loops. 
This will make CFG with infinite loops be structurized.


https://reviews.llvm.org/D46340

Files:
  lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
  test/CodeGen/AMDGPU/branch-relaxation.ll
  test/CodeGen/AMDGPU/cf-loop-on-constant.ll
  test/CodeGen/AMDGPU/infinite-loop.ll
  test/CodeGen/AMDGPU/nested-loop-conditions.ll
  test/CodeGen/AMDGPU/si-annotate-cf.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46340.144805.patch
Type: text/x-patch
Size: 7121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180501/1598c8ce/attachment.bin>


More information about the llvm-commits mailing list