[PATCH] D123231: [StructurizeCFG] Improve basic block ordering

Brendon Cahoon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 07:19:40 PDT 2022


bcahoon updated this revision to Diff 422850.
bcahoon edited the summary of this revision.
bcahoon added a reviewer: cfang.
bcahoon added a comment.

Made several changes based upon suggestions and to fix a correctness issue:

- The new function, reorderNodes, must appear before collectInfos because collectInfos collects branch predicate information based upon the order of the nodes, so the wrong branch information was used after nodes were reordered.
- Changed name of the function, from improveNodeOrder to reorderNodes because changing the order is an improvement under certain conditions.
- Only reorder the nodes for large regions. The size of the region can be changed with a command-line option. The issues fixed by this patch are seen only with very large regions, so this flag limits the impact of this patch.  I'm open to other ways to do this.
- Since reorderNodes appears before collectInfos, it no longer can use Visited. Instead, reorderNodes keeps track of the basic blocks in Order and uses that as part of the criteria to reorder. We only want to reorder a node that has a predecessor in Order.


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

https://reviews.llvm.org/D123231

Files:
  llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
  llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll
  llvm/test/Transforms/StructurizeCFG/improve-order.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123231.422850.patch
Type: text/x-patch
Size: 25967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220414/14da65c6/attachment.bin>


More information about the llvm-commits mailing list