Skip to content

Commit 48c20e7

Browse files
[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.
1 parent bbeafe4 commit 48c20e7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,13 +887,10 @@ bool RISCVVLOptimizer::checkUsers(const MachineOperand *&CommonVL,
887887
// Instructions like reductions may use a vector register as a scalar
888888
// register. In this case, we should treat it like a scalar register which
889889
// does not impact the decision on whether to optimize VL.
890+
// TODO: Treat it like a scalar register instead of bailing out.
890891
if (isVectorOpUsedAsScalarOp(UserOp)) {
891-
[[maybe_unused]] Register R = UserOp.getReg();
892-
[[maybe_unused]] const TargetRegisterClass *RC = MRI->getRegClass(R);
893-
assert(RISCV::VRRegClass.hasSubClassEq(RC) &&
894-
"Expect LMUL 1 register class for vector as scalar operands!");
895-
LLVM_DEBUG(dbgs() << " Use this operand as a scalar operand\n");
896-
continue;
892+
CanReduceVL = false;
893+
break;
897894
}
898895

899896
if (mayReadPastVL(UserMI)) {

0 commit comments

Comments
 (0)