[PATCH] D56379: GlobalISel: Implement fewerElementsVector for constants

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 9 09:34:04 PST 2019


aditya_nandakumar added a comment.

In D56379#1350702 <https://reviews.llvm.org/D56379#1350702>, @arsenm wrote:

> In D56379#1348785 <https://reviews.llvm.org/D56379#1348785>, @aemerson wrote:
>
> > This is strange. G_CONSTANT isn't supposed to be able to splat the constant into a vector, so this is an oversight in the MachineVerifier for not catching this case.
> >
> > Constant vectors are handled in the IRTranslator as G_BUILD_VECTORs of the constant element values. Sorry about the confusion.
>
>
> They aren't handled this way in the MachineIRBuilder. I would prefer it if G_CONSTANT did splat, since I always found this extremely annoying in SelectionDAG


It would be clear if we want constant vectors, that the destination and source be vector types - so that would mean we have ConstantVector for the RHS. I'm not sure how this would look in MIR.
I agree with you though - it is annoying to do a build_vector for constant vectors. Maybe instead of implicit splat, if we could have a G_CONSTANT_VECTOR depending on how badly we want to avoid the build_vector.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56379/new/

https://reviews.llvm.org/D56379





More information about the llvm-commits mailing list