Age | Commit message (Collapse) | Author |
|
no uses.
This was the deeper cause of the issues I fixed in https://codereview.chromium.org/33233002/ and is therefore a better fix. (The problem was that StripDeadPrototypes was not stripping a variable that was actually dead because the bitcast constexpr inserted by FlattenGlobals referred to it.) I reverted most of that CL's changes, though not the comment and test cleanup.
R=dschuff@chromium.org
TEST= pnacl-clang++ pnacl/git/libcxx/test/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp -stdlib=libc++
Review URL: https://codereview.chromium.org/34843003
|
|
BUG=none
TEST=*.ll tests
Review URL: https://codereview.chromium.org/16865012
|
|
The constructor for getelementptr ConstantExprs does some constant
folding which can add 1 or 2 more indexes to the getelementptr. This
complicates checking for FlattenGlobals' normal form in the PNaCl ABI
checker.
Worse, the GCC torture tests turned up a pathological case where this
constant folding adds 4 indexes to the getelementptr and leaves the
original struct type behind:
@q = global i8* getelementptr inbounds (
%union.u* bitcast ([260 x i8]* @v to %union.u*),
i32 0, i32 0, i32 0, i32 0, i32 4)
That comes from the following code in
gcc/testsuite/gcc.c-torture/execute/pr43784.c:
struct s {
unsigned char a[256];
};
union u {
struct { struct s b; int c; } d;
struct { int c; struct s b; } e;
};
static union u v;
static struct s *q = &v.e.b;
We can fix this by using ptrtoint+add instead of
getelementptr+bitcast, because ConstantExpr won't automatically
convert ptrtoint to something else.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3113
TEST=*.ll tests + PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/15647009
|
|
If a global variable has no "align" attribute, it must be aligned
based on its type.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3437
TEST=flatten-globals.ll
Review URL: https://codereview.chromium.org/15359006
|
|
This pass converts initializers for global variables into a flattened
normal form which removes nested struct types and simplifies
ConstantExprs.
In the future, we might change the bitcode format to use the flattened
bytes+relocs representation for global initializers. In that case, we
will be able to reuse the FlattenedConstant class in the bitcode
reader/writer for converting to and from this form.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3113
TEST=test/Transforms/NaCl/flatten-globals.ll
Review URL: https://codereview.chromium.org/14017011
|