Skip to content

Commit

Permalink
Re-apply the fix on DwarfEHPrepare and add a test (#2)
Browse files Browse the repository at this point in the history
* 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 <yaron.keren@gmail.com>

https://reviews.llvm.org/D110979
(cherry picked from commit 8f6e49e8a3c0f31a55c342a2a41dda630508c5eb)
  • Loading branch information
tkf authored and efocht committed May 13, 2022
1 parent 1cf8d83 commit 21cfa6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/CodeGen/DwarfEHPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ class DwarfEHPrepareLegacyPass : public FunctionPass {
return prepareDwarfEH(OptLevel, F, TLI, DT, TTI, TM.getTargetTriple());
}

bool doFinalization(Module &M) override {
RewindFunction = nullptr;
return false;
}

void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetPassConfig>();
AU.addRequired<TargetTransformInfoWrapperPass>();
Expand Down

0 comments on commit 21cfa6a

Please sign in to comment.