Skip to content

Commit f611158

Browse files
committed
[SelectionDAG] Better ISD::ANY_EXTEND/ISD::ANY_EXTEND_VECTOR_INREG ComputeKnownBits support
Add DemandedElts handling to ISD::ANY_EXTEND and add missing ISD::ANY_EXTEND_VECTOR_INREG handling. Despite the lack of test changes this code IS being used - its just that the ANY_EXTEND ops are legalized later on (typically to ZERO_EXTEND equivalents) so we typically manage to combine later on.
1 parent 25afe91 commit f611158

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3099,8 +3099,15 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
30993099
Known = Known.sext(BitWidth);
31003100
break;
31013101
}
3102+
case ISD::ANY_EXTEND_VECTOR_INREG: {
3103+
EVT InVT = Op.getOperand(0).getValueType();
3104+
APInt InDemandedElts = DemandedElts.zextOrSelf(InVT.getVectorNumElements());
3105+
Known = computeKnownBits(Op.getOperand(0), InDemandedElts, Depth + 1);
3106+
Known = Known.zext(BitWidth, false /* ExtendedBitsAreKnownZero */);
3107+
break;
3108+
}
31023109
case ISD::ANY_EXTEND: {
3103-
Known = computeKnownBits(Op.getOperand(0), Depth+1);
3110+
Known = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
31043111
Known = Known.zext(BitWidth, false /* ExtendedBitsAreKnownZero */);
31053112
break;
31063113
}

0 commit comments

Comments
 (0)