This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Fix crash during legalization of a vector G_SELECT with scalar mask.
ClosedPublic

Authored by aemerson on Nov 17 2020, 12:16 PM.

Details

Summary

The lowering of vector selects needs to first splat the scalar mask into a vector first.

This was causing a crash when building oggenc in the test suite.

Diff Detail

Event Timeline

aemerson created this revision.Nov 17 2020, 12:16 PM
aemerson requested review of this revision.Nov 17 2020, 12:16 PM
arsenm added inline comments.Nov 17 2020, 12:18 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
6226

Maybe should have a buildSplat helper too

6231–6233

This is the same as the ZeroMask(DstTy.getNumElements())

6235–6238

We should have a buildShuffleVector

aemerson added inline comments.Nov 17 2020, 12:22 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
6226

We already have a MachineIRBuilder::buildSplatVector() but that just currently emits a G_BUILD_VECTOR with identical elements. Should we change that to settle on the insert_vector_elt & shufflevector idiom as the default representation?

aemerson updated this revision to Diff 305888.Nov 17 2020, 1:03 PM

Add buildShuffleSplat and buildShuffleVector to MachineIRBuilder and use.

This revision is now accepted and ready to land.Nov 30 2020, 9:22 AM
This revision was landed with ongoing or failed builds.Nov 30 2020, 4:38 PM
This revision was automatically updated to reflect the committed changes.