forked from OSchip/llvm-project
Emit trailing padding on constant vectors when TargetData says that the vector
is larger than the sum of the elements (including per-element padding). llvm-svn: 133631
This commit is contained in:
parent
bb9a5e6df1
commit
6208a2fd66
|
@ -1516,6 +1516,13 @@ static void EmitGlobalConstantVector(const ConstantVector *CV,
|
|||
unsigned AddrSpace, AsmPrinter &AP) {
|
||||
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
|
||||
EmitGlobalConstantImpl(CV->getOperand(i), AddrSpace, AP);
|
||||
|
||||
const TargetData &TD = *AP.TM.getTargetData();
|
||||
unsigned Size = TD.getTypeAllocSize(CV->getType());
|
||||
unsigned EmittedSize = TD.getTypeAllocSize(CV->getType()->getElementType()) *
|
||||
CV->getType()->getNumElements();
|
||||
if (unsigned Padding = Size - EmittedSize)
|
||||
AP.OutStreamer.EmitZeros(Padding, AddrSpace);
|
||||
}
|
||||
|
||||
static void EmitGlobalConstantStruct(const ConstantStruct *CS,
|
||||
|
|
|
@ -44,3 +44,16 @@ define void @f7(i32 %a) {
|
|||
r:
|
||||
ret void
|
||||
}
|
||||
|
||||
%t1 = type { <3 x float>, <3 x float> }
|
||||
|
||||
@const1 = global %t1 { <3 x float> zeroinitializer,
|
||||
<3 x float> <float 1.000000e+00,
|
||||
float 2.000000e+00,
|
||||
float 3.000000e+00> }, align 16
|
||||
; CHECK: const1
|
||||
; CHECK: .zero 16
|
||||
; CHECK: float 1.0
|
||||
; CHECK: float 2.0
|
||||
; CHECK: float 3.0
|
||||
; CHECK: .zero 4
|
||||
|
|
Loading…
Reference in New Issue