[DAGCombine] Check zext legality in zext-extract-extend combine

Discussed in D131503.

Fix to D130782.
This commit is contained in:
Peter Waller 2022-08-09 15:13:50 +00:00
parent 94fae7a581
commit 898699831b
1 changed files with 2 additions and 1 deletions

View File

@ -6378,7 +6378,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
SDValue Extendee = Ext->getOperand(0);
unsigned ScalarWidth = Extendee.getValueType().getScalarSizeInBits();
if (N1C->getAPIntValue().isMask(ScalarWidth)) {
if (N1C->getAPIntValue().isMask(ScalarWidth) &&
(!LegalOperations || TLI.isOperationLegal(ISD::ZERO_EXTEND, ExtVT))) {
// (and (extract_subvector (zext|anyext|sext v) _) iN_mask)
// => (extract_subvector (iN_zeroext v))
SDValue ZeroExtExtendee =