Skip to content

Commit a969239

Browse files
authored
[RISCV] Move volatile check to isCandidate in VL optimizer. NFC (#154685)
This keeps it closer to the other legality checks like the FP exceptions check. It also means that isSupportedInstr only needs to check the opcode, which allows it to be replaced with a TSFlags based check in a later patch.
1 parent 5c411b3 commit a969239

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,7 @@ static bool isSupportedInstr(const MachineInstr &MI) {
847847
case RISCV::VLUXEI32_V:
848848
case RISCV::VLOXEI32_V:
849849
case RISCV::VLUXEI64_V:
850-
case RISCV::VLOXEI64_V: {
851-
for (const MachineMemOperand *MMO : MI.memoperands())
852-
if (MMO->isVolatile())
853-
return false;
854-
return true;
855-
}
856-
850+
case RISCV::VLOXEI64_V:
857851
// Vector Single-Width Integer Add and Subtract
858852
case RISCV::VADD_VI:
859853
case RISCV::VADD_VV:
@@ -1292,6 +1286,13 @@ bool RISCVVLOptimizer::isCandidate(const MachineInstr &MI) const {
12921286
return false;
12931287
}
12941288

1289+
for (const MachineMemOperand *MMO : MI.memoperands()) {
1290+
if (MMO->isVolatile()) {
1291+
LLVM_DEBUG(dbgs() << "Not a candidate because contains volatile MMO\n");
1292+
return false;
1293+
}
1294+
}
1295+
12951296
// Some instructions that produce vectors have semantics that make it more
12961297
// difficult to determine whether the VL can be reduced. For example, some
12971298
// instructions, such as reductions, may write lanes past VL to a scalar

0 commit comments

Comments
 (0)