[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 17:54:46 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:
The allocations probably aren't a massive deal, but another reason I'd rather we keep the subtarget bail logic in the run function is that it makes easier to see that we're bailing before calling `MFAM.getResult` etc.
For getCachedResult in RISCVInsertVSETVLI it doesn't make a difference but I'm noticing in e.g. RISCVVLOptimizer we're unnecessarily computing MachineDominatorTreeAnalysis because we bail inside the Impl wrapper. It would be good to establish a pattern here so we don't accidentally forget
https://github.com/llvm/llvm-project/pull/235407
More information about the llvm-branch-commits
mailing list