Skip to content

Commit 0cbccb1

Browse files
authored
[RISCV] Remove support for pre-RA vsetvli insertion (#110796)
Now that LLVM 19.1.0 has been out for a while with post-vector-RA vsetvli insertion enabled by default, this proposes to remove the flag that restores the old pre-RA behaviour so we only have one configuration going forward. That flag was mainly meant as a fallback in case users ran into issues, but I haven't seen anything reported so far.
1 parent 1df5c94 commit 0cbccb1

File tree

3 files changed

+133
-366
lines changed

3 files changed

+133
-366
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,10 @@ bool RISCVInstrInfo::isReallyTriviallyReMaterializable(
179179
case RISCV::VMV_S_X:
180180
case RISCV::VFMV_S_F:
181181
case RISCV::VID_V:
182-
if (MI.getOperand(1).isUndef() &&
183-
/* After RISCVInsertVSETVLI most pseudos will have implicit uses on vl
184-
and vtype. Make sure we only rematerialize before RISCVInsertVSETVLI
185-
i.e. -riscv-vsetvl-after-rvv-regalloc=true */
186-
!MI.hasRegisterImplicitUseOperand(RISCV::VTYPE))
187-
return true;
188-
break;
182+
return MI.getOperand(1).isUndef();
189183
default:
190-
break;
184+
return TargetInstrInfo::isReallyTriviallyReMaterializable(MI);
191185
}
192-
return TargetInstrInfo::isReallyTriviallyReMaterializable(MI);
193186
}
194187

195188
static bool forwardCopyWillClobberTuple(unsigned DstReg, unsigned SrcReg,

llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ static cl::opt<bool> EnableMISchedLoadStoreClustering(
9999
cl::desc("Enable load and store clustering in the machine scheduler"),
100100
cl::init(true));
101101

102-
static cl::opt<bool> EnableVSETVLIAfterRVVRegAlloc(
103-
"riscv-vsetvl-after-rvv-regalloc", cl::Hidden,
104-
cl::desc("Insert vsetvls after vector register allocation"),
105-
cl::init(true));
106-
107102
static cl::opt<bool>
108103
EnableVLOptimizer("riscv-enable-vl-optimizer",
109104
cl::desc("Enable the RISC-V VL Optimizer pass"),
@@ -413,8 +408,7 @@ FunctionPass *RISCVPassConfig::createRVVRegAllocPass(bool Optimized) {
413408

414409
bool RISCVPassConfig::addRegAssignAndRewriteFast() {
415410
addPass(createRVVRegAllocPass(false));
416-
if (EnableVSETVLIAfterRVVRegAlloc)
417-
addPass(createRISCVInsertVSETVLIPass());
411+
addPass(createRISCVInsertVSETVLIPass());
418412
if (TM->getOptLevel() != CodeGenOptLevel::None &&
419413
EnableRISCVDeadRegisterElimination)
420414
addPass(createRISCVDeadRegisterDefinitionsPass());
@@ -424,8 +418,7 @@ bool RISCVPassConfig::addRegAssignAndRewriteFast() {
424418
bool RISCVPassConfig::addRegAssignAndRewriteOptimized() {
425419
addPass(createRVVRegAllocPass(true));
426420
addPass(createVirtRegRewriter(false));
427-
if (EnableVSETVLIAfterRVVRegAlloc)
428-
addPass(createRISCVInsertVSETVLIPass());
421+
addPass(createRISCVInsertVSETVLIPass());
429422
if (TM->getOptLevel() != CodeGenOptLevel::None &&
430423
EnableRISCVDeadRegisterElimination)
431424
addPass(createRISCVDeadRegisterDefinitionsPass());
@@ -575,15 +568,6 @@ void RISCVPassConfig::addPreRegAlloc() {
575568
addPass(createRISCVInsertReadWriteCSRPass());
576569
addPass(createRISCVInsertWriteVXRMPass());
577570
addPass(createRISCVLandingPadSetupPass());
578-
579-
// Run RISCVInsertVSETVLI after PHI elimination. On O1 and above do it after
580-
// register coalescing so needVSETVLIPHI doesn't need to look through COPYs.
581-
if (!EnableVSETVLIAfterRVVRegAlloc) {
582-
if (TM->getOptLevel() == CodeGenOptLevel::None)
583-
insertPass(&PHIEliminationID, &RISCVInsertVSETVLIID);
584-
else
585-
insertPass(&RegisterCoalescerID, &RISCVInsertVSETVLIID);
586-
}
587571
}
588572

589573
void RISCVPassConfig::addFastRegAlloc() {

0 commit comments

Comments
 (0)