2022-04-07 18:03:55 +08:00
|
|
|
// RUN: %clang_cc1 -no-opaque-pointers -triple sparcv9-unknown-unknown -emit-llvm %s -o - | FileCheck %s
|
2013-06-05 11:00:18 +08:00
|
|
|
#include <stdarg.h>
|
2013-05-28 05:48:25 +08:00
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @f_void()
|
2013-05-28 05:48:25 +08:00
|
|
|
void f_void(void) {}
|
|
|
|
|
|
|
|
// Arguments and return values smaller than the word size are extended.
|
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} signext i32 @f_int_1(i32 noundef signext %x)
|
2013-05-28 05:48:25 +08:00
|
|
|
int f_int_1(int x) { return x; }
|
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} zeroext i32 @f_int_2(i32 noundef zeroext %x)
|
2013-05-28 05:48:25 +08:00
|
|
|
unsigned f_int_2(unsigned x) { return x; }
|
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i64 @f_int_3(i64 noundef %x)
|
2013-05-28 05:48:25 +08:00
|
|
|
long long f_int_3(long long x) { return x; }
|
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} signext i8 @f_int_4(i8 noundef signext %x)
|
2013-05-28 05:48:25 +08:00
|
|
|
char f_int_4(char x) { return x; }
|
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} fp128 @f_ld(fp128 noundef %x)
|
2014-01-17 00:43:19 +08:00
|
|
|
long double f_ld(long double x) { return x; }
|
|
|
|
|
2013-05-28 05:48:25 +08:00
|
|
|
// Small structs are passed in registers.
|
|
|
|
struct small {
|
|
|
|
int *a, *b;
|
|
|
|
};
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} %struct.small @f_small(i32* %x.coerce0, i32* %x.coerce1)
|
2013-05-28 05:48:25 +08:00
|
|
|
struct small f_small(struct small x) {
|
|
|
|
x.a += *x.b;
|
|
|
|
x.b = 0;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Medium-sized structs are passed indirectly, but can be returned in registers.
|
|
|
|
struct medium {
|
|
|
|
int *a, *b;
|
|
|
|
int *c, *d;
|
|
|
|
};
|
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} %struct.medium @f_medium(%struct.medium* noundef %x)
|
2013-05-28 05:48:25 +08:00
|
|
|
struct medium f_medium(struct medium x) {
|
|
|
|
x.a += *x.b;
|
|
|
|
x.b = 0;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Large structs are also returned indirectly.
|
|
|
|
struct large {
|
|
|
|
int *a, *b;
|
|
|
|
int *c, *d;
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @f_large(%struct.large* noalias sret(%struct.large) align 8 %agg.result, %struct.large* noundef %x)
|
2013-05-28 05:48:25 +08:00
|
|
|
struct large f_large(struct large x) {
|
|
|
|
x.a += *x.b;
|
|
|
|
x.b = 0;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2013-05-28 12:57:37 +08:00
|
|
|
// A 64-bit struct fits in a register.
|
|
|
|
struct reg {
|
|
|
|
int a, b;
|
|
|
|
};
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i64 @f_reg(i64 %x.coerce)
|
2013-05-28 12:57:37 +08:00
|
|
|
struct reg f_reg(struct reg x) {
|
|
|
|
x.a += x.b;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Structs with mixed int and float parts require the inreg attribute.
|
|
|
|
struct mixed {
|
|
|
|
int a;
|
|
|
|
float b;
|
|
|
|
};
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} inreg %struct.mixed @f_mixed(i32 inreg %x.coerce0, float inreg %x.coerce1)
|
2013-05-28 12:57:37 +08:00
|
|
|
struct mixed f_mixed(struct mixed x) {
|
|
|
|
x.a += 1;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Struct with padding.
|
|
|
|
struct mixed2 {
|
|
|
|
int a;
|
|
|
|
double b;
|
|
|
|
};
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { i64, double } @f_mixed2(i64 %x.coerce0, double %x.coerce1)
|
2013-06-05 11:00:13 +08:00
|
|
|
// CHECK: store i64 %x.coerce0
|
|
|
|
// CHECK: store double %x.coerce1
|
2013-05-28 12:57:37 +08:00
|
|
|
struct mixed2 f_mixed2(struct mixed2 x) {
|
|
|
|
x.a += 1;
|
|
|
|
return x;
|
|
|
|
}
|
2013-06-05 11:00:13 +08:00
|
|
|
|
|
|
|
// Struct with single element and padding in passed in the high bits of a
|
|
|
|
// register.
|
|
|
|
struct tiny {
|
|
|
|
char a;
|
|
|
|
};
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i64 @f_tiny(i64 %x.coerce)
|
2013-06-05 11:00:13 +08:00
|
|
|
// CHECK: %[[HB:[^ ]+]] = lshr i64 %x.coerce, 56
|
|
|
|
// CHECK: = trunc i64 %[[HB]] to i8
|
|
|
|
struct tiny f_tiny(struct tiny x) {
|
|
|
|
x.a += 1;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @call_tiny()
|
2013-06-05 11:00:13 +08:00
|
|
|
// CHECK: %[[XV:[^ ]+]] = zext i8 %{{[^ ]+}} to i64
|
|
|
|
// CHECK: %[[HB:[^ ]+]] = shl i64 %[[XV]], 56
|
|
|
|
// CHECK: = call i64 @f_tiny(i64 %[[HB]])
|
2022-02-16 05:06:01 +08:00
|
|
|
void call_tiny(void) {
|
2013-06-05 11:00:13 +08:00
|
|
|
struct tiny x = { 1 };
|
|
|
|
f_tiny(x);
|
|
|
|
}
|
2013-06-05 11:00:18 +08:00
|
|
|
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} signext i32 @f_variable(i8* noundef %f, ...)
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK: %ap = alloca i8*
|
|
|
|
// CHECK: call void @llvm.va_start
|
|
|
|
//
|
|
|
|
int f_variable(char *f, ...) {
|
|
|
|
int s = 0;
|
|
|
|
char c;
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, f);
|
|
|
|
while ((c = *f++)) switch (c) {
|
|
|
|
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap
|
Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment. Introduce APIs on CGBuilderTy to work with Address
values. Change core APIs on CGF/CGM to traffic in Address where
appropriate. Require alignments to be non-zero. Update a ton
of code to compute and propagate alignment information.
As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.
The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned. Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay. I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.
Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.
We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment. In particular,
field access now uses alignmentAtOffset instead of min.
Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs. For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint. That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.
ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments. In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments. That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.
I partially punted on applying this work to CGBuiltin. Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.
llvm-svn: 246985
2015-09-08 16:05:57 +08:00
|
|
|
// CHECK-DAG: %[[NXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 8
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK-DAG: store i8* %[[NXT]], i8** %ap
|
Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment. Introduce APIs on CGBuilderTy to work with Address
values. Change core APIs on CGF/CGM to traffic in Address where
appropriate. Require alignments to be non-zero. Update a ton
of code to compute and propagate alignment information.
As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.
The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned. Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay. I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.
Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.
We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment. In particular,
field access now uses alignmentAtOffset instead of min.
Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs. For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint. That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.
ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments. In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments. That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.
I partially punted on applying this work to CGBuiltin. Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.
llvm-svn: 246985
2015-09-08 16:05:57 +08:00
|
|
|
// CHECK-DAG: %[[EXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 4
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK-DAG: %[[ADR:[^ ]+]] = bitcast i8* %[[EXT]] to i32*
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK-DAG: load i32, i32* %[[ADR]]
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK: br
|
|
|
|
case 'i':
|
|
|
|
s += va_arg(ap, int);
|
|
|
|
break;
|
|
|
|
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap
|
Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment. Introduce APIs on CGBuilderTy to work with Address
values. Change core APIs on CGF/CGM to traffic in Address where
appropriate. Require alignments to be non-zero. Update a ton
of code to compute and propagate alignment information.
As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.
The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned. Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay. I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.
Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.
We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment. In particular,
field access now uses alignmentAtOffset instead of min.
Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs. For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint. That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.
ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments. In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments. That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.
I partially punted on applying this work to CGBuiltin. Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.
llvm-svn: 246985
2015-09-08 16:05:57 +08:00
|
|
|
// CHECK-DAG: %[[NXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 8
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK-DAG: store i8* %[[NXT]], i8** %ap
|
|
|
|
// CHECK-DAG: %[[ADR:[^ ]+]] = bitcast i8* %[[CUR]] to i64*
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK-DAG: load i64, i64* %[[ADR]]
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK: br
|
|
|
|
case 'l':
|
|
|
|
s += va_arg(ap, long);
|
|
|
|
break;
|
|
|
|
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap
|
Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment. Introduce APIs on CGBuilderTy to work with Address
values. Change core APIs on CGF/CGM to traffic in Address where
appropriate. Require alignments to be non-zero. Update a ton
of code to compute and propagate alignment information.
As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.
The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned. Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay. I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.
Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.
We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment. In particular,
field access now uses alignmentAtOffset instead of min.
Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs. For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint. That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.
ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments. In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments. That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.
I partially punted on applying this work to CGBuiltin. Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.
llvm-svn: 246985
2015-09-08 16:05:57 +08:00
|
|
|
// CHECK-DAG: %[[NXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 8
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK-DAG: store i8* %[[NXT]], i8** %ap
|
|
|
|
// CHECK-DAG: %[[ADR:[^ ]+]] = bitcast i8* %[[CUR]] to %struct.tiny*
|
|
|
|
// CHECK: br
|
|
|
|
case 't':
|
|
|
|
s += va_arg(ap, struct tiny).a;
|
|
|
|
break;
|
|
|
|
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap
|
Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment. Introduce APIs on CGBuilderTy to work with Address
values. Change core APIs on CGF/CGM to traffic in Address where
appropriate. Require alignments to be non-zero. Update a ton
of code to compute and propagate alignment information.
As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.
The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned. Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay. I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.
Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.
We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment. In particular,
field access now uses alignmentAtOffset instead of min.
Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs. For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint. That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.
ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments. In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments. That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.
I partially punted on applying this work to CGBuiltin. Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.
llvm-svn: 246985
2015-09-08 16:05:57 +08:00
|
|
|
// CHECK-DAG: %[[NXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 16
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK-DAG: store i8* %[[NXT]], i8** %ap
|
|
|
|
// CHECK-DAG: %[[ADR:[^ ]+]] = bitcast i8* %[[CUR]] to %struct.small*
|
|
|
|
// CHECK: br
|
|
|
|
case 's':
|
|
|
|
s += *va_arg(ap, struct small).a;
|
|
|
|
break;
|
|
|
|
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: %[[CUR:[^ ]+]] = load i8*, i8** %ap
|
Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment. Introduce APIs on CGBuilderTy to work with Address
values. Change core APIs on CGF/CGM to traffic in Address where
appropriate. Require alignments to be non-zero. Update a ton
of code to compute and propagate alignment information.
As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.
The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned. Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay. I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.
Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.
We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment. In particular,
field access now uses alignmentAtOffset instead of min.
Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs. For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint. That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.
ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments. In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments. That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.
I partially punted on applying this work to CGBuiltin. Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.
llvm-svn: 246985
2015-09-08 16:05:57 +08:00
|
|
|
// CHECK-DAG: %[[NXT:[^ ]+]] = getelementptr inbounds i8, i8* %[[CUR]], i64 8
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK-DAG: store i8* %[[NXT]], i8** %ap
|
|
|
|
// CHECK-DAG: %[[IND:[^ ]+]] = bitcast i8* %[[CUR]] to %struct.medium**
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK-DAG: %[[ADR:[^ ]+]] = load %struct.medium*, %struct.medium** %[[IND]]
|
2013-06-05 11:00:18 +08:00
|
|
|
// CHECK: br
|
|
|
|
case 'm':
|
|
|
|
s += *va_arg(ap, struct medium).a;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|