[StructurizeCFG] Fix region nodes ordering
authorEhud Katz <ehudkatz@gmail.com>
Mon, 1 Jun 2020 09:50:35 +0000 (12:50 +0300)
committerEhud Katz <ehudkatz@gmail.com>
Mon, 1 Jun 2020 09:50:35 +0000 (12:50 +0300)
commit85c308804966e52a14bc98874a6cc6e42cbb1d40
treed579309e5daba515f0d1ef58266f8cb71a64f69a
parente75efcc3c1af068a145ea83deb0435b195a44162
[StructurizeCFG] Fix region nodes ordering

This is a reimplementation of the `orderNodes` function, as the old
implementation didn't take into account all cases.
The new implementation uses SCCs instead of Loops to take account of
irreducible loops.

Fix PR41509

Differential Revision: https://reviews.llvm.org/D79037
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
llvm/test/Transforms/StructurizeCFG/interleaved-loop-order.ll [new file with mode: 0644]
llvm/test/Transforms/StructurizeCFG/nested-loop-subregion.ll [new file with mode: 0644]