This is an archive of the discontinued LLVM Phabricator instance.

[Analysis] add query to get splat value from array of ints
ClosedPublic

Authored by spatel on Feb 5 2020, 8:58 AM.

Details

Summary

I was debug stepping through an x86 shuffle lowering and noticed we were doing an N^2 search for splat index. I didn't find the equivalent functionality anywhere else in LLVM, so here's a helper that takes an array of int and returns a splatted index while ignoring undefs (any negative value).

This might also be used inside existing ShuffleVectorInst/ShuffleVectorSDNode functions and/or help with D72467.

Diff Detail

Event Timeline

spatel created this revision.Feb 5 2020, 8:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2020, 8:58 AM
RKSimon accepted this revision.Feb 5 2020, 9:46 AM

LGTM - The ShuffleVectorSDNode isSplatMask/getSplatIndex helpers could be cleaned up to use this as well.

This revision is now accepted and ready to land.Feb 5 2020, 9:46 AM
This revision was automatically updated to reflect the committed changes.