[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 08:59:59 PST 2024


================
@@ -1229,8 +1248,15 @@ FunctionPass *llvm::createSPIRVStructurizerPass() {
 
 PreservedAnalyses SPIRVStructurizerWrapper::run(Function &F,
                                                 FunctionAnalysisManager &AF) {
-  FunctionPass *StructurizerPass = createSPIRVStructurizerPass();
-  if (!StructurizerPass->runOnFunction(F))
+  // TODO: Review this after migrating SPIRV passes to "modern" pass manager.
+  auto FPM = legacy::FunctionPassManager(F.getParent());
+  FPM.add(createLoopSimplifyPass());
+  FPM.add(new DominatorTreeWrapperPass());
+  FPM.add(new LoopInfoWrapperPass());
+  FPM.add(new SPIRVConvergenceRegionAnalysisWrapperPass());
+  FPM.add(createSPIRVStructurizerPass());
+
+  if (!FPM.run(F))
----------------
Keenuts wrote:

For the `LoopSimplify` pass itself, we could probably remove it, and expect the user respect the preconditions.

For the others, aren't all supporting both pass managers?

https://github.com/llvm/llvm-project/pull/116331


More information about the llvm-commits mailing list