This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Fold vecreduce_or/and if operand is insert_subvector.
ClosedPublic

Authored by sdesmalen on Feb 3 2022, 9:09 AM.

Details

Summary

Fold:

vecreduce_or(insert_subvec(zeroinitializer, vec))
-> vecreduce_or(vec)

vecreduce_and(insert_subvec(allones, vec))
-> vecreduce_and(vec)

vecreduce_and/or(insert_subvec(undef, vec))
-> vecreduce_and/or(vec)

This is useful for SVE which uses insert/extract subvector
to convert fixed-width to/from scalable vectors.

Diff Detail

Event Timeline

sdesmalen created this revision.Feb 3 2022, 9:09 AM
sdesmalen requested review of this revision.Feb 3 2022, 9:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2022, 9:09 AM
bsmith accepted this revision.Feb 3 2022, 9:28 AM

LGTM with minor nits.

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
22522–22523

Nit: This comment doesn't mention the AND case.

llvm/test/CodeGen/AArch64/sve-vecreduce-fold.ll
51

Nit: Should be _ones?

This revision is now accepted and ready to land.Feb 3 2022, 9:28 AM
This revision was landed with ongoing or failed builds.Feb 5 2022, 6:36 AM
This revision was automatically updated to reflect the committed changes.
sdesmalen marked 2 inline comments as done.

LGTM with minor nits.

Thanks!