Skip to content

Commit 4fefed6

Browse files
committed
OpaquePtr: Turn inalloca into a type attribute
I think byval/sret and the others are close to being able to rip out the code to support the missing type case. A lot of this code is shared with inalloca, so catch this up to the others so that can happen.
1 parent c5243c6 commit 4fefed6

File tree

91 files changed

+446
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+446
-264
lines changed

clang/lib/CodeGen/CGCall.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2290,7 +2290,7 @@ void CodeGenModule::ConstructAttributeList(
22902290
// Attach attributes to inalloca argument.
22912291
if (IRFunctionArgs.hasInallocaArg()) {
22922292
llvm::AttrBuilder Attrs;
2293-
Attrs.addAttribute(llvm::Attribute::InAlloca);
2293+
Attrs.addInAllocaAttr(FI.getArgStruct());
22942294
ArgAttrs[IRFunctionArgs.getInallocaArgNo()] =
22952295
llvm::AttributeSet::get(getLLVMContext(), Attrs);
22962296
}

clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ void usage() {
1616
bar(f);
1717
}
1818

19-
// WINDOWS: define dso_local i32 @"?bar@@YAHUFoo@@@Z"(<{ %struct.Foo }>* inalloca %0)
19+
// WINDOWS: define dso_local i32 @"?bar@@YAHUFoo@@@Z"(<{ %struct.Foo }>* inalloca(<{ %struct.Foo }>) %0)
2020
// WINDOWS: %[[O:[0-9a-zA-Z]+]] = getelementptr inbounds <{ %struct.Foo }>, <{ %struct.Foo }>* %0, i32 0, i32 0
2121
// WINDOWS: %[[X:[0-9a-zA-Z]+]] = getelementptr inbounds %struct.Foo, %struct.Foo* %[[O]], i32 0, i32 0
2222
// WINDOWS: %[[LOAD:[0-9a-zA-Z]+]] = load i32, i32* %[[X]]
2323
// WINDOWS: ret i32 %[[LOAD]]
2424

25-
// WINDOWS: define dso_local i32 @"?bar@@YAHUFoo@@@Z.sse4.2"(<{ %struct.Foo }>* inalloca %0)
25+
// WINDOWS: define dso_local i32 @"?bar@@YAHUFoo@@@Z.sse4.2"(<{ %struct.Foo }>* inalloca(<{ %struct.Foo }>) %0)
2626
// WINDOWS: %[[O:[0-9a-zA-Z]+]] = getelementptr inbounds <{ %struct.Foo }>, <{ %struct.Foo }>* %0, i32 0, i32 0
2727
// WINDOWS: %[[X:[0-9a-zA-Z]+]] = getelementptr inbounds %struct.Foo, %struct.Foo* %[[O]], i32 0, i32 0
2828
// WINDOWS: %[[LOAD:[0-9a-zA-Z]+]] = load i32, i32* %[[X]]
2929
// WINDOWS: %[[ADD:[0-9a-zA-Z]+]] = add nsw i32 %[[LOAD]], 1
3030
// WINDOWS: ret i32 %[[ADD]]
3131

32-
// WINDOWS: define dso_local i32 @"?bar@@YAHUFoo@@@Z.arch_ivybridge"(<{ %struct.Foo }>* inalloca %0)
32+
// WINDOWS: define dso_local i32 @"?bar@@YAHUFoo@@@Z.arch_ivybridge"(<{ %struct.Foo }>* inalloca(<{ %struct.Foo }>) %0)
3333
// WINDOWS: %[[O:[0-9a-zA-Z]+]] = getelementptr inbounds <{ %struct.Foo }>, <{ %struct.Foo }>* %0, i32 0, i32 0
3434
// WINDOWS: %[[X:[0-9a-zA-Z]+]] = getelementptr inbounds %struct.Foo, %struct.Foo* %[[O]], i32 0, i32 0
3535
// WINDOWS: %[[LOAD:[0-9a-zA-Z]+]] = load i32, i32* %[[X]]
@@ -39,7 +39,7 @@ void usage() {
3939
// WINDOWS: define dso_local void @"?usage@@YAXXZ"()
4040
// WINDOWS: %[[F:[0-9a-zA-Z]+]] = alloca %struct.Foo
4141
// WINDOWS: %[[ARGMEM:[0-9a-zA-Z]+]] = alloca inalloca <{ %struct.Foo }>
42-
// WINDOWS: %[[CALL:[0-9a-zA-Z]+]] = call i32 @"?bar@@YAHUFoo@@@Z.resolver"(<{ %struct.Foo }>* inalloca %[[ARGMEM]])
42+
// WINDOWS: %[[CALL:[0-9a-zA-Z]+]] = call i32 @"?bar@@YAHUFoo@@@Z.resolver"(<{ %struct.Foo }>* inalloca(<{ %struct.Foo }>) %[[ARGMEM]])
4343

4444
// WINDOWS: define weak_odr dso_local i32 @"?bar@@YAHUFoo@@@Z.resolver"(<{ %struct.Foo }>* %0)
4545
// WINDOWS: %[[RET:[0-9a-zA-Z]+]] = musttail call i32 @"?bar@@YAHUFoo@@@Z.arch_ivybridge"(<{ %struct.Foo }>* %0)

clang/test/CodeGenCXX/inalloca-overaligned.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int receive_inalloca_overaligned(NonTrivial nt, OverAligned o) {
2828
}
2929

3030
// CHECK-LABEL: define dso_local i32 @"?receive_inalloca_overaligned@@Y{{.*}}"
31-
// CHECK-SAME: (<{ %struct.NonTrivial, %struct.OverAligned* }>* inalloca %0)
31+
// CHECK-SAME: (<{ %struct.NonTrivial, %struct.OverAligned* }>* inalloca(<{ %struct.NonTrivial, %struct.OverAligned* }>) %0)
3232

3333
int pass_inalloca_overaligned() {
3434
gvi32 = receive_inalloca_overaligned(NonTrivial(), OverAligned());
@@ -50,7 +50,7 @@ int pass_inalloca_overaligned() {
5050
// Store the address of an OverAligned temporary into the struct.
5151
// CHECK: getelementptr inbounds <{ %struct.NonTrivial, %struct.OverAligned* }>, <{ %struct.NonTrivial, %struct.OverAligned* }>* %{{.*}}, i32 0, i32 1
5252
// CHECK: store %struct.OverAligned* [[TMP]], %struct.OverAligned** %{{.*}}, align 4
53-
// CHECK: call i32 @"?receive_inalloca_overaligned@@Y{{.*}}"(<{ %struct.NonTrivial, %struct.OverAligned* }>* inalloca %argmem)
53+
// CHECK: call i32 @"?receive_inalloca_overaligned@@Y{{.*}}"(<{ %struct.NonTrivial, %struct.OverAligned* }>* inalloca(<{ %struct.NonTrivial, %struct.OverAligned* }>) %argmem)
5454

5555
int receive_both(Both o) {
5656
return o.x + o.y;
@@ -74,7 +74,7 @@ int receive_inalloca_both(NonTrivial nt, Both o) {
7474
}
7575

7676
// CHECK-LABEL: define dso_local i32 @"?receive_inalloca_both@@Y{{.*}}"
77-
// CHECK-SAME: (<{ %struct.NonTrivial, %struct.Both* }>* inalloca %0)
77+
// CHECK-SAME: (<{ %struct.NonTrivial, %struct.Both* }>* inalloca(<{ %struct.NonTrivial, %struct.Both* }>) %0)
7878

7979
int pass_inalloca_both() {
8080
gvi32 = receive_inalloca_both(NonTrivial(), Both());
@@ -84,7 +84,7 @@ int pass_inalloca_both() {
8484
// CHECK-LABEL: define dso_local i32 @"?pass_inalloca_both@@Y{{.*}}"
8585
// CHECK: [[TMP:%[^ ]*]] = alloca %struct.Both, align 8
8686
// CHECK: call x86_thiscallcc %struct.Both* @"??0Both@@QAE@XZ"(%struct.Both* {{[^,]*}} [[TMP]])
87-
// CHECK: call i32 @"?receive_inalloca_both@@Y{{.*}}"(<{ %struct.NonTrivial, %struct.Both* }>* inalloca %argmem)
87+
// CHECK: call i32 @"?receive_inalloca_both@@Y{{.*}}"(<{ %struct.NonTrivial, %struct.Both* }>* inalloca(<{ %struct.NonTrivial, %struct.Both* }>) %argmem)
8888

8989
// Here we have a type that is:
9090
// - overaligned

clang/test/CodeGenCXX/inalloca-vector.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void receive_vec_128(NonTrivial nt, __m128 x, __m128 y, __m128 z, __m128 w, __m1
2121
// CHECK-SAME: (<4 x float> inreg %x,
2222
// CHECK-SAME: <4 x float> inreg %y,
2323
// CHECK-SAME: <4 x float> inreg %z,
24-
// CHECK-SAME: <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* inalloca %0)
24+
// CHECK-SAME: <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* inalloca(<{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>) %0)
2525

2626
void pass_vec_128() {
2727
__m128 z = {0};
@@ -45,7 +45,7 @@ void pass_vec_128() {
4545
// CHECK-SAME: (<4 x float> inreg %{{[^,]*}},
4646
// CHECK-SAME: <4 x float> inreg %{{[^,]*}},
4747
// CHECK-SAME: <4 x float> inreg %{{[^,]*}},
48-
// CHECK-SAME: <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* inalloca %{{[^,]*}})
48+
// CHECK-SAME: <{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>* inalloca(<{ %struct.NonTrivial, <4 x float>*, <4 x float>* }>) %{{[^,]*}})
4949

5050
// w will be passed indirectly by register, and q will be passed indirectly, but
5151
// the pointer will be in memory.
@@ -58,7 +58,7 @@ void __fastcall fastcall_receive_vec(__m128 x, __m128 y, __m128 z, __m128 w, int
5858
// CHECK-SAME: <4 x float> inreg %z,
5959
// CHECK-SAME: <4 x float>* inreg %0,
6060
// CHECK-SAME: i32 inreg %edx,
61-
// CHECK-SAME: <{ <4 x float>*, %struct.NonTrivial }>* inalloca %1)
61+
// CHECK-SAME: <{ <4 x float>*, %struct.NonTrivial }>* inalloca(<{ <4 x float>*, %struct.NonTrivial }>) %1)
6262

6363

6464
void __vectorcall vectorcall_receive_vec(double xmm0, double xmm1, double xmm2,
@@ -75,4 +75,4 @@ void __vectorcall vectorcall_receive_vec(double xmm0, double xmm1, double xmm2,
7575
// CHECK-SAME: <4 x float> inreg %z,
7676
// CHECK-SAME: <4 x float>* inreg %0,
7777
// CHECK-SAME: i32 inreg %edx,
78-
// CHECK-SAME: <{ <4 x float>*, %struct.NonTrivial }>* inalloca %1)
78+
// CHECK-SAME: <{ <4 x float>*, %struct.NonTrivial }>* inalloca(<{ <4 x float>*, %struct.NonTrivial }>) %1)

clang/test/CodeGenCXX/inheriting-constructor.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ namespace inalloca_nonvirt {
134134
// WIN32: store i32 2, i32* %[[ARG2]]
135135
// WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
136136
// WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]
137-
// WIN32: call {{.*}} @"??0A@inalloca_nonvirt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca %[[ARGMEM]])
137+
// WIN32: call {{.*}} @"??0A@inalloca_nonvirt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca(<{{.*}}>) %[[ARGMEM]])
138138
// WIN32: call void @llvm.stackrestore(
139139
// WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
140140
// WIN32: call {{.*}} @"??1Q@@QAE@XZ"(
@@ -170,7 +170,7 @@ namespace inalloca_nonvirt {
170170
// WIN32: store i32 2, i32* %[[ARG2]]
171171
// WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
172172
// WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]
173-
// WIN32: call {{.*}} @"??0A@inalloca_nonvirt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca %[[ARGMEM]])
173+
// WIN32: call {{.*}} @"??0A@inalloca_nonvirt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca(<{{.*}}>) %[[ARGMEM]])
174174
// WIN32: call void @llvm.stackrestore(
175175
// WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
176176
// WIN32: call {{.*}} @"??1Q@@QAE@XZ"(
@@ -216,7 +216,7 @@ namespace inalloca_virt {
216216
// WIN32: store i32 2, i32* %[[ARG2]]
217217
// WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
218218
// WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]
219-
// WIN32: call {{.*}} @"??0A@inalloca_virt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca %[[ARGMEM]])
219+
// WIN32: call {{.*}} @"??0A@inalloca_virt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca(<{{.*}}>) %[[ARGMEM]])
220220
// WIN32: call void @llvm.stackrestore(
221221
// WIN32: br
222222
//
@@ -266,7 +266,7 @@ namespace inalloca_virt {
266266
// WIN32: store i32 2, i32* %[[ARG2]]
267267
// WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
268268
// WIN32: store {{.*}}* %[[TMP]], {{.*}}** %[[ARG4]]
269-
// WIN32: call {{.*}} @"??0A@inalloca_virt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca %[[ARGMEM]])
269+
// WIN32: call {{.*}} @"??0A@inalloca_virt@@QAE@UQ@@H0$$QAU2@@Z"(%{{[^,]*}}, <{{.*}}>* inalloca(<{{.*}}>) %[[ARGMEM]])
270270
// WIN32: call void @llvm.stackrestore(
271271
// WIN32: br
272272
//

clang/test/CodeGenCXX/microsoft-abi-arg-order.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void foo(A a, A b, A c) {
1414
// Order of destruction should be left to right.
1515
//
1616
// X86-LABEL: define dso_local void @"?foo@@YAXUA@@00@Z"
17-
// X86: ([[argmem_ty:<{ %struct.A, %struct.A, %struct.A }>]]* inalloca %0)
17+
// X86: ([[argmem_ty:<{ %struct.A, %struct.A, %struct.A }>]]* inalloca([[argmem_ty]]) %0)
1818
// X86: %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %0, i32 0, i32 0
1919
// X86: %[[b:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %0, i32 0, i32 1
2020
// X86: %[[c:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %0, i32 0, i32 2
@@ -47,7 +47,7 @@ void call_foo() {
4747
// X86: invoke x86_thiscallcc %struct.A* @"??0A@@QAE@H@Z"(%struct.A* {{[^,]*}} %[[arg2]], i32 2)
4848
// X86: %[[arg1:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 0
4949
// X86: invoke x86_thiscallcc %struct.A* @"??0A@@QAE@H@Z"(%struct.A* {{[^,]*}} %[[arg1]], i32 1)
50-
// X86: call void @"?foo@@YAXUA@@00@Z"([[argmem_ty]]* inalloca %[[argmem]])
50+
// X86: call void @"?foo@@YAXUA@@00@Z"([[argmem_ty]]* inalloca([[argmem_ty]]) %[[argmem]])
5151
// X86: call void @llvm.stackrestore
5252
// X86: ret void
5353
//

clang/test/CodeGenCXX/microsoft-abi-byval-sret.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ A B::foo(A x) {
1919
}
2020

2121
// CHECK-LABEL: define dso_local x86_thiscallcc %struct.A* @"?foo@B@@QAE?AUA@@U2@@Z"
22-
// CHECK: (%struct.B* %this, <{ %struct.A*, %struct.A }>* inalloca %0)
22+
// CHECK: (%struct.B* %this, <{ %struct.A*, %struct.A }>* inalloca(<{ %struct.A*, %struct.A }>) %0)
2323
// CHECK: getelementptr inbounds <{ %struct.A*, %struct.A }>, <{ %struct.A*, %struct.A }>* %{{.*}}, i32 0, i32 0
2424
// CHECK: load %struct.A*, %struct.A**
2525
// CHECK: ret %struct.A*
@@ -29,7 +29,7 @@ A B::bar(A x) {
2929
}
3030

3131
// CHECK-LABEL: define dso_local %struct.A* @"?bar@B@@QAA?AUA@@U2@@Z"
32-
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca %0)
32+
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca(<{ %struct.B*, %struct.A*, %struct.A }>) %0)
3333
// CHECK: getelementptr inbounds <{ %struct.B*, %struct.A*, %struct.A }>, <{ %struct.B*, %struct.A*, %struct.A }>* %{{.*}}, i32 0, i32 1
3434
// CHECK: load %struct.A*, %struct.A**
3535
// CHECK: ret %struct.A*
@@ -39,7 +39,7 @@ A B::baz(A x) {
3939
}
4040

4141
// CHECK-LABEL: define dso_local x86_stdcallcc %struct.A* @"?baz@B@@QAG?AUA@@U2@@Z"
42-
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca %0)
42+
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca(<{ %struct.B*, %struct.A*, %struct.A }>) %0)
4343
// CHECK: getelementptr inbounds <{ %struct.B*, %struct.A*, %struct.A }>, <{ %struct.B*, %struct.A*, %struct.A }>* %{{.*}}, i32 0, i32 1
4444
// CHECK: load %struct.A*, %struct.A**
4545
// CHECK: ret %struct.A*
@@ -49,7 +49,7 @@ A B::qux(A x) {
4949
}
5050

5151
// CHECK-LABEL: define dso_local x86_fastcallcc void @"?qux@B@@QAI?AUA@@U2@@Z"
52-
// CHECK: (%struct.B* inreg %this, %struct.A* inreg noalias sret(%struct.A) align 4 %agg.result, <{ %struct.A }>* inalloca %0)
52+
// CHECK: (%struct.B* inreg %this, %struct.A* inreg noalias sret(%struct.A) align 4 %agg.result, <{ %struct.A }>* inalloca(<{ %struct.A }>) %0)
5353
// CHECK: ret void
5454

5555
int main() {
@@ -61,10 +61,10 @@ int main() {
6161
}
6262

6363
// CHECK: call x86_thiscallcc %struct.A* @"?foo@B@@QAE?AUA@@U2@@Z"
64-
// CHECK: (%struct.B* %{{[^,]*}}, <{ %struct.A*, %struct.A }>* inalloca %{{[^,]*}})
64+
// CHECK: (%struct.B* %{{[^,]*}}, <{ %struct.A*, %struct.A }>* inalloca(<{ %struct.A*, %struct.A }>) %{{[^,]*}})
6565
// CHECK: call %struct.A* @"?bar@B@@QAA?AUA@@U2@@Z"
66-
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca %{{[^,]*}})
66+
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca(<{ %struct.B*, %struct.A*, %struct.A }>) %{{[^,]*}})
6767
// CHECK: call x86_stdcallcc %struct.A* @"?baz@B@@QAG?AUA@@U2@@Z"
68-
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca %{{[^,]*}})
68+
// CHECK: (<{ %struct.B*, %struct.A*, %struct.A }>* inalloca(<{ %struct.B*, %struct.A*, %struct.A }>) %{{[^,]*}})
6969
// CHECK: call x86_fastcallcc void @"?qux@B@@QAI?AUA@@U2@@Z"
70-
// CHECK: (%struct.B* inreg %{{[^,]*}}, %struct.A* inreg sret(%struct.A) align 4 %{{.*}}, <{ %struct.A }>* inalloca %{{[^,]*}})
70+
// CHECK: (%struct.B* inreg %{{[^,]*}}, %struct.A* inreg sret(%struct.A) align 4 %{{.*}}, <{ %struct.A }>* inalloca(<{ %struct.A }>) %{{[^,]*}})

clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ struct C : A, B { C(); virtual void foo(Agg x); };
1515
C::C() {} // force emission
1616

1717
// CHECK32-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"?foo@C@byval_thunk@@W3AEXUAgg@2@@Z"
18-
// CHECK32: (%"struct.byval_thunk::C"* %this, <{ %"struct.byval_thunk::Agg" }>* inalloca %0)
18+
// CHECK32: (%"struct.byval_thunk::C"* %this, <{ %"struct.byval_thunk::Agg" }>* inalloca(<{ %"struct.byval_thunk::Agg" }>) %0)
1919
// CHECK32: getelementptr i8, i8* %{{.*}}, i32 -4
2020
// CHECK32: musttail call x86_thiscallcc void @"?foo@C@byval_thunk@@UAEXUAgg@2@@Z"
21-
// CHECK32: (%"struct.byval_thunk::C"* %{{.*}}, <{ %"struct.byval_thunk::Agg" }>* inalloca %0)
21+
// CHECK32: (%"struct.byval_thunk::C"* %{{.*}}, <{ %"struct.byval_thunk::Agg" }>* inalloca(<{ %"struct.byval_thunk::Agg" }>) %0)
2222
// CHECK32-NEXT: ret void
2323

2424
// CHECK64-LABEL: define linkonce_odr dso_local void @"?foo@C@byval_thunk@@W7EAAXUAgg@2@@Z"
@@ -44,13 +44,13 @@ struct C : A, B { C(); virtual void __stdcall foo(Agg x); };
4444
C::C() {} // force emission
4545

4646
// CHECK32-LABEL: define linkonce_odr dso_local x86_stdcallcc void @"?foo@C@stdcall_thunk@@W3AGXUAgg@2@@Z"
47-
// CHECK32: (<{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>* inalloca %0)
47+
// CHECK32: (<{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>* inalloca(<{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>) %0)
4848
// CHECK32: %[[this_slot:[^ ]*]] = getelementptr inbounds <{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>, <{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>* %0, i32 0, i32 0
4949
// CHECK32: load %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::C"** %[[this_slot]]
5050
// CHECK32: getelementptr i8, i8* %{{.*}}, i32 -4
5151
// CHECK32: store %"struct.stdcall_thunk::C"* %{{.*}}, %"struct.stdcall_thunk::C"** %[[this_slot]]
5252
// CHECK32: musttail call x86_stdcallcc void @"?foo@C@stdcall_thunk@@UAGXUAgg@2@@Z"
53-
// CHECK32: (<{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>* inalloca %0)
53+
// CHECK32: (<{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>* inalloca(<{ %"struct.stdcall_thunk::C"*, %"struct.stdcall_thunk::Agg" }>) %0)
5454
// CHECK32-NEXT: ret void
5555

5656
// CHECK64-LABEL: define linkonce_odr dso_local void @"?foo@C@stdcall_thunk@@W7EAAXUAgg@2@@Z"
@@ -76,13 +76,13 @@ struct C : A, B { C(); virtual Agg __cdecl foo(Agg x); };
7676
C::C() {} // force emission
7777

7878
// CHECK32-LABEL: define linkonce_odr dso_local %"struct.sret_thunk::Agg"* @"?foo@C@sret_thunk@@W3AA?AUAgg@2@U32@@Z"
79-
// CHECK32: (<{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>* inalloca %0)
79+
// CHECK32: (<{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>* inalloca(<{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>) %0)
8080
// CHECK32: %[[this_slot:[^ ]*]] = getelementptr inbounds <{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>, <{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>* %0, i32 0, i32 0
8181
// CHECK32: load %"struct.sret_thunk::C"*, %"struct.sret_thunk::C"** %[[this_slot]]
8282
// CHECK32: getelementptr i8, i8* %{{.*}}, i32 -4
8383
// CHECK32: store %"struct.sret_thunk::C"* %{{.*}}, %"struct.sret_thunk::C"** %[[this_slot]]
8484
// CHECK32: %[[rv:[^ ]*]] = musttail call %"struct.sret_thunk::Agg"* @"?foo@C@sret_thunk@@UAA?AUAgg@2@U32@@Z"
85-
// CHECK32: (<{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>* inalloca %0)
85+
// CHECK32: (<{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>* inalloca(<{ %"struct.sret_thunk::C"*, %"struct.sret_thunk::Agg"*, %"struct.sret_thunk::Agg" }>) %0)
8686
// CHECK32-NEXT: ret %"struct.sret_thunk::Agg"* %[[rv]]
8787

8888
// CHECK64-LABEL: define linkonce_odr dso_local void @"?foo@C@sret_thunk@@W7EAA?AUAgg@2@U32@@Z"

clang/test/CodeGenCXX/microsoft-abi-byval-vararg.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ int foo(A a, ...) {
1919
return sum;
2020
}
2121

22-
// CHECK-LABEL: define dso_local i32 @"?foo@@YAHUA@@ZZ"(<{ %struct.A }>* inalloca %0, ...)
22+
// CHECK-LABEL: define dso_local i32 @"?foo@@YAHUA@@ZZ"(<{ %struct.A }>* inalloca(<{ %struct.A }>) %0, ...)
2323

2424
int main() {
2525
return foo(A(3), 1, 2, 3);
2626
}
2727
// CHECK-LABEL: define dso_local i32 @main()
2828
// CHECK: %[[argmem:[^ ]*]] = alloca inalloca <{ %struct.A, i32, i32, i32 }>
29-
// CHECK: call i32 {{.*bitcast.*}}@"?foo@@YAHUA@@ZZ"{{.*}}(<{ %struct.A, i32, i32, i32 }>* inalloca %[[argmem]])
29+
// CHECK: call i32 {{.*bitcast.*}}@"?foo@@YAHUA@@ZZ"{{.*}}(<{ %struct.A, i32, i32, i32 }>* inalloca(<{ %struct.A, i32, i32, i32 }>) %[[argmem]])
3030

3131
void varargs_zero(...);
3232
void varargs_one(int, ...);
@@ -41,10 +41,10 @@ void call_var_args() {
4141
}
4242

4343
// CHECK-LABEL: define dso_local void @"?call_var_args@@YAXXZ"()
44-
// CHECK: call void {{.*bitcast.*varargs_zero.*}}(<{ %struct.A }>* inalloca %{{.*}})
45-
// CHECK: call void {{.*bitcast.*varargs_one.*}}(<{ i32, %struct.A }>* inalloca %{{.*}})
46-
// CHECK: call void {{.*bitcast.*varargs_two.*}}(<{ i32, i32, %struct.A }>* inalloca %{{.*}})
47-
// CHECK: call void {{.*bitcast.*varargs_three.*}}(<{ i32, i32, i32, %struct.A }>* inalloca %{{.*}})
44+
// CHECK: call void {{.*bitcast.*varargs_zero.*}}(<{ %struct.A }>* inalloca(<{ %struct.A }>) %{{.*}})
45+
// CHECK: call void {{.*bitcast.*varargs_one.*}}(<{ i32, %struct.A }>* inalloca(<{ i32, %struct.A }>) %{{.*}})
46+
// CHECK: call void {{.*bitcast.*varargs_two.*}}(<{ i32, i32, %struct.A }>* inalloca(<{ i32, i32, %struct.A }>) %{{.*}})
47+
// CHECK: call void {{.*bitcast.*varargs_three.*}}(<{ i32, i32, i32, %struct.A }>* inalloca(<{ i32, i32, i32, %struct.A }>) %{{.*}})
4848

4949
// CHECK-LABEL: declare dso_local void @"?varargs_zero@@YAXZZ"(...)
5050
// CHECK-LABEL: declare dso_local void @"?varargs_one@@YAXHZZ"(i32, ...)

clang/test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int HasDeactivatedCleanups() {
5454
// WIN32: invoke x86_thiscallcc %struct.A* @"??0A@@QAE@XZ"
5555
// WIN32: store i1 false, i1* %[[isactive]]
5656
//
57-
// WIN32: invoke i32 @"?TakesTwo@@YAHUA@@0@Z"([[argmem_ty]]* inalloca %[[argmem]])
57+
// WIN32: invoke i32 @"?TakesTwo@@YAHUA@@0@Z"([[argmem_ty]]* inalloca([[argmem_ty]]) %[[argmem]])
5858
// Destroy the two const ref temporaries.
5959
// WIN32: call x86_thiscallcc void @"??1A@@QAE@XZ"({{.*}})
6060
// WIN32: call x86_thiscallcc void @"??1A@@QAE@XZ"({{.*}})

0 commit comments

Comments
 (0)