This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Teach getNode to simplify a couple easy cases of EXTRACT_SUBVECTOR
ClosedPublic

Authored by craig.topper on Jan 22 2017, 7:26 PM.

Details

Summary

This teaches getNode to simplify extracting from Undef. This is similar to what is done for EXTRACT_VECTOR_ELT. It also adds support for extracting from CONCAT_VECTOR when we can reused one of the inputs to the concat. These seem like simple non-target specific optimizations.

For X86 we currently handle undef in extractSubvector, but not all EXTRACT_SUBVECTOR creations go through there.

Ultimately, my motivation here is to simplify extractSubvector and remove custom lowering for EXTRACT_SUBVECTOR since we don't do anything but handle undef and BUILD_VECTOR optimizations, but those should be DAG combines.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Jan 22 2017, 7:26 PM
RKSimon accepted this revision.Jan 23 2017, 8:34 AM

LGTM

lib/CodeGen/SelectionDAG/SelectionDAG.cpp
4094 ↗(On Diff #85310)

Not sure if this will ever be needed? A concat of 0 vectors should have asserted at creation surely?

This revision is now accepted and ready to land.Jan 23 2017, 8:34 AM
This revision was automatically updated to reflect the committed changes.