[llvm] 9bd32d7 - [CodeGen] Update DwarfEHPreparePass references in `CodeGenPassBuilder.h` (#74068)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 10 17:26:06 PST 2023


Author: paperchalice
Date: 2023-12-11T09:26:01+08:00
New Revision: 9bd32d78a9c8c51929f200ceefe735dc687ab10d

URL: https://github.com/llvm/llvm-project/commit/9bd32d78a9c8c51929f200ceefe735dc687ab10d
DIFF: https://github.com/llvm/llvm-project/commit/9bd32d78a9c8c51929f200ceefe735dc687ab10d.diff

LOG: [CodeGen] Update DwarfEHPreparePass references in `CodeGenPassBuilder.h` (#74068)

Forgot to update the counterpart in `CodeGenPassBuilder.h`. Also Rename `dwarfehprepare` -> `dwarf-eh-prepare`.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
    llvm/include/llvm/CodeGen/MachinePassRegistry.def
    llvm/lib/CodeGen/DwarfEHPrepare.cpp
    llvm/lib/Passes/PassRegistry.def
    llvm/test/CodeGen/Generic/opt-codegen-no-target-machine.ll
    llvm/test/CodeGen/Mips/compactbranches/beqc-bnec-register-constraint.ll
    llvm/test/CodeGen/X86/dwarf-eh-prepare-dbg.ll
    llvm/test/CodeGen/X86/dwarf-eh-prepare.ll
    llvm/test/CodeGen/X86/dwarf_eh_resume.ll
    llvm/tools/opt/opt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
index 94a2d0c6477b2b..bb139ef2eb3510 100644
--- a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h
@@ -23,6 +23,7 @@
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/Analysis/TypeBasedAliasAnalysis.h"
 #include "llvm/CodeGen/CallBrPrepare.h"
+#include "llvm/CodeGen/DwarfEHPrepare.h"
 #include "llvm/CodeGen/ExpandReductions.h"
 #include "llvm/CodeGen/InterleavedAccess.h"
 #include "llvm/CodeGen/MachinePassManager.h"
@@ -678,14 +679,14 @@ void CodeGenPassBuilder<Derived>::addPassesToHandleExceptions(
   case ExceptionHandling::DwarfCFI:
   case ExceptionHandling::ARM:
   case ExceptionHandling::AIX:
-    addPass(DwarfEHPass(getOptLevel()));
+    addPass(DwarfEHPreparePass(&TM));
     break;
   case ExceptionHandling::WinEH:
     // We support using both GCC-style and MSVC-style exceptions on Windows, so
     // add both preparation passes. Each pass will only actually run if it
     // recognizes the personality function.
     addPass(WinEHPreparePass());
-    addPass(DwarfEHPass(getOptLevel()));
+    addPass(DwarfEHPreparePass(&TM));
     break;
   case ExceptionHandling::Wasm:
     // Wasm EH uses Windows EH instructions, but it does not need to demote PHIs

diff  --git a/llvm/include/llvm/CodeGen/MachinePassRegistry.def b/llvm/include/llvm/CodeGen/MachinePassRegistry.def
index ceca04cd5ba3a5..e6e979a4582c7a 100644
--- a/llvm/include/llvm/CodeGen/MachinePassRegistry.def
+++ b/llvm/include/llvm/CodeGen/MachinePassRegistry.def
@@ -38,6 +38,7 @@ FUNCTION_ANALYSIS("targetir", TargetIRAnalysis,
 #endif
 FUNCTION_PASS("callbrprepare", CallBrPreparePass, ())
 FUNCTION_PASS("consthoist", ConstantHoistingPass, ())
+FUNCTION_PASS("dwarf-eh-prepare", DwarfEHPreparePass, (TM))
 FUNCTION_PASS("ee-instrument", EntryExitInstrumenterPass, (false))
 FUNCTION_PASS("expand-large-div-rem", ExpandLargeDivRemPass, ())
 FUNCTION_PASS("expand-large-fp-convert", ExpandLargeFpConvertPass, ())
@@ -123,7 +124,6 @@ DUMMY_FUNCTION_PASS("atomic-expand", AtomicExpandPass, ())
 DUMMY_FUNCTION_PASS("cfguard-check", CFGuardCheckPass, ())
 DUMMY_FUNCTION_PASS("cfguard-dispatch", CFGuardDispatchPass, ())
 DUMMY_FUNCTION_PASS("codegenprepare", CodeGenPreparePass, ())
-DUMMY_FUNCTION_PASS("dwarfehprepare", DwarfEHPass, ())
 DUMMY_FUNCTION_PASS("expandmemcmp", ExpandMemCmpPass, ())
 DUMMY_FUNCTION_PASS("gc-info-printer", GCInfoPrinterPass, ())
 DUMMY_FUNCTION_PASS("gc-lowering", GCLoweringPass, ())

diff  --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp
index a44aaf33c6a499..e7eb34d8e6518c 100644
--- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp
+++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp
@@ -42,7 +42,7 @@
 
 using namespace llvm;
 
-#define DEBUG_TYPE "dwarfehprepare"
+#define DEBUG_TYPE "dwarf-eh-prepare"
 
 STATISTIC(NumResumesLowered, "Number of resume calls lowered");
 STATISTIC(NumCleanupLandingPadsUnreachable,

diff  --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index c1641ea8b5b194..bf9622670ba59b 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -302,7 +302,7 @@ FUNCTION_PASS("dot-dom-only", DomOnlyPrinter())
 FUNCTION_PASS("dot-post-dom", PostDomPrinter())
 FUNCTION_PASS("dot-post-dom-only", PostDomOnlyPrinter())
 FUNCTION_PASS("dse", DSEPass())
-FUNCTION_PASS("dwarfehprepare", DwarfEHPreparePass(TM))
+FUNCTION_PASS("dwarf-eh-prepare", DwarfEHPreparePass(TM))
 FUNCTION_PASS("expand-large-div-rem", ExpandLargeDivRemPass(TM))
 FUNCTION_PASS("expand-large-fp-convert", ExpandLargeFpConvertPass(TM))
 FUNCTION_PASS("fix-irreducible", FixIrreduciblePass())

diff  --git a/llvm/test/CodeGen/Generic/opt-codegen-no-target-machine.ll b/llvm/test/CodeGen/Generic/opt-codegen-no-target-machine.ll
index 413f09ba55ddbf..b7f0e7d02a21b5 100644
--- a/llvm/test/CodeGen/Generic/opt-codegen-no-target-machine.ll
+++ b/llvm/test/CodeGen/Generic/opt-codegen-no-target-machine.ll
@@ -1,3 +1,3 @@
-; RUN: not --crash opt %s -dwarfehprepare -o - 2>&1 | FileCheck %s
+; RUN: not --crash opt %s -dwarf-eh-prepare -o - 2>&1 | FileCheck %s
 
 ; CHECK: Trying to construct TargetPassConfig without a target machine. Scheduling a CodeGen pass without a target triple set?

diff  --git a/llvm/test/CodeGen/Mips/compactbranches/beqc-bnec-register-constraint.ll b/llvm/test/CodeGen/Mips/compactbranches/beqc-bnec-register-constraint.ll
index 4c8674d46e2911..13e30676aa6fbc 100644
--- a/llvm/test/CodeGen/Mips/compactbranches/beqc-bnec-register-constraint.ll
+++ b/llvm/test/CodeGen/Mips/compactbranches/beqc-bnec-register-constraint.ll
@@ -1,5 +1,5 @@
-; RUN: llc -march=mips -mcpu=mips32r6 -O1 -start-after=dwarfehprepare < %s | FileCheck %s
-; RUN: llc -march=mips64 -mcpu=mips64r6 -O1 -start-after=dwarfehprepare < %s | FileCheck %s
+; RUN: llc -march=mips -mcpu=mips32r6 -O1 -start-after=dwarf-eh-prepare < %s | FileCheck %s
+; RUN: llc -march=mips64 -mcpu=mips64r6 -O1 -start-after=dwarf-eh-prepare < %s | FileCheck %s
 
 
 ; beqc/bnec have the constraint that $rs < $rt && $rs != 0 && $rt != 0

diff  --git a/llvm/test/CodeGen/X86/dwarf-eh-prepare-dbg.ll b/llvm/test/CodeGen/X86/dwarf-eh-prepare-dbg.ll
index 651e196a4ed76e..0345b736e9e60b 100644
--- a/llvm/test/CodeGen/X86/dwarf-eh-prepare-dbg.ll
+++ b/llvm/test/CodeGen/X86/dwarf-eh-prepare-dbg.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -S -mtriple=x86_64-linux-gnu -dwarfehprepare < %s | FileCheck %s
-; RUN: opt -S -mtriple=x86_64-linux-gnu -passes=dwarfehprepare < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-linux-gnu -dwarf-eh-prepare < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-linux-gnu -passes=dwarf-eh-prepare < %s | FileCheck %s
 
 ; PR57469: If _Unwind_Resume is defined in the same module and we have debug
 ; info, then the inserted _Unwind_Resume calls also need to have a dummy debug

diff  --git a/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll b/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll
index 6778601cfbf6d0..dd27e7fe141173 100644
--- a/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll
+++ b/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll
@@ -1,5 +1,5 @@
-; RUN: opt -mtriple=x86_64-linux-gnu -dwarfehprepare -simplifycfg-require-and-preserve-domtree=1 -run-twice < %s -S | FileCheck %s
-; RUN: opt -mtriple=x86_64-linux-gnu -passes=dwarfehprepare -codegen-opt-level=2 -simplifycfg-require-and-preserve-domtree=1 -run-twice < %s -S | FileCheck %s
+; RUN: opt -mtriple=x86_64-linux-gnu -dwarf-eh-prepare -simplifycfg-require-and-preserve-domtree=1 -run-twice < %s -S | FileCheck %s
+; RUN: opt -mtriple=x86_64-linux-gnu -passes=dwarf-eh-prepare -codegen-opt-level=2 -simplifycfg-require-and-preserve-domtree=1 -run-twice < %s -S | FileCheck %s
 
 ; Check basic functionality of IR-to-IR DWARF EH preparation. This should
 ; eliminate resumes. This pass requires a TargetMachine, so we put it under X86

diff  --git a/llvm/test/CodeGen/X86/dwarf_eh_resume.ll b/llvm/test/CodeGen/X86/dwarf_eh_resume.ll
index 90fad00b68bd81..d66d89d16a394c 100644
--- a/llvm/test/CodeGen/X86/dwarf_eh_resume.ll
+++ b/llvm/test/CodeGen/X86/dwarf_eh_resume.ll
@@ -1,5 +1,5 @@
-; RUN: opt -mtriple=x86_64-linux-gnu -dwarfehprepare -S %s | FileCheck %s
-; RUN: opt -mtriple=x86_64-linux-gnu -passes=dwarfehprepare -S %s | FileCheck %s
+; RUN: opt -mtriple=x86_64-linux-gnu -dwarf-eh-prepare -S %s | FileCheck %s
+; RUN: opt -mtriple=x86_64-linux-gnu -passes=dwarf-eh-prepare -S %s | FileCheck %s
 
 declare i32 @hoge(...)
 

diff  --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 5e5e5ce233f310..50b36dc7426777 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -339,7 +339,8 @@ static bool shouldPinPassToLegacyPM(StringRef Pass) {
       "nvptx-",  "mips-",  "lanai-", "hexagon-", "bpf-",    "avr-",
       "thumb2-", "arm-",   "si-",    "gcn-",     "amdgpu-", "aarch64-",
       "amdgcn-", "polly-", "riscv-", "dxil-"};
-  std::vector<StringRef> PassNameContain = {"ehprepare"};
+  // TODO: remove "ehprepare"
+  std::vector<StringRef> PassNameContain = {"-eh-prepare", "ehprepare"};
   std::vector<StringRef> PassNameExact = {
       "safe-stack",
       "cost-model",


        


More information about the llvm-commits mailing list