[llvm-dev] AsmPrinter.cpp: emitting trailing padding for global data array in emitGlobalConstantDataSequential

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 31 16:39:27 PDT 2017


On 7/31/2017 4:20 PM, Vlad Dov vdovleka via llvm-dev wrote:
> Hello all,
>
> Looking at the emitGlobalConstantDataSequential function in 
> lib/CodeGen/AsmPrinter/AsmPrinter.cpp  there is a code there 
> responsible for emitting of the potential trailing padding for the 
> global array.
>
> Is there an example ( preferably C code ) that triggers this code?  
> AFAIU no trailing padding should be generated for global data arrays.

You're right, no trailing padding will be generated for arrays: the 
alignment of an array is the same as the alignment of its element type.  
We can end up with trailing padding for vectors, though.  For example:

typedef float float3 __attribute((ext_vector_type(3)));
float3 x = {1,2,3};

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-dev mailing list