Skip to content

Commit 2a14cd1

Browse files
fixup! respond to review
1 parent faf1893 commit 2a14cd1

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4243,21 +4243,6 @@ bool RISCV::isVLKnownLE(const MachineOperand &LHS, const MachineOperand &RHS) {
42434243
return LHS.getImm() <= RHS.getImm();
42444244
}
42454245

4246-
/// Given two VL operands, do we know that LHS < RHS?
4247-
bool RISCV::isVLKnownLT(const MachineOperand &LHS, const MachineOperand &RHS) {
4248-
if (LHS.isReg() && RHS.isReg() && LHS.getReg().isVirtual() &&
4249-
LHS.getReg() == RHS.getReg())
4250-
return false;
4251-
if (RHS.isImm() && RHS.getImm() == RISCV::VLMaxSentinel && LHS.isImm() &&
4252-
LHS.getImm() != RHS.getImm())
4253-
return true;
4254-
if (LHS.isImm() && LHS.getImm() == RISCV::VLMaxSentinel)
4255-
return false;
4256-
if (!LHS.isImm() || !RHS.isImm())
4257-
return false;
4258-
return LHS.getImm() < RHS.getImm();
4259-
}
4260-
42614246
namespace {
42624247
class RISCVPipelinerLoopInfo : public TargetInstrInfo::PipelinerLoopInfo {
42634248
const MachineInstr *LHS;

llvm/lib/Target/RISCV/RISCVInstrInfo.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,6 @@ static constexpr int64_t VLMaxSentinel = -1LL;
356356
/// Given two VL operands, do we know that LHS <= RHS?
357357
bool isVLKnownLE(const MachineOperand &LHS, const MachineOperand &RHS);
358358

359-
/// Given two VL operands, do we know that LHS < RHS?
360-
bool isVLKnownLT(const MachineOperand &LHS, const MachineOperand &RHS);
361-
362359
// Mask assignments for floating-point
363360
static constexpr unsigned FPMASK_Negative_Infinity = 0x001;
364361
static constexpr unsigned FPMASK_Negative_Normal = 0x002;

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,8 +1311,15 @@ bool RISCVVLOptimizer::tryReduceVL(MachineInstr &MI) {
13111311
unsigned VLOpNum = RISCVII::getVLOpNum(MI.getDesc());
13121312
MachineOperand &VLOp = MI.getOperand(VLOpNum);
13131313

1314-
if (!RISCV::isVLKnownLT(*CommonVL, VLOp)) {
1315-
LLVM_DEBUG(dbgs() << " Abort due to CommonVL not < VLOp.\n");
1314+
if (!RISCV::isVLKnownLE(*CommonVL, VLOp)) {
1315+
LLVM_DEBUG(dbgs() << " Abort due to CommonVL not <= VLOp.\n");
1316+
continue;
1317+
}
1318+
1319+
if (CommonVL->isIdenticalTo(VLOp)) {
1320+
LLVM_DEBUG(
1321+
dbgs()
1322+
<< " Abort due to CommonVL == VLOp, no point in reducing.\n");
13161323
continue;
13171324
}
13181325

0 commit comments

Comments
 (0)