Skip to content

Commit

Permalink
[DAGCombine] Check zext legality in zext-extract-extend combine
Browse files Browse the repository at this point in the history
Discussed in D131503.

Fix to D130782.
  • Loading branch information
peterwaller-arm committed Aug 11, 2022
1 parent 94fae7a commit 8986998
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 8986998

Please sign in to comment.