[llvm-branch-commits] [RISCV] Port RISCVInsertVSETVLI to NewPM (PR #235407)
Luke Lau via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Oct 25 05:52:13 PDT 2026
================
@@ -1219,6 +1228,29 @@ bool RISCVInsertVSETVLI::runOnMachineFunction(MachineFunction &MF) {
}
/// Returns an instance of the Insert VSETVLI pass.
-FunctionPass *llvm::createRISCVInsertVSETVLIPass() {
- return new RISCVInsertVSETVLI();
+FunctionPass *llvm::createRISCVInsertVSETVLILegacyPass() {
+ return new RISCVInsertVSETVLILegacy();
+}
+
+bool RISCVInsertVSETVLILegacy::runOnMachineFunction(MachineFunction &MF) {
+ RISCVInsertVSETVLIImpl Impl;
+ auto *LISWrapper = getAnalysisIfAvailable<LiveIntervalsWrapperPass>();
+ LiveIntervals *LIS = LISWrapper ? &LISWrapper->getLIS() : nullptr;
+ return Impl.runOnMachineFunction(MF, LIS);
+}
+
+PreservedAnalyses
+RISCVInsertVSETVLIPass::run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM) {
+ RISCVInsertVSETVLIImpl Impl;
----------------
lukel97 wrote:
Minor but can we pull the no-V extension bail out into `RISCVInsertVSETVLILegacy::runOnMachineFunction` and `RISCVInsertVSETVLIPass::run` so we don't pay the price of allocating the data structures on scalar configurations? Basically copying this bit of code into both run methods:
```c++
// Skip if the vector extension is not enabled.
if (!MF.getSubtarget<RISCVSubtarget>().hasVInstructions())
return false;
```
https://github.com/llvm/llvm-project/pull/235407
More information about the llvm-branch-commits
mailing list