Skip to content

Commit 689bba1

Browse files
committed
[DAG] canCreateUndefOrPoison - merge INSERT_VECTOR_ELT/EXTRACT_VECTOR_ELT cases. NFC.
The only difference is the operand index for the element index variable.
1 parent 8b8a38a commit 689bba1

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,17 +5241,12 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
52415241
// Check if we demand any upper (undef) elements.
52425242
return !PoisonOnly && DemandedElts.ugt(1);
52435243

5244+
case ISD::INSERT_VECTOR_ELT:
52445245
case ISD::EXTRACT_VECTOR_ELT: {
52455246
// Ensure that the element index is in bounds.
52465247
EVT VecVT = Op.getOperand(0).getValueType();
5247-
KnownBits KnownIdx = computeKnownBits(Op.getOperand(1), Depth + 1);
5248-
return KnownIdx.getMaxValue().uge(VecVT.getVectorMinNumElements());
5249-
}
5250-
5251-
case ISD::INSERT_VECTOR_ELT:{
5252-
// Ensure that the element index is in bounds.
5253-
EVT VecVT = Op.getOperand(0).getValueType();
5254-
KnownBits KnownIdx = computeKnownBits(Op.getOperand(2), Depth + 1);
5248+
SDValue Idx = Op.getOperand(Opcode == ISD::INSERT_VECTOR_ELT ? 2 : 1);
5249+
KnownBits KnownIdx = computeKnownBits(Idx, Depth + 1);
52555250
return KnownIdx.getMaxValue().uge(VecVT.getVectorMinNumElements());
52565251
}
52575252

0 commit comments

Comments
 (0)