This is an archive of the discontinued LLVM Phabricator instance.

[VectorCombine] transform bitcasted shuffle to wider elements
ClosedPublic

Authored by spatel on Apr 17 2020, 7:43 AM.

Details

Summary

bitcast (shuf V, MaskC) --> shuf (bitcast V), MaskC'

This is the widen shuffle elements enhancement to D76727. It builds on the analysis and simplifications in D77881 and rG6a7e958a423e.

The phase ordering tests show that we can simplify inverse shuffles across a binop in both directions (widen/narrow or narrow/widen) now.

There's another potential transform visible in some of the remaining TODOs - move a bitcasted operand of a shuffle after the shuffle.

Diff Detail

Event Timeline

spatel created this revision.Apr 17 2020, 7:43 AM
spatel updated this revision to Diff 258326.Apr 17 2020, 7:45 AM

Patch updated:
Forgot to update the uses of "getNumElements()".

RKSimon added inline comments.Apr 17 2020, 10:24 AM
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
309

Move the assert just below the ScaleFactor?

lebedev.ri accepted this revision.Apr 18 2020, 10:02 AM

This looks pretty straight-forward, so LG with that nit.

This revision is now accepted and ready to land.Apr 18 2020, 10:02 AM
spatel updated this revision to Diff 258529.Apr 18 2020, 10:06 AM
spatel marked an inline comment as done.

Patch updated:
Make the narrow/widen paths symmetric and sink the common code.

RKSimon accepted this revision.Apr 18 2020, 10:39 AM

LGTM as well cheer

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2020, 5:52 AM