diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2024-05-19 10:25:01 +0100 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2024-05-19 10:25:01 +0100 |
| commit | 689bba1eec31fa236e2febaa4bcf46bc89ba432b (patch) | |
| tree | 520a754674e093428fa2869ddb72c4ca43eb88aa /llvm | |
| parent | 8b8a38a7b426fc724804602d7635134a0c63f08c (diff) | |
[DAG] canCreateUndefOrPoison - merge INSERT_VECTOR_ELT/EXTRACT_VECTOR_ELT cases. NFC.
The only difference is the operand index for the element index variable.
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 247f52370e4c..6a4ff741af10 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5241,17 +5241,12 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts, // Check if we demand any upper (undef) elements. return !PoisonOnly && DemandedElts.ugt(1); + case ISD::INSERT_VECTOR_ELT: case ISD::EXTRACT_VECTOR_ELT: { // Ensure that the element index is in bounds. EVT VecVT = Op.getOperand(0).getValueType(); - KnownBits KnownIdx = computeKnownBits(Op.getOperand(1), Depth + 1); - return KnownIdx.getMaxValue().uge(VecVT.getVectorMinNumElements()); - } - - case ISD::INSERT_VECTOR_ELT:{ - // Ensure that the element index is in bounds. - EVT VecVT = Op.getOperand(0).getValueType(); - KnownBits KnownIdx = computeKnownBits(Op.getOperand(2), Depth + 1); + SDValue Idx = Op.getOperand(Opcode == ISD::INSERT_VECTOR_ELT ? 2 : 1); + KnownBits KnownIdx = computeKnownBits(Idx, Depth + 1); return KnownIdx.getMaxValue().uge(VecVT.getVectorMinNumElements()); } |
