Skip to content

Commit ddb04d7

Browse files
peterwaller-armtru
authored andcommitted
[DAGCombine] Check zext legality in zext-extract-extend combine
Discussed in D131503. Fix to D130782. (cherry picked from commit 8986998)
1 parent 7af201c commit ddb04d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6360,7 +6360,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
63606360
SDValue Extendee = Ext->getOperand(0);
63616361

63626362
unsigned ScalarWidth = Extendee.getValueType().getScalarSizeInBits();
6363-
if (N1C->getAPIntValue().isMask(ScalarWidth)) {
6363+
if (N1C->getAPIntValue().isMask(ScalarWidth) &&
6364+
(!LegalOperations || TLI.isOperationLegal(ISD::ZERO_EXTEND, ExtVT))) {
63646365
// (and (extract_subvector (zext|anyext|sext v) _) iN_mask)
63656366
// => (extract_subvector (iN_zeroext v))
63666367
SDValue ZeroExtExtendee =

0 commit comments

Comments
 (0)