[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CodeGenCXX / amdgcn-automatic-variable.cpp
blob4e22b923277584fef5875e113586b036214d3696
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -O0 -triple amdgcn---amdgiz -emit-llvm %s -o - | FileCheck %s
4 // CHECK-LABEL: @_Z5func1Pi(
5 // CHECK-NEXT: entry:
6 // CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32*, align 8, addrspace(5)
7 // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast i32* addrspace(5)* [[X_ADDR]] to i32**
8 // CHECK-NEXT: store i32* [[X:%.*]], i32** [[X_ADDR_ASCAST]], align 8
9 // CHECK-NEXT: [[TMP0:%.*]] = load i32*, i32** [[X_ADDR_ASCAST]], align 8
10 // CHECK-NEXT: store i32 1, i32* [[TMP0]], align 4
11 // CHECK-NEXT: ret void
13 void func1(int *x) {
14 *x = 1;
17 // CHECK-LABEL: @_Z5func2v(
18 // CHECK-NEXT: entry:
19 // CHECK-NEXT: [[LV1:%.*]] = alloca i32, align 4, addrspace(5)
20 // CHECK-NEXT: [[LV2:%.*]] = alloca i32, align 4, addrspace(5)
21 // CHECK-NEXT: [[LA:%.*]] = alloca [100 x i32], align 4, addrspace(5)
22 // CHECK-NEXT: [[LP1:%.*]] = alloca i32*, align 8, addrspace(5)
23 // CHECK-NEXT: [[LP2:%.*]] = alloca i32*, align 8, addrspace(5)
24 // CHECK-NEXT: [[LVC:%.*]] = alloca i32, align 4, addrspace(5)
25 // CHECK-NEXT: [[LV1_ASCAST:%.*]] = addrspacecast i32 addrspace(5)* [[LV1]] to i32*
26 // CHECK-NEXT: [[LV2_ASCAST:%.*]] = addrspacecast i32 addrspace(5)* [[LV2]] to i32*
27 // CHECK-NEXT: [[LA_ASCAST:%.*]] = addrspacecast [100 x i32] addrspace(5)* [[LA]] to [100 x i32]*
28 // CHECK-NEXT: [[LP1_ASCAST:%.*]] = addrspacecast i32* addrspace(5)* [[LP1]] to i32**
29 // CHECK-NEXT: [[LP2_ASCAST:%.*]] = addrspacecast i32* addrspace(5)* [[LP2]] to i32**
30 // CHECK-NEXT: [[LVC_ASCAST:%.*]] = addrspacecast i32 addrspace(5)* [[LVC]] to i32*
31 // CHECK-NEXT: store i32 1, i32* [[LV1_ASCAST]], align 4
32 // CHECK-NEXT: store i32 2, i32* [[LV2_ASCAST]], align 4
33 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], [100 x i32]* [[LA_ASCAST]], i64 0, i64 0
34 // CHECK-NEXT: store i32 3, i32* [[ARRAYIDX]], align 4
35 // CHECK-NEXT: store i32* [[LV1_ASCAST]], i32** [[LP1_ASCAST]], align 8
36 // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [100 x i32], [100 x i32]* [[LA_ASCAST]], i64 0, i64 0
37 // CHECK-NEXT: store i32* [[ARRAYDECAY]], i32** [[LP2_ASCAST]], align 8
38 // CHECK-NEXT: call void @_Z5func1Pi(i32* noundef [[LV1_ASCAST]])
39 // CHECK-NEXT: store i32 4, i32* [[LVC_ASCAST]], align 4
40 // CHECK-NEXT: store i32 4, i32* [[LV1_ASCAST]], align 4
41 // CHECK-NEXT: ret void
43 void func2(void) {
45 int lv1;
46 lv1 = 1;
47 int lv2 = 2;
49 int la[100];
50 la[0] = 3;
52 int *lp1 = &lv1;
54 int *lp2 = la;
56 func1(&lv1);
58 const int lvc = 4;
59 lv1 = lvc;
62 void destroy(int x);
64 class A {
65 int x;
66 public:
67 A():x(0) {}
68 ~A() {
69 destroy(x);
73 // CHECK-LABEL: @_Z5func3v(
74 // CHECK-NEXT: entry:
75 // CHECK-NEXT: [[A:%.*]] = alloca [[CLASS_A:%.*]], align 4, addrspace(5)
76 // CHECK-NEXT: [[A_ASCAST:%.*]] = addrspacecast [[CLASS_A]] addrspace(5)* [[A]] to %class.A*
77 // CHECK-NEXT: call void @_ZN1AC1Ev(%class.A* noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
78 // CHECK-NEXT: call void @_ZN1AD1Ev(%class.A* noundef nonnull align 4 dereferenceable(4) [[A_ASCAST]])
79 // CHECK-NEXT: ret void
81 void func3() {
82 A a;
85 // CHECK-LABEL: @_Z5func4i(
86 // CHECK-NEXT: entry:
87 // CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4, addrspace(5)
88 // CHECK-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast i32 addrspace(5)* [[X_ADDR]] to i32*
89 // CHECK-NEXT: store i32 [[X:%.*]], i32* [[X_ADDR_ASCAST]], align 4
90 // CHECK-NEXT: call void @_Z5func1Pi(i32* noundef [[X_ADDR_ASCAST]])
91 // CHECK-NEXT: ret void
93 void func4(int x) {
94 func1(&x);
97 // CHECK-LABEL: @_Z5func5v(
98 // CHECK-NEXT: entry:
99 // CHECK-NEXT: [[X:%.*]] = alloca i32, align 4, addrspace(5)
100 // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast i32 addrspace(5)* [[X]] to i32*
101 // CHECK-NEXT: ret void
103 void func5() {
104 return;
105 int x = 0;
108 // CHECK-LABEL: @_Z5func6v(
109 // CHECK-NEXT: entry:
110 // CHECK-NEXT: [[X:%.*]] = alloca i32, align 4, addrspace(5)
111 // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast i32 addrspace(5)* [[X]] to i32*
112 // CHECK-NEXT: ret void
114 void func6() {
115 return;
116 int x;
119 extern void use(int *);
120 // CHECK-LABEL: @_Z5func7v(
121 // CHECK-NEXT: entry:
122 // CHECK-NEXT: [[X:%.*]] = alloca i32, align 4, addrspace(5)
123 // CHECK-NEXT: [[X_ASCAST:%.*]] = addrspacecast i32 addrspace(5)* [[X]] to i32*
124 // CHECK-NEXT: br label [[LATER:%.*]]
125 // CHECK: later:
126 // CHECK-NEXT: call void @_Z3usePi(i32* noundef [[X_ASCAST]])
127 // CHECK-NEXT: ret void
129 void func7() {
130 goto later;
131 int x;
132 later:
133 use(&x);