1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-attributes 2// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s 3struct RT { 4 char A; 5 int B[10][20]; 6 char C; 7}; 8struct ST { 9 int X; 10 double Y; 11 struct RT Z; 12}; 13 14// CHECK: Function Attrs: noinline nounwind optnone mustprogress 15// CHECK-LABEL: @_Z3fooP2ST( 16// CHECK-NEXT: entry: 17// CHECK-NEXT: [[S_ADDR:%.*]] = alloca %struct.ST*, align 8 18// CHECK-NEXT: store %struct.ST* [[S:%.*]], %struct.ST** [[S_ADDR]], align 8 19// CHECK-NEXT: [[TMP0:%.*]] = load %struct.ST*, %struct.ST** [[S_ADDR]], align 8 20// CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_ST:%.*]], %struct.ST* [[TMP0]], i64 1 21// CHECK-NEXT: [[Z:%.*]] = getelementptr inbounds [[STRUCT_ST]], %struct.ST* [[ARRAYIDX]], i32 0, i32 2 22// CHECK-NEXT: [[B:%.*]] = getelementptr inbounds [[STRUCT_RT:%.*]], %struct.RT* [[Z]], i32 0, i32 1 23// CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds [10 x [20 x i32]], [10 x [20 x i32]]* [[B]], i64 0, i64 5 24// CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [20 x i32], [20 x i32]* [[ARRAYIDX1]], i64 0, i64 13 25// CHECK-NEXT: ret i32* [[ARRAYIDX2]] 26// 27int *foo(struct ST *s) { 28 return &s[1].Z.B[5][13]; 29} 30