Skip to content

Commit 351223f

Browse files
committed
Simplify hasUndefinedMergeOp
1 parent f14c46d commit 351223f

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -182,32 +182,10 @@ static bool hasUndefinedMergeOp(const MachineInstr &MI,
182182
// lanes are undefined.
183183
return true;
184184

185-
// If the tied operand is NoReg, an IMPLICIT_DEF, or a REG_SEQEUENCE whose
186-
// operands are solely IMPLICIT_DEFS, then the pass through lanes are
187-
// undefined.
185+
// All undefined passthrus should be $noreg: see
186+
// RISCVDAGToDAGISel::doPeepholeNoRegPassThru
188187
const MachineOperand &UseMO = MI.getOperand(UseOpIdx);
189-
if (UseMO.getReg() == RISCV::NoRegister)
190-
return true;
191-
192-
if (UseMO.isUndef())
193-
return true;
194-
if (UseMO.getReg().isPhysical())
195-
return false;
196-
197-
if (MachineInstr *UseMI = MRI.getVRegDef(UseMO.getReg())) {
198-
if (UseMI->isImplicitDef())
199-
return true;
200-
201-
if (UseMI->isRegSequence()) {
202-
for (unsigned i = 1, e = UseMI->getNumOperands(); i < e; i += 2) {
203-
MachineInstr *SourceMI = MRI.getVRegDef(UseMI->getOperand(i).getReg());
204-
if (!SourceMI || !SourceMI->isImplicitDef())
205-
return false;
206-
}
207-
return true;
208-
}
209-
}
210-
return false;
188+
return UseMO.getReg() == RISCV::NoRegister || UseMO.isUndef();
211189
}
212190

213191
/// Which subfields of VL or VTYPE have values we need to preserve?

0 commit comments

Comments
 (0)