diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp index 5ca1e91cc5f412..fde7b942665d4a 100644 --- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp +++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp @@ -318,6 +318,11 @@ class DwarfEHPrepareLegacyPass : public FunctionPass { return prepareDwarfEH(OptLevel, RewindFunction, F, TLI, DT, TTI); } + bool doFinalization(Module &M) override { + RewindFunction = nullptr; + return false; + } + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequired(); AU.addRequired(); diff --git a/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll b/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll index 921f4f9a7d85f9..c54fdfceea4b2f 100644 --- a/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll +++ b/llvm/test/CodeGen/X86/dwarf-eh-prepare.ll @@ -1,4 +1,4 @@ -; RUN: opt -mtriple=x86_64-linux-gnu -dwarfehprepare -simplifycfg-require-and-preserve-domtree=1 < %s -S | FileCheck %s +; RUN: opt -mtriple=x86_64-linux-gnu -dwarfehprepare -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