2011-08-27 09:09:30 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
|
|
|
|
|
2011-08-17 05:41:35 +08:00
|
|
|
// rdar://7309675
|
|
|
|
// PR4678
|
2011-08-27 09:09:30 +08:00
|
|
|
namespace test0 {
|
|
|
|
// test1 should be compmiled to be a varargs function in the IR even
|
|
|
|
// though there is no way to do a va_begin. Otherwise, the optimizer
|
|
|
|
// will warn about 'dropped arguments' at the call site.
|
2011-08-17 05:41:35 +08:00
|
|
|
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32 @_ZN5test05test1Ez(...)
|
2011-08-27 09:09:30 +08:00
|
|
|
int test1(...) {
|
|
|
|
return -1;
|
|
|
|
}
|
2011-08-17 05:41:35 +08:00
|
|
|
|
2015-04-17 07:25:00 +08:00
|
|
|
// CHECK: call i32 (...) @_ZN5test05test1Ez(i32 0)
|
2011-08-27 09:09:30 +08:00
|
|
|
void test() {
|
|
|
|
test1(0);
|
|
|
|
}
|
2011-08-17 05:41:35 +08:00
|
|
|
}
|
|
|
|
|
2011-08-27 09:09:30 +08:00
|
|
|
namespace test1 {
|
|
|
|
struct A {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
|
|
|
|
void foo(...);
|
|
|
|
|
|
|
|
void test() {
|
|
|
|
A x;
|
|
|
|
foo(x);
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @_ZN5test14testEv()
|
2011-08-27 09:09:30 +08:00
|
|
|
// CHECK: [[X:%.*]] = alloca [[A:%.*]], align 4
|
|
|
|
// CHECK-NEXT: [[TMP:%.*]] = alloca [[A]], align 4
|
|
|
|
// CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i8*
|
|
|
|
// CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[X]] to i8*
|
Change memcpy/memove/memset to have dest and source alignment attributes (Step 1).
Summary:
Upstream LLVM is changing the the prototypes of the @llvm.memcpy/memmove/memset
intrinsics. This change updates the Clang tests for this change.
The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument
which is required to be a constant integer. It represents the alignment of the
dest (and source), and so must be the minimum of the actual alignment of the
two.
This change removes the alignment argument in favour of placing the alignment
attribute on the source and destination pointers of the memory intrinsic call.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)
At this time the source and destination alignments must be the same (Step 1).
Step 2 of the change, to be landed shortly, will relax that contraint and allow
the source and destination to have different alignments.
llvm-svn: 322964
2018-01-20 01:12:54 +08:00
|
|
|
// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[T0]], i8* align 4 [[T1]], i64 8, i1 false)
|
2011-08-27 09:09:30 +08:00
|
|
|
// CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i64*
|
2015-07-10 19:31:43 +08:00
|
|
|
// CHECK-NEXT: [[T1:%.*]] = load i64, i64* [[T0]], align 4
|
2015-04-17 07:25:00 +08:00
|
|
|
// CHECK-NEXT: call void (...) @_ZN5test13fooEz(i64 [[T1]])
|
2011-08-27 09:09:30 +08:00
|
|
|
// CHECK-NEXT: ret void
|
2011-08-17 05:41:35 +08:00
|
|
|
}
|