[llvm-branch-commits] [RISCV] Port RISCVInsertVSETVLI to NewPM (PR #235407)
Aiden Grossman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Oct 25 22:46:55 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;
----------------
boomanaiden154 wrote:
For actually requesting analyses, it's canonical for NewPM ports to put getting it into a lambda. Then the implementation can just query it after any checks which avoids duplicating the checks.
There are one or two cases where I haven't done this, but it's generally been something like a call to `getAnalysisIfAvailable` to preserve said analysis rather than an actual forced computation.
https://github.com/llvm/llvm-project/pull/235407
More information about the llvm-branch-commits
mailing list