[llvm] 48c20e7 - [RISCV][VLOPT] Do not optimize VL when isVectorOpUsedAsScalarOp (#120291)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 13:10:06 PST 2024
Author: Michael Maitland
Date: 2024-12-17T16:10:02-05:00
New Revision: 48c20e7106bb15398b55a13d0a2ec74cb51d055e
URL: https://github.com/llvm/llvm-project/commit/48c20e7106bb15398b55a13d0a2ec74cb51d055e
DIFF: https://github.com/llvm/llvm-project/commit/48c20e7106bb15398b55a13d0a2ec74cb51d055e.diff
LOG: [RISCV][VLOPT] Do not optimize VL when isVectorOpUsedAsScalarOp (#120291)
This does not have tests, so we will remove this for now and add it back
later with tests.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
index bd48d730a5704b..a9e5bb6ecd9b8a 100644
--- a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
@@ -887,13 +887,10 @@ bool RISCVVLOptimizer::checkUsers(const MachineOperand *&CommonVL,
// Instructions like reductions may use a vector register as a scalar
// register. In this case, we should treat it like a scalar register which
// does not impact the decision on whether to optimize VL.
+ // TODO: Treat it like a scalar register instead of bailing out.
if (isVectorOpUsedAsScalarOp(UserOp)) {
- [[maybe_unused]] Register R = UserOp.getReg();
- [[maybe_unused]] const TargetRegisterClass *RC = MRI->getRegClass(R);
- assert(RISCV::VRRegClass.hasSubClassEq(RC) &&
- "Expect LMUL 1 register class for vector as scalar operands!");
- LLVM_DEBUG(dbgs() << " Use this operand as a scalar operand\n");
- continue;
+ CanReduceVL = false;
+ break;
}
if (mayReadPastVL(UserMI)) {
More information about the llvm-commits
mailing list