[llvm] [RISCV][EVL] Disable EVLIndVarSimplify Pass by default (PR #151483)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 23:49:10 PDT 2025
https://github.com/arcbbb updated https://github.com/llvm/llvm-project/pull/151483
>From d4068e4bff509205792e9abc563f8586053efbfa Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Thu, 31 Jul 2025 02:45:56 -0700
Subject: [PATCH 1/2] [RISCV][EVL] Disable the EVLIndVarSimplify Pass by
default
---
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index da6ac2f6f31e9..26401aed139f0 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()));
});
}
>From 2af78a86638d4d358d2da2c9cb2526669370fa03 Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Thu, 31 Jul 2025 23:48:22 -0700
Subject: [PATCH 2/2] Address comments
---
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 26401aed139f0..3f2a83f8ce98c 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -114,11 +114,6 @@ 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());
@@ -647,12 +642,6 @@ void RISCVTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
OptimizationLevel Level) {
LPM.addPass(LoopIdiomVectorizePass(LoopIdiomVectorizeStyle::Predicated));
});
-
- PB.registerVectorizerEndEPCallback(
- [](FunctionPassManager &FPM, OptimizationLevel Level) {
- if (Level.isOptimizingForSpeed() && EnableEVLIndVarSimplify)
- FPM.addPass(createFunctionToLoopPassAdaptor(EVLIndVarSimplifyPass()));
- });
}
yaml::MachineFunctionInfo *
More information about the llvm-commits
mailing list