[llvm] [GlobalISel] Fix buildCopyFromRegs for split vectors (PR #77448)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 05:17:39 PST 2024
================
@@ -478,9 +478,43 @@ static void buildCopyFromRegs(MachineIRBuilder &B, ArrayRef<Register> OrigRegs,
} else {
// Vector was split, and elements promoted to a wider type.
// FIXME: Should handle floating point promotions.
- LLT BVType = LLT::fixed_vector(LLTy.getNumElements(), PartLLT);
- auto BV = B.buildBuildVector(BVType, Regs);
- B.buildTrunc(OrigRegs[0], BV);
+ unsigned NumElts = LLTy.getNumElements();
+ LLT BVType = LLT::fixed_vector(NumElts, PartLLT);
+
+ Register BuildVec;
+ if (NumElts == Regs.size())
+ BuildVec = B.buildBuildVector(BVType, Regs).getReg(0);
+ else {
+ SmallVector<Register, 0> BVRegs;
+ BVRegs.reserve(NumElts);
----------------
arsenm wrote:
Can put this in constructor o
https://github.com/llvm/llvm-project/pull/77448
More information about the llvm-commits
mailing list