Skip to content

[RISCV] Defer creating RISCVInsertVSETVLI to avoid leak with -stop-after #92303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/lib/Target/RISCV/RISCV.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void initializeRISCVExpandAtomicPseudoPass(PassRegistry &);

FunctionPass *createRISCVInsertVSETVLIPass();
void initializeRISCVInsertVSETVLIPass(PassRegistry &);
extern char &RISCVInsertVSETVLIID;

FunctionPass *createRISCVCoalesceVSETVLIPass();
void initializeRISCVCoalesceVSETVLIPass(PassRegistry &);
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ class RISCVCoalesceVSETVLI : public MachineFunctionPass {
} // end anonymous namespace

char RISCVInsertVSETVLI::ID = 0;
char &llvm::RISCVInsertVSETVLIID = RISCVInsertVSETVLI::ID;

INITIALIZE_PASS(RISCVInsertVSETVLI, DEBUG_TYPE, RISCV_INSERT_VSETVLI_NAME,
false, false)
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ void RISCVPassConfig::addPreRegAlloc() {
// Run RISCVInsertVSETVLI after PHI elimination. On O1 and above do it after
// register coalescing so needVSETVLIPHI doesn't need to look through COPYs.
if (TM->getOptLevel() == CodeGenOptLevel::None)
insertPass(&PHIEliminationID, createRISCVInsertVSETVLIPass());
insertPass(&PHIEliminationID, &RISCVInsertVSETVLIID);
else
insertPass(&RegisterCoalescerID, createRISCVInsertVSETVLIPass());
insertPass(&RegisterCoalescerID, &RISCVInsertVSETVLIID);
}

void RISCVPassConfig::addFastRegAlloc() {
Expand Down
Loading