forked from OSchip/llvm-project
30 lines
1.3 KiB
Plaintext
30 lines
1.3 KiB
Plaintext
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes
|
|
// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
|
|
struct RT {
|
|
char A;
|
|
int B[10][20];
|
|
char C;
|
|
};
|
|
struct ST {
|
|
int X;
|
|
double Y;
|
|
struct RT Z;
|
|
};
|
|
|
|
// CHECK: Function Attrs: mustprogress noinline nounwind optnone
|
|
// CHECK-LABEL: @_Z3fooP2ST(
|
|
// CHECK-NEXT: entry:
|
|
// CHECK-NEXT: [[S_ADDR:%.*]] = alloca %struct.ST*, align 8
|
|
// CHECK-NEXT: store %struct.ST* [[S:%.*]], %struct.ST** [[S_ADDR]], align 8
|
|
// CHECK-NEXT: [[TMP0:%.*]] = load %struct.ST*, %struct.ST** [[S_ADDR]], align 8
|
|
// CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_ST:%.*]], %struct.ST* [[TMP0]], i64 1
|
|
// CHECK-NEXT: [[Z:%.*]] = getelementptr inbounds [[STRUCT_ST]], %struct.ST* [[ARRAYIDX]], i32 0, i32 2
|
|
// CHECK-NEXT: [[B:%.*]] = getelementptr inbounds [[STRUCT_RT:%.*]], %struct.RT* [[Z]], i32 0, i32 1
|
|
// CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds [10 x [20 x i32]], [10 x [20 x i32]]* [[B]], i64 0, i64 5
|
|
// CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [20 x i32], [20 x i32]* [[ARRAYIDX1]], i64 0, i64 13
|
|
// CHECK-NEXT: ret i32* [[ARRAYIDX2]]
|
|
//
|
|
int *foo(struct ST *s) {
|
|
return &s[1].Z.B[5][13];
|
|
}
|