This is an archive of the discontinued LLVM Phabricator instance.

[DAG] Optimize away degenerate INSERT_VECTOR_ELT nodes.
ClosedPublic

Authored by niravd on Jul 18 2017, 8:04 AM.

Details

Summary

Add missing vector write of vector read reduction, i.e.:

(insert_vector_elt x (extract_vector_elt x idx) idx) to x

Event Timeline

niravd created this revision.Jul 18 2017, 8:04 AM
RKSimon edited edge metadata.Jul 18 2017, 9:28 AM

I've updated the shifts tests to include the constant broadcast comments - please can you rebase?

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
13500

Hmm, is this worth putting before the if (!isa<ConstantSDNode>(EltNo)) early out to support non-constant extract+insert?

niravd updated this revision to Diff 107139.Jul 18 2017, 10:49 AM

Move optimization to allow it to apply to non-constant indices

niravd marked an inline comment as done.Jul 18 2017, 10:52 AM

I've updated the shifts tests to include the constant broadcast comments - please can you rebase?

Rebased. update_llc_test_checks didn't add any comments.

RKSimon accepted this revision.Jul 20 2017, 4:02 AM

LGTM with one minor

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
13474

Use InVal.getOperand(0) and InVal.getOperand(1) directly?

This revision is now accepted and ready to land.Jul 20 2017, 4:02 AM
This revision was automatically updated to reflect the committed changes.