Skip to content

Commit 442071d

Browse files
committed
[RISCV][VLOPT] Move mayReadPastVL check into getMinimumVLForUser. NFC
checkUsers currently does two things, a) work out the minimum VL read by every user and b) check that the operand info of the MI and users match. getMinimumVLForUser handles most of a), with the exception of the check for instructions that read past VL e.g. vrgather which is still in checkUsers. This moves it into getMinimumVLForUser to keep all that logic in one place and simplifies an upcoming patch.
1 parent df96b56 commit 442071d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,11 @@ RISCVVLOptimizer::getMinimumVLForUser(MachineOperand &UserOp) {
12711271
return std::nullopt;
12721272
}
12731273

1274+
if (mayReadPastVL(UserMI)) {
1275+
LLVM_DEBUG(dbgs() << " Abort because used by unsafe instruction\n");
1276+
return std::nullopt;
1277+
}
1278+
12741279
unsigned VLOpNum = RISCVII::getVLOpNum(Desc);
12751280
const MachineOperand &VLOp = UserMI.getOperand(VLOpNum);
12761281
// Looking for an immediate or a register VL that isn't X0.
@@ -1333,11 +1338,6 @@ std::optional<MachineOperand> RISCVVLOptimizer::checkUsers(MachineInstr &MI) {
13331338
continue;
13341339
}
13351340

1336-
if (mayReadPastVL(UserMI)) {
1337-
LLVM_DEBUG(dbgs() << " Abort because used by unsafe instruction\n");
1338-
return std::nullopt;
1339-
}
1340-
13411341
auto VLOp = getMinimumVLForUser(UserOp);
13421342
if (!VLOp)
13431343
return std::nullopt;

0 commit comments

Comments
 (0)