This is an archive of the discontinued LLVM Phabricator instance.

DAG: Allow creating extract_vector_elt post-legalize
ClosedPublic

Authored by arsenm on Aug 15 2017, 4:41 PM.

Details

Summary

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.

Diff Detail

Event Timeline

arsenm created this revision.Aug 15 2017, 4:41 PM
RKSimon added inline comments.Aug 16 2017, 2:52 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
13886

I wonder if it'd be safe to test for TLI.isOperationLegalOrCustom(ISD::EXTRACT_VECTOR_ELT, VT) if the extract is from the same vector type and the same index (constant or variable) as the original? Would that cover the cases you have?

arsenm added inline comments.Aug 24 2017, 9:11 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
13886

It would cover my cases, but I still see the x86 infinite loop problems.

The specific x86 issue is X86ISelLowering.cpp:14284 where it recreates another extract

RKSimon accepted this revision.Sep 4 2017, 10:03 AM

LGTM (sorry was on holiday). I'll try to investigate the x86 infinite loop issue at some point soon.

This revision is now accepted and ready to land.Sep 4 2017, 10:03 AM
arsenm closed this revision.Sep 7 2017, 10:26 AM

r312730