[llvm] [GlobalISel][AArch64] Lower G_BITCAST vectors with non-integer element ratio (PR #215154)
Kacper Doga via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 03:45:51 PDT 2026
================
@@ -3743,10 +3743,48 @@ LegalizerHelper::lowerBitcast(MachineInstr &MI) {
SmallVector<Register, 8> SrcRegs;
if (DstTy.isVector()) {
+ LLT DstEltTy = DstTy.getElementType();
int NumDstElt = DstTy.getNumElements();
int NumSrcElt = SrcTy.getNumElements();
- LLT DstEltTy = DstTy.getElementType();
+ if (NumSrcElt % NumDstElt != 0 && NumDstElt % NumSrcElt != 0) {
----------------
varev-dev wrote:
Changed to use EC and used multiplyCoefficientBy, isKnownMultipleOf. I am not sure if this is what you meant, if not please correct me and I will fix it.
Also one note regarding the coherency, if we would like to stick to EC and its methods we may want to change already existing paths of Bitcast lowering to use isKnownGT/LT* to compare and getKnownScalarFactor to calculate intermediate EC?
https://github.com/llvm/llvm-project/pull/215154
More information about the llvm-commits
mailing list