return DAG.getFrameIndex(FI, PtrVT);
}
+ EVT ArgVT = Ins[i].ArgVT;
+
+ // If this is a vector that has been split into multiple parts, and the
+ // scalar size of the parts don't match the vector element size, then we can't
+ // elide the copy. The parts will have padding between them instead of being
+ // packed like a vector.
+ bool ScalarizedAndExtendedVector =
+ ArgVT.isVector() && !VA.getLocVT().isVector() &&
+ VA.getLocVT().getSizeInBits() != ArgVT.getScalarSizeInBits();
+
// This is an argument in memory. We might be able to perform copy elision.
// If the argument is passed directly in memory without any extension, then we
// can perform copy elision. Large vector types, for example, may be passed
// indirectly by pointer.
if (Flags.isCopyElisionCandidate() &&
- VA.getLocInfo() != CCValAssign::Indirect && !ExtendedInMem) {
- EVT ArgVT = Ins[i].ArgVT;
+ VA.getLocInfo() != CCValAssign::Indirect && !ExtendedInMem &&
+ !ScalarizedAndExtendedVector) {
SDValue PartAddr;
if (Ins[i].PartOffset == 0) {
// If this is a one-part value or the first part of a multi-part value,
; CHECK-NEXT: movl %eax, %ecx
; CHECK-NEXT: movw 176(%esp), %dx
; CHECK-NEXT: movw 172(%esp), %si
-; CHECK-NEXT: movw 164(%esp), %di
-; CHECK-NEXT: movw 166(%esp), %bx
+; CHECK-NEXT: movw 168(%esp), %di
+; CHECK-NEXT: movw 164(%esp), %bx
; CHECK-NEXT: movw 160(%esp), %bp
; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
; CHECK-NEXT: movw 156(%esp), %ax
; CHECK-NEXT: movw %ax, {{[-0-9]+}}(%e{{[sb]}}p) # 2-byte Spill
-; CHECK-NEXT: movw 148(%esp), %ax
-; CHECK-NEXT: movw %ax, {{[-0-9]+}}(%e{{[sb]}}p) # 2-byte Spill
-; CHECK-NEXT: movw 150(%esp), %ax
+; CHECK-NEXT: movw 152(%esp), %ax
; CHECK-NEXT: movw %ax, {{[-0-9]+}}(%e{{[sb]}}p) # 2-byte Spill
-; CHECK-NEXT: movw {{[-0-9]+}}(%e{{[sb]}}p), %ax # 2-byte Reload
+; CHECK-NEXT: movw 148(%esp), %ax
; CHECK-NEXT: movw %ax, 112(%esp)
; CHECK-NEXT: movw {{[-0-9]+}}(%e{{[sb]}}p), %ax # 2-byte Reload
; CHECK-NEXT: movw %ax, 114(%esp)
; CHECK-NEXT: movw %bp, 118(%esp)
; CHECK-NEXT: movw %dx, 110(%esp)
; CHECK-NEXT: movw %si, 108(%esp)
-; CHECK-NEXT: movw %bx, 106(%esp)
-; CHECK-NEXT: movw %di, 104(%esp)
+; CHECK-NEXT: movw %di, 106(%esp)
+; CHECK-NEXT: movw %bx, 104(%esp)
; CHECK-NEXT: movzwl 118(%esp), %edx
; CHECK-NEXT: movzwl 116(%esp), %esi
; CHECK-NEXT: movzwl 114(%esp), %edi