[llvm] [AArch64][GlobalISel] Combine G_EXTRACT_VECTOR_ELT and G_BUILD_VECTOR sequences into G_SHUFFLE_VECTOR (PR #110545)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 14:06:08 PDT 2024


================
@@ -772,8 +772,6 @@ MachineInstrBuilder MachineIRBuilder::buildShuffleVector(const DstOp &Res,
   LLT DstTy = Res.getLLTTy(*getMRI());
   LLT Src1Ty = Src1.getLLTTy(*getMRI());
   LLT Src2Ty = Src2.getLLTTy(*getMRI());
-  assert((size_t)(Src1Ty.getNumElements() + Src2Ty.getNumElements()) >=
----------------
ValentijnvdBeek wrote:

You are completely right, that the code should be checked with asserts and that they are an important part of ensuring quality going further. Thanks for the reminder, I think that is never unwelcome. However, in this case my PR doesn't break the assertion per se. Rather the examples of `G_SHUFFLE_VECTOR`, I mentioned before don't follow the assertion. The code asserts that the sum of the vectors is larger than the mask, but for none of those are true. Since those patterns exist, I want to support them and since we have a `buildShuffleVector` I want to use it (instead of reimplementing it). 

Anyways, I am completely willing to drop the commit, you know much more than me about things like this. But my reason for removing it was to pull into line with how the opcode is used, not because I thought it was a legacy assert :) 

https://github.com/llvm/llvm-project/pull/110545


More information about the llvm-commits mailing list