Skip to content

Commit 21cfa6a

Browse files
tkfefocht
authored andcommitted
Re-apply the fix on DwarfEHPrepare and add a test (#2)
* Ad -run-twice to dwarf-eh-prepare.ll * In DwarfEHPrepare, after all passes are run, RewindFunction may be a dangling pointer to a dead function. To make sure it's valid, doFinalization nullptrs RewindFunction just like the constructor and so it will be found on next run. llvm-svn: 217737 Co-authored-by: Yaron Keren <[email protected]> https://reviews.llvm.org/D110979 (cherry picked from commit 8f6e49e8a3c0f31a55c342a2a41dda630508c5eb)
1 parent 1cf8d83 commit 21cfa6a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/CodeGen/DwarfEHPrepare.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ class DwarfEHPrepareLegacyPass : public FunctionPass {
340340
return prepareDwarfEH(OptLevel, F, TLI, DT, TTI, TM.getTargetTriple());
341341
}
342342

343+
bool doFinalization(Module &M) override {
344+
RewindFunction = nullptr;
345+
return false;
346+
}
347+
343348
void getAnalysisUsage(AnalysisUsage &AU) const override {
344349
AU.addRequired<TargetPassConfig>();
345350
AU.addRequired<TargetTransformInfoWrapperPass>();

0 commit comments

Comments
 (0)