Skip to content

Commit 61ec738

Browse files
committed
DAG: Allow creating extract_vector_elt post-legalize
Fixes some combine issues for AMDGPU where we weren't getting the many extract_vector_elt combines expected in a future patch. This should really be checking isOperationLegalOrCustom on the extract. That improves a number of x86 lit tests, but a few get stuck in an infinite loop from one place where a similar looking extract is created. I have a different workaround in the backend for that which keeps many of those improvements, but also adds a few regressions. llvm-svn: 312730
1 parent 5f5b586 commit 61ec738

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13963,7 +13963,10 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
1396313963
// FIXME: We should handle recursing on other vector shuffles and
1396413964
// scalar_to_vector here as well.
1396513965

13966-
if (!LegalOperations) {
13966+
if (!LegalOperations ||
13967+
// FIXME: Should really be just isOperationLegalOrCustom.
13968+
TLI.isOperationLegal(ISD::EXTRACT_VECTOR_ELT, VT) ||
13969+
TLI.isOperationExpand(ISD::VECTOR_SHUFFLE, VT)) {
1396713970
EVT IndexTy = TLI.getVectorIdxTy(DAG.getDataLayout());
1396813971
return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, SDLoc(N), NVT, SVInVec,
1396913972
DAG.getConstant(OrigElt, SDLoc(SVOp), IndexTy));

0 commit comments

Comments
 (0)