This is an archive of the discontinued LLVM Phabricator instance.

[Analysis] add utility function for unary shuffle mask creation
ClosedPublic

Authored by spatel on Oct 15 2021, 7:47 AM.

Details

Summary

This is NFC-intended for the callers. Posting in case there are other potential users that I missed.
I would also use this from VectorCombine in a patch for:
https://llvm.org/PR52178

Diff Detail

Event Timeline

spatel created this revision.Oct 15 2021, 7:47 AM
spatel requested review of this revision.Oct 15 2021, 7:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2021, 7:47 AM

This is personal style! I would hoist the ugly c-style cast out of the loop and avoid the subtraction with mixed signed integers.

This is personal style! I would hoist the ugly c-style cast out of the loop and avoid the subtraction with mixed signed integers.

Sure - then I can also put another safety assert on that value. The casts were carried over from the SDAG code which has lots of that messiness dealing with shuffle mask values.

spatel updated this revision to Diff 380018.Oct 15 2021, 8:39 AM

Updated to use signed number of elements and assert that the value is in expected range.

RKSimon accepted this revision.Oct 16 2021, 2:31 AM

LGTM - cheers!

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
21260

(style) remove braces

This revision is now accepted and ready to land.Oct 16 2021, 2:31 AM