Skip to content

Commit 2590e74

Browse files
committed
Don't copy over TSFlags
1 parent 7321018 commit 2590e74

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,6 @@ class RISCVVPseudo<dag outs, dag ins, list<dag> pattern, string opcodestr = "",
550550
// SEW = 0 is used to denote that the Pseudo is not SEW specific (or unknown).
551551
bits<8> SEW = 0;
552552
bit IncludeInInversePseudoTable = 1;
553-
554-
// Set common TSFlags in RVInst from the base instruction.
555-
let ElementsDependOn = !cast<RVInst>(BaseInstr).ElementsDependOn;
556-
let DestEEW = !cast<RVInst>(BaseInstr).DestEEW;
557553
}
558554

559555
// The actual table.

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace {
3333
class RISCVVLOptimizer : public MachineFunctionPass {
3434
const MachineRegisterInfo *MRI;
3535
const MachineDominatorTree *MDT;
36+
const TargetInstrInfo *TII;
3637

3738
public:
3839
static char ID;
@@ -1291,7 +1292,8 @@ bool RISCVVLOptimizer::isCandidate(const MachineInstr &MI) const {
12911292
return false;
12921293
}
12931294

1294-
assert(!RISCVII::elementsDependOnVL(MI.getDesc().TSFlags) &&
1295+
assert(!RISCVII::elementsDependOnVL(
1296+
TII->get(RISCV::getRVVMCOpcode(MI.getOpcode())).TSFlags) &&
12951297
"Instruction shouldn't be supported if elements depend on VL");
12961298

12971299
assert(MI.getOperand(0).isReg() &&
@@ -1495,6 +1497,8 @@ bool RISCVVLOptimizer::runOnMachineFunction(MachineFunction &MF) {
14951497
if (!ST.hasVInstructions())
14961498
return false;
14971499

1500+
TII = ST.getInstrInfo();
1501+
14981502
// For each instruction that defines a vector, compute what VL its
14991503
// downstream users demand.
15001504
for (MachineBasicBlock *MBB : post_order(&MF)) {

llvm/lib/Target/RISCV/RISCVVectorPeephole.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ bool RISCVVectorPeephole::hasSameEEW(const MachineInstr &User,
9191
User.getOperand(RISCVII::getSEWOpNum(User.getDesc())).getImm();
9292
unsigned SrcLog2SEW =
9393
Src.getOperand(RISCVII::getSEWOpNum(Src.getDesc())).getImm();
94-
unsigned SrcLog2EEW = RISCV::getDestLog2EEW(Src.getDesc(), SrcLog2SEW);
94+
unsigned SrcLog2EEW = RISCV::getDestLog2EEW(
95+
TII->get(RISCV::getRVVMCOpcode(Src.getOpcode())), SrcLog2SEW);
9596
return SrcLog2EEW == UserLog2SEW;
9697
}
9798

@@ -169,8 +170,8 @@ bool RISCVVectorPeephole::tryToReduceVL(MachineInstr &MI) const {
169170
if (!hasSameEEW(MI, *Src))
170171
continue;
171172

172-
bool ElementsDependOnVL =
173-
RISCVII::elementsDependOnVL(Src->getDesc().TSFlags);
173+
bool ElementsDependOnVL = RISCVII::elementsDependOnVL(
174+
TII->get(RISCV::getRVVMCOpcode(Src->getOpcode())).TSFlags);
174175
if (ElementsDependOnVL || Src->mayRaiseFPException())
175176
continue;
176177

@@ -759,11 +760,11 @@ bool RISCVVectorPeephole::foldVMergeToMask(MachineInstr &MI) const {
759760
else
760761
return false;
761762

762-
if (RISCVII::elementsDependOnVL(True.getDesc().TSFlags) &&
763-
!TrueVL.isIdenticalTo(MinVL))
763+
unsigned RVVTSFlags =
764+
TII->get(RISCV::getRVVMCOpcode(True.getOpcode())).TSFlags;
765+
if (RISCVII::elementsDependOnVL(RVVTSFlags) && !TrueVL.isIdenticalTo(MinVL))
764766
return false;
765-
if (RISCVII::elementsDependOnMask(True.getDesc().TSFlags) &&
766-
!isAllOnesMask(Mask))
767+
if (RISCVII::elementsDependOnMask(RVVTSFlags) && !isAllOnesMask(Mask))
767768
return false;
768769

769770
// Use a tumu policy, relaxing it to tail agnostic provided that the passthru

0 commit comments

Comments
 (0)