Skip to content

Commit 715e116

Browse files
fixup! update comment and debug for clarity
1 parent 55a46c2 commit 715e116

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,8 @@ bool RISCVVLOptimizer::isCandidate(const MachineInstr &MI) const {
680680
}
681681
}
682682

683-
// If the VL is 1, then there is no need to reduce it.
683+
// If the VL is 1, then there is no need to reduce it. This is an
684+
// optimization, not needed to preserve correctness.
684685
if (VLOp.isImm() && VLOp.getImm() == 1) {
685686
LLVM_DEBUG(dbgs() << " Not a candidate because VL is already 1\n");
686687
return false;
@@ -762,6 +763,8 @@ bool RISCVVLOptimizer::checkUsers(const MachineOperand *&CommonVL,
762763
CommonVL = &VLOp;
763764
LLVM_DEBUG(dbgs() << " User VL is: " << VLOp << "\n");
764765
} else if (!CommonVL->isIdenticalTo(VLOp)) {
766+
// FIXME: This check requires all users to have the same VL. We can relax
767+
// this and get the largest VL amongst all users.
765768
LLVM_DEBUG(dbgs() << " Abort because users have different VL\n");
766769
CanReduceVL = false;
767770
break;
@@ -813,7 +816,7 @@ bool RISCVVLOptimizer::tryReduceVL(MachineInstr &OrigMI) {
813816
MachineOperand &VLOp = MI.getOperand(VLOpNum);
814817

815818
if (!RISCV::isVLKnownLE(*CommonVL, VLOp)) {
816-
LLVM_DEBUG(dbgs() << " Abort due to no benefit.\n");
819+
LLVM_DEBUG(dbgs() << " Abort due to no CommonVL not <= VLOp.\n");
817820
continue;
818821
}
819822

0 commit comments

Comments
 (0)