LowerTypeTests: Teach the pass to respect global alignments.
authorPeter Collingbourne <peter@pcc.me.uk>
Mon, 22 Jul 2019 18:47:03 +0000 (18:47 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Mon, 22 Jul 2019 18:47:03 +0000 (18:47 +0000)
commitc3b8661df5478db2a83a213f36192dfdfa92cbe1
tree0680b3ba5f637f8635b53d8a0095d640282c3d3a
parenta2748c74d68bd3748dcf626d828ee50a19cd1324
LowerTypeTests: Teach the pass to respect global alignments.

We were previously ignoring alignment entirely when combining globals
together in this pass. There are two main things that we need to do here:
add additional padding before each global to meet the alignment requirements,
and set the combined global's alignment to the maximum of all of the original
globals' alignments.

Since we now need to calculate layout as we go anyway, use the calculated
layout to produce GlobalLayout instead of using StructLayout.

Differential Revision: https://reviews.llvm.org/D65033

llvm-svn: 366722
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/test/Transforms/LowerTypeTests/align.ll [new file with mode: 0644]