Skip to content

Commit f4f7c71

Browse files
authored
[RISCV][VLOPT] Move mayReadPastVL check into getMinimumVLForUser. NFC (#127972)
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 6361a8a commit f4f7c71

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
@@ -1272,6 +1272,11 @@ RISCVVLOptimizer::getMinimumVLForUser(const MachineOperand &UserOp) const {
12721272
return std::nullopt;
12731273
}
12741274

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

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

0 commit comments

Comments
 (0)