[llvm-commits] patch: fix emission of npot vectors which need trailing padding

Nick Lewycky nlewycky at google.com
Mon Jun 20 22:52:23 PDT 2011


Hi! This patch fixes an inconsistency that manifests like this:

typedef float float3 __attribute__((ext_vector_type(3)));

struct Foo {
  float3 x;
  float3 y;
};

struct Foo foo = { {0, 0, 0}, {1, 2, 3} };


This lowers to a struct with <3 x float>, which TargetData says is 16 bytes
on ARM. In LLVM IR, the first element becomes a constant aggregate zero,
which is emitted by looking at how many bytes it is (sixteen) and writing
out a zero-fill. The second element is emitted as three contiguous elements,
resulting in a total of 12 bytes.

The StructLayout object claims that each of those should be 16 bytes, so I
changed the AsmPrinter in CodeGen to apply padding to the end of an array to
match what TargetData thinks the length of the array is. Patch attached,
please review!

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110620/3d99b3d8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asmprinter-vector-elts-2.patch
Type: application/octet-stream
Size: 879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110620/3d99b3d8/attachment.obj>


More information about the llvm-commits mailing list