[StructurizeCFG][NewPM] Port -structurizecfg to NPM
authorArthur Eubanks <aeubanks@google.com>
Thu, 8 Oct 2020 05:07:30 +0000 (22:07 -0700)
committerArthur Eubanks <aeubanks@google.com>
Fri, 23 Oct 2020 22:54:03 +0000 (15:54 -0700)
commitbaffd052b0f7c6ce52cf958e39726545d8edddf2
treeade252aa37f4252ea2ece4d07db89458036d6327
parentba22c403b2b316d59902ba55e8774a7a34d2d056
[StructurizeCFG][NewPM] Port -structurizecfg to NPM

This doesn't support -structurizecfg-skip-uniform-regions since that
would require porting LegacyDivergenceAnalysis.

The NPM doesn't support adding a non-analysis pass as a dependency of
another, so I had to add -lowerswitch to some tests or pin them to the
legacy PM.

This is the only RegionPass in tree, so I simply copied the logic for
finding all Regions from the legacy PM's RGManager into
StructurizeCFG::run().

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D89026
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Transforms/Scalar/StructurizeCFG.h [new file with mode: 0644]
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/Scalar/Scalar.cpp
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
llvm/test/Transforms/StructurizeCFG/AMDGPU/uniform-regions.ll
llvm/test/Transforms/StructurizeCFG/interleaved-loop-order.ll
llvm/test/Transforms/StructurizeCFG/nested-loop-order.ll
llvm/test/Transforms/StructurizeCFG/switch.ll