[llvm] [RISCV][EVL] Disable EVLIndVarSimplify Pass by default (PR #151483)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 02:58:49 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Shih-Po Hung (arcbbb)

<details>
<summary>Changes</summary>

With the VPlan-based canonical induction variable replacement landed in #<!-- -->147222, it appears to cover the functionality previously provided by the EVLIndVarSimplify pass introduced in #<!-- -->131005.

As a next step, this patch proposes disabling EVLIndVarSimplify by default to begin a gradual phase-out.
If the new transform proves to be stable and effective in practice, we can follow up with the removal of the associated metadata.


---
Full diff: https://github.com/llvm/llvm-project/pull/151483.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/RISCVTargetMachine.cpp (+6-1) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index da6ac2f6f31e9..9d648237743b4 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -114,6 +114,11 @@ static cl::opt<bool>
                            cl::desc("Enable Machine Pipeliner for RISC-V"),
                            cl::init(false), cl::Hidden);
 
+static cl::opt<bool> EnableEVLIndVarSimplify(
+    "riscv-simplify-evl-iv",
+    cl::desc("Enable the EVLIndVarSimplify pass."), cl::init(false),
+    cl::Hidden);
+
 extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
   RegisterTargetMachine<RISCVTargetMachine> X(getTheRISCV32Target());
   RegisterTargetMachine<RISCVTargetMachine> Y(getTheRISCV64Target());
@@ -645,7 +650,7 @@ void RISCVTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
 
   PB.registerVectorizerEndEPCallback(
       [](FunctionPassManager &FPM, OptimizationLevel Level) {
-        if (Level.isOptimizingForSpeed())
+        if (Level.isOptimizingForSpeed() && EnableEVLIndVarSimplify)
           FPM.addPass(createFunctionToLoopPassAdaptor(EVLIndVarSimplifyPass()));
       });
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/151483


More information about the llvm-commits mailing list