[llvm] [CodeGen] Port DwarfEHPrepare to new pass manager (PR #72500)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 17:54:43 PST 2023


================
@@ -365,6 +366,26 @@ class DwarfEHPrepareLegacyPass : public FunctionPass {
 
 } // end anonymous namespace
 
+PreservedAnalyses DwarfEHPreparePass::run(Function &F,
+                                          FunctionAnalysisManager &FAM) {
+  const auto &TLI = *TM->getSubtargetImpl(F)->getTargetLowering();
+  auto *DT = FAM.getCachedResult<DominatorTreeAnalysis>(F);
+  const TargetTransformInfo *TTI = nullptr;
+  if (OptLevel != CodeGenOptLevel::None) {
+    if (!DT)
+      DT = &FAM.getResult<DominatorTreeAnalysis>(F);
+    TTI = &FAM.getResult<TargetIRAnalysis>(F);
+  }
+  bool Changed =
+      prepareDwarfEH(OptLevel, F, TLI, DT, TTI, TM->getTargetTriple());
----------------
arsenm wrote:

I forgot about that wart, it should really store the parsed form 

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


More information about the llvm-commits mailing list