This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel]: Fix lowering of G_Shuffle_vector where we pick up the wrong source index
ClosedPublic

Authored by aditya_nandakumar on Aug 13 2019, 3:44 PM.

Details

Summary

<3 x s32> a = {1, 2, 3}
<3 x s32> b = {4, 5,6}
<2 x s32> c = G_SHUFFLE_VECTOR a, b, shufflemask(2,1)
produces
BUILD_VECTOR {4, 2}
but should produce
BUILD_VECTOR {3, 2}

Diff Detail

Repository
rL LLVM

Event Timeline

arsenm accepted this revision.Aug 13 2019, 4:35 PM

LGTM, although I copied this from the DAG lowering, which does seem to use the result number of elements?

This revision is now accepted and ready to land.Aug 13 2019, 4:35 PM

Committed in 368781.
I haven't had a chance to look into the DAG's implementation yet but our out of tree bots caught this.