Skip to content

Commit

Permalink
[NFC][DAG] canCombineShuffleToAnyExtendVectorInreg(): check for leg…
Browse files Browse the repository at this point in the history
…al op before matching

Likewise as with legal types check, might as well not match if won't use.
  • Loading branch information
LebedevRI committed Dec 25, 2022
1 parent f487dfd commit 84ea726
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Expand Up @@ -22619,13 +22619,11 @@ static std::optional<EVT> canCombineShuffleToAnyExtendVectorInreg(
EVT OutSVT = EVT::getIntegerVT(*DAG.getContext(), EltSizeInBits * Scale);
EVT OutVT = EVT::getVectorVT(*DAG.getContext(), OutSVT, NumElts / Scale);

if (LegalTypes && !TLI.isTypeLegal(OutVT))
if ((LegalTypes && !TLI.isTypeLegal(OutVT)) ||
(LegalOperations && !TLI.isOperationLegalOrCustom(Opcode, OutVT)))
continue;

if (!isAnyExtend(Scale))
continue;

if (!LegalOperations || TLI.isOperationLegalOrCustom(Opcode, OutVT))
if (isAnyExtend(Scale))
return OutVT;
}

Expand Down

0 comments on commit 84ea726

Please sign in to comment.