Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / forward-declare-as-array-elem.cpp
blob0d76e32b44cb275d9601d67410fb11c23f77c338
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
4 struct S;
5 extern S a[10];
6 S(*b)[10] = &a;
7 struct S {
8 int x;
9 };
11 // The address calculation should be based on the size of the struct S
12 // declaration, not a dummy type like i8.
14 // CHECK-LABEL: define dso_local noundef i32 @_Z1fv
15 // CHECK-SAME: () #[[ATTR0:[0-9]+]] {
16 // CHECK-NEXT: entry:
17 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr getelementptr inbounds ([10 x %struct.S], ptr @a, i64 0, i64 3), align 4
18 // CHECK-NEXT: ret i32 [[TMP0]]
20 int f() { return a[3].x; }