From be0c07dc7e24034fa0903f183ae485a9e22a7797 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 8 Apr 2026 14:14:30 -0700 Subject: [PATCH] Give Carbon -> C++ thunks internal linkage. (#7040) Also declare them `inline` since we're putting the `always_inline` attribute on them. Use the `internal_linkage` attribute rather than `SC_Static` since it's a more precise mechanism and matches what we do for static member functions in reverse interop (where `SC_Static` means something else and would not give the function internal linkage). --- toolchain/check/cpp/thunk.cpp | 13 +- .../basics/raw_sem_ir/cpp_interop.carbon | 4 +- .../interop/cpp/function/thunk_ast.carbon | 6 +- .../testdata/interop/cpp/constructor.carbon | 1040 ++++++++--------- .../testdata/interop/cpp/extern_c.carbon | 60 +- .../testdata/interop/cpp/function_decl.carbon | 90 +- .../lower/testdata/interop/cpp/method.carbon | 174 +-- .../lower/testdata/interop/cpp/nullptr.carbon | 240 ++-- .../testdata/interop/cpp/parameters.carbon | 387 +++--- .../lower/testdata/interop/cpp/pointer.carbon | 314 ++--- .../testdata/interop/cpp/reference.carbon | 530 ++++----- .../lower/testdata/interop/cpp/return.carbon | 324 ++--- .../interop/cpp/std_initializer_list.carbon | 708 +++++------ .../testdata/interop/cpp/template.carbon | 250 ++-- .../testdata/interop/cpp/virtual_base.carbon | 102 +- 15 files changed, 2124 insertions(+), 2118 deletions(-) diff --git a/toolchain/check/cpp/thunk.cpp b/toolchain/check/cpp/thunk.cpp index 1eb877597389..25854301ba83 100644 --- a/toolchain/check/cpp/thunk.cpp +++ b/toolchain/check/cpp/thunk.cpp @@ -419,19 +419,20 @@ static auto CreateThunkFunctionDecl( thunk_param_types, ext_proto_info); clang::DeclContext* decl_context = ast_context.getTranslationUnitDecl(); - // TODO: Thunks should not have external linkage, consider using `SC_Static`. - clang::FunctionDecl* thunk_function_decl = - clang::FunctionDecl::Create(ast_context, decl_context, clang_loc, - clang_loc, name, thunk_function_type, - /*TInfo=*/nullptr, clang::SC_Extern); + clang::FunctionDecl* thunk_function_decl = clang::FunctionDecl::Create( + ast_context, decl_context, clang_loc, clang_loc, name, + thunk_function_type, /*TInfo=*/nullptr, clang::SC_None, + /*UsesFPIntrin=*/false, /*isInlineSpecified=*/true); decl_context->addDecl(thunk_function_decl); thunk_function_decl->setParams( BuildThunkParameters(ast_context, callee_info, thunk_function_decl)); - // Set always_inline. + // Force the thunk to be inlined and discarded. thunk_function_decl->addAttr( clang::AlwaysInlineAttr::CreateImplicit(ast_context)); + thunk_function_decl->addAttr( + clang::InternalLinkageAttr::CreateImplicit(ast_context)); // Set asm(".carbon_thunk"). thunk_function_decl->addAttr(clang::AsmLabelAttr::CreateImplicit( diff --git a/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon b/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon index 3888c7b6e533..f98d66329fe6 100644 --- a/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon +++ b/toolchain/check/testdata/basics/raw_sem_ir/cpp_interop.carbon @@ -57,9 +57,9 @@ fn G(x: Cpp.X) { // CHECK:STDOUT: clang_decl_id50000001: {key: "struct X {}", inst_id: inst50000014} // CHECK:STDOUT: clang_decl_id50000002: {key: "X * _Nonnull p", inst_id: inst50000022} // CHECK:STDOUT: clang_decl_id50000003: {key: {decl: "void f(X x = {})", kind: normal, num_params: 0}, inst_id: inst5000002D} -// CHECK:STDOUT: clang_decl_id50000004: {key: {decl: "extern void f__carbon_thunk()", kind: normal, num_params: 0}, inst_id: inst50000030} +// CHECK:STDOUT: clang_decl_id50000004: {key: {decl: "inline void f__carbon_thunk()", kind: normal, num_params: 0}, inst_id: inst50000030} // CHECK:STDOUT: clang_decl_id50000005: {key: {decl: "void f(X x = {})", kind: normal, num_params: 1}, inst_id: inst5000003B} -// CHECK:STDOUT: clang_decl_id50000006: {key: {decl: "extern void f__carbon_thunk(X * _Nonnull x)", kind: normal, num_params: 1}, inst_id: inst50000043} +// CHECK:STDOUT: clang_decl_id50000006: {key: {decl: "inline void f__carbon_thunk(X * _Nonnull x)", kind: normal, num_params: 1}, inst_id: inst50000043} // CHECK:STDOUT: clang_decl_id50000007: {key: "X * _Nonnull global", inst_id: inst5000004E} // CHECK:STDOUT: name_scopes: // CHECK:STDOUT: name_scope0: {inst: instF, parent_scope: name_scope, has_error: false, extended_scopes: [], names: {name(Cpp): inst50000011, name0: inst5000001D}} diff --git a/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon b/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon index 7da3d5ffaa88..7b810b3c6092 100644 --- a/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon +++ b/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon @@ -18,7 +18,7 @@ auto foo(short a) -> void; // CHECK:STDOUT: |-FunctionDecl {{0x[a-f0-9]+}} <./thunk_required.h:[[@LINE-1]]:1, col:22> col:6 used foo 'auto (short) -> void' // CHECK:STDOUT: | `-ParmVarDecl {{0x[a-f0-9]+}} col:16 a 'short' -// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} col:6 foo__carbon_thunk 'void (short * _Nonnull)' extern +// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} col:6 foo__carbon_thunk 'void (short * _Nonnull)' inline // CHECK:STDOUT: |-ParmVarDecl {{0x[a-f0-9]+}} col:6 used a 'short * _Nonnull':'short *' // CHECK:STDOUT: |-ReturnStmt {{0x[a-f0-9]+}} // CHECK:STDOUT: | `-CallExpr {{0x[a-f0-9]+}} 'void' @@ -29,6 +29,7 @@ auto foo(short a) -> void; // CHECK:STDOUT: | `-ImplicitCastExpr {{0x[a-f0-9]+}} 'short * _Nonnull':'short *' // CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} 'short * _Nonnull':'short *' lvalue ParmVar {{0x[a-f0-9]+}} 'a' 'short * _Nonnull':'short *' // CHECK:STDOUT: |-AlwaysInlineAttr {{0x[a-f0-9]+}} <> Implicit always_inline +// CHECK:STDOUT: |-InternalLinkageAttr {{0x[a-f0-9]+}} <> Implicit // CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} Implicit "_Z3foos.carbon_thunk" // CHECK:STDOUT: TranslationUnitDecl {{0x[a-f0-9]+}} <> @@ -46,7 +47,7 @@ fn F() { auto foo() -> short; // CHECK:STDOUT: |-FunctionDecl {{0x[a-f0-9]+}} <./return_thunk_required.h:[[@LINE-1]]:1, col:15> col:6 used foo 'auto () -> short' -// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} col:6 foo__carbon_thunk 'void (short * _Nonnull)' extern +// CHECK:STDOUT: `-FunctionDecl {{0x[a-f0-9]+}} col:6 foo__carbon_thunk 'void (short * _Nonnull)' inline // CHECK:STDOUT: |-ParmVarDecl {{0x[a-f0-9]+}} col:6 used return 'short * _Nonnull':'short *' // CHECK:STDOUT: |-CXXNewExpr {{0x[a-f0-9]+}} 'short *' global Function {{0x[a-f0-9]+}} 'operator new' 'void *(__size_t, void *) noexcept' // CHECK:STDOUT: | |-CallExpr {{0x[a-f0-9]+}} 'short' @@ -54,6 +55,7 @@ auto foo() -> short; // CHECK:STDOUT: | | `-DeclRefExpr {{0x[a-f0-9]+}} 'auto () -> short' Function {{0x[a-f0-9]+}} 'foo' 'auto () -> short' // CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} 'short * _Nonnull':'short *' lvalue ParmVar {{0x[a-f0-9]+}} 'return' 'short * _Nonnull':'short *' // CHECK:STDOUT: |-AlwaysInlineAttr {{0x[a-f0-9]+}} <> Implicit always_inline +// CHECK:STDOUT: |-InternalLinkageAttr {{0x[a-f0-9]+}} <> Implicit // CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} Implicit "_Z3foov.carbon_thunk" // --- import_return_thunk_required.carbon diff --git a/toolchain/lower/testdata/interop/cpp/constructor.carbon b/toolchain/lower/testdata/interop/cpp/constructor.carbon index 1b6af19ce1a8..4cc954c5f803 100644 --- a/toolchain/lower/testdata/interop/cpp/constructor.carbon +++ b/toolchain/lower/testdata/interop/cpp/constructor.carbon @@ -176,68 +176,67 @@ fn Four() { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN1CC2Ev = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %this) unnamed_addr #1 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: %x_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 0 -// CHECK:STDOUT: store i32 8, ptr %x_, align 4, !tbaa !14 -// CHECK:STDOUT: %y_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 1 -// CHECK:STDOUT: store i32 9, ptr %y_, align 4, !tbaa !16 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc7_26.1.temp = alloca [8 x i8], align 1, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_26.1.temp), !dbg !14 +// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %.loc7_26.1.temp), !dbg !14 +// CHECK:STDOUT: ret void, !dbg !15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk_tuple(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !16 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !16 // CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %0) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CF.Main() #2 !dbg !17 { +// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !19 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_26.1.temp = alloca [8 x i8], align 1, !dbg !20 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_26.1.temp), !dbg !20 -// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %.loc7_26.1.temp), !dbg !20 +// CHECK:STDOUT: %.loc11_19.2.temp = alloca [8 x i8], align 1, !dbg !20 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc11_19.2.temp), !dbg !20 +// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk_tuple(ptr %.loc11_19.2.temp), !dbg !20 // CHECK:STDOUT: ret void, !dbg !21 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CG.Main() #2 !dbg !22 { +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Ev.carbon_thunk_tuple(ptr noundef %return) #1 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc11_19.2.temp = alloca [8 x i8], align 1, !dbg !23 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc11_19.2.temp), !dbg !23 -// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk_tuple(ptr %.loc11_19.2.temp), !dbg !23 -// CHECK:STDOUT: ret void, !dbg !24 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !16 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !16 +// CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %0) +// CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %this) unnamed_addr #3 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !16 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: %x_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 0 +// CHECK:STDOUT: store i32 8, ptr %x_, align 4, !tbaa !22 +// CHECK:STDOUT: %y_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 1 +// CHECK:STDOUT: store i32 9, ptr %y_, align 4, !tbaa !24 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives -// CHECK:STDOUT: uselistorder ptr @_ZN1CC2Ev, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -254,20 +253,20 @@ fn Four() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !8, i64 0} -// CHECK:STDOUT: !15 = !{!"_ZTS1C", !8, i64 0, !8, i64 4} -// CHECK:STDOUT: !16 = !{!15, !8, i64 4} -// CHECK:STDOUT: !17 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !18, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !18 = !DISubroutineType(types: !19) -// CHECK:STDOUT: !19 = !{null} -// CHECK:STDOUT: !20 = !DILocation(line: 7, column: 18, scope: !17) -// CHECK:STDOUT: !21 = !DILocation(line: 6, column: 1, scope: !17) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main", scope: null, file: !6, line: 10, type: !18, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !23 = !DILocation(line: 11, column: 18, scope: !22) -// CHECK:STDOUT: !24 = !DILocation(line: 10, column: 1, scope: !22) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 18, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !16 = !{!17, !17, i64 0} +// CHECK:STDOUT: !17 = !{!"p1 _ZTS1C", !18, i64 0} +// CHECK:STDOUT: !18 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main", scope: null, file: !6, line: 10, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !20 = !DILocation(line: 11, column: 18, scope: !19) +// CHECK:STDOUT: !21 = !DILocation(line: 10, column: 1, scope: !19) +// CHECK:STDOUT: !22 = !{!23, !8, i64 0} +// CHECK:STDOUT: !23 = !{!"_ZTS1C", !8, i64 0, !8, i64 4} +// CHECK:STDOUT: !24 = !{!23, !8, i64 4} // CHECK:STDOUT: ; ModuleID = 'implicit_default.carbon' // CHECK:STDOUT: source_filename = "implicit_default.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" @@ -277,59 +276,59 @@ fn Four() { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN1CC2Ev = comdat any // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [8 x i8], align 1, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !14 +// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr %_.var), !dbg !14 +// CHECK:STDOUT: ret void, !dbg !15 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !16 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !16 // CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %0) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %this) unnamed_addr #1 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: %x_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 0 -// CHECK:STDOUT: store i32 8, ptr %x_, align 4, !tbaa !14 -// CHECK:STDOUT: %y_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 1 -// CHECK:STDOUT: store i32 9, ptr %y_, align 4, !tbaa !16 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CF.Main() #2 !dbg !17 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [8 x i8], align 1, !dbg !20 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !20 -// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr %_.var), !dbg !20 -// CHECK:STDOUT: ret void, !dbg !21 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind -// CHECK:STDOUT: define void @"_COp:thunk.C.Cpp"(ptr sret([8 x i8]) %return) #3 !dbg !22 { +// CHECK:STDOUT: define void @"_COp:thunk.C.Cpp"(ptr sret([8 x i8]) %return) #2 !dbg !19 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %return), !dbg !27 -// CHECK:STDOUT: ret void, !dbg !27 +// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %return), !dbg !24 +// CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr sret([8 x i8]) %return) #2 !dbg !28 { -// CHECK:STDOUT: call void @"_COp:thunk.C.Cpp"(ptr %return), !dbg !30 -// CHECK:STDOUT: ret void, !dbg !31 +// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr sret([8 x i8]) %return) #0 !dbg !25 { +// CHECK:STDOUT: call void @"_COp:thunk.C.Cpp"(ptr %return), !dbg !27 +// CHECK:STDOUT: ret void, !dbg !28 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { alwaysinline nounwind } -// CHECK:STDOUT: attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %this) unnamed_addr #4 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !16 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: %x_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 0 +// CHECK:STDOUT: store i32 8, ptr %x_, align 4, !tbaa !29 +// CHECK:STDOUT: %y_ = getelementptr inbounds nuw %class.C, ptr %this1, i32 0, i32 1 +// CHECK:STDOUT: store i32 9, ptr %y_, align 4, !tbaa !31 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -346,27 +345,27 @@ fn Four() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !8, i64 0} -// CHECK:STDOUT: !15 = !{!"_ZTS1C", !8, i64 0, !8, i64 4} -// CHECK:STDOUT: !16 = !{!15, !8, i64 4} -// CHECK:STDOUT: !17 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !18, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !18 = !DISubroutineType(types: !19) -// CHECK:STDOUT: !19 = !{null} -// CHECK:STDOUT: !20 = !DILocation(line: 7, column: 3, scope: !17) -// CHECK:STDOUT: !21 = !DILocation(line: 6, column: 1, scope: !17) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.C.Cpp", scope: null, file: !23, line: 4, type: !24, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !23 = !DIFile(filename: "./default.h", directory: "") -// CHECK:STDOUT: !24 = !DISubroutineType(types: !25) -// CHECK:STDOUT: !25 = !{!26} -// CHECK:STDOUT: !26 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !27 = !DILocation(line: 4, column: 3, scope: !22) -// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b", scope: null, file: !29, line: 9, type: !24, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !29 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "") -// CHECK:STDOUT: !30 = !DILocation(line: 9, column: 28, scope: !28) -// CHECK:STDOUT: !31 = !DILocation(line: 9, column: 21, scope: !28) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !16 = !{!17, !17, i64 0} +// CHECK:STDOUT: !17 = !{!"p1 _ZTS1C", !18, i64 0} +// CHECK:STDOUT: !18 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.C.Cpp", scope: null, file: !20, line: 4, type: !21, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !20 = !DIFile(filename: "./default.h", directory: "") +// CHECK:STDOUT: !21 = !DISubroutineType(types: !22) +// CHECK:STDOUT: !22 = !{!23} +// CHECK:STDOUT: !23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !24 = !DILocation(line: 4, column: 3, scope: !19) +// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b", scope: null, file: !26, line: 9, type: !21, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !26 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "") +// CHECK:STDOUT: !27 = !DILocation(line: 9, column: 28, scope: !25) +// CHECK:STDOUT: !28 = !DILocation(line: 9, column: 21, scope: !25) +// CHECK:STDOUT: !29 = !{!30, !8, i64 0} +// CHECK:STDOUT: !30 = !{!"_ZTS1C", !8, i64 0, !8, i64 4} +// CHECK:STDOUT: !31 = !{!30, !8, i64 4} // CHECK:STDOUT: ; ModuleID = 'defaulted_default.carbon' // CHECK:STDOUT: source_filename = "defaulted_default.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" @@ -379,104 +378,104 @@ fn Four() { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN26ExplicitlyDefaultedDefaultC2Ev = comdat any // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc8_65.1.temp = alloca [4 x i8], align 1, !dbg !14 +// CHECK:STDOUT: %_.var.loc9 = alloca [4 x i8], align 1, !dbg !15 +// CHECK:STDOUT: %.loc12_65.1.temp = alloca [4 x i8], align 1, !dbg !16 +// CHECK:STDOUT: %_.var.loc13 = alloca [4 x i8], align 1, !dbg !17 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_65.1.temp), !dbg !14 +// CHECK:STDOUT: call void @_ZN26ImplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %.loc8_65.1.temp), !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var.loc9), !dbg !15 +// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.22b4681b019423d7"(ptr %_.var.loc9), !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_65.1.temp), !dbg !16 +// CHECK:STDOUT: call void @_ZN26ExplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %.loc12_65.1.temp), !dbg !16 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var.loc13), !dbg !17 +// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.1a27c303748a2360"(ptr %_.var.loc13), !dbg !17 +// CHECK:STDOUT: ret void, !dbg !18 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress nounwind uwtable -// CHECK:STDOUT: define dso_local void @_ZN26ImplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN26ImplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_ZN26ImplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %0) #3 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !19 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !19 +// CHECK:STDOUT: call void @_ZN26ImplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %0) #0 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_COp:thunk.ImplicitlyDefaultedDefault.Cpp"(ptr sret([4 x i8]) %return) #2 !dbg !22 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_ZN26ImplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %return), !dbg !27 +// CHECK:STDOUT: ret void, !dbg !27 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress nounwind uwtable +// CHECK:STDOUT: define internal void @_ZN26ExplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !28 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !28 +// CHECK:STDOUT: call void @_ZN26ExplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %0) #0 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_COp:thunk.ExplicitlyDefaultedDefault.Cpp"(ptr sret([4 x i8]) %return) #2 !dbg !30 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_ZN26ExplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %return), !dbg !31 +// CHECK:STDOUT: ret void, !dbg !31 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.22b4681b019423d7"(ptr sret([4 x i8]) %return) #0 !dbg !32 { +// CHECK:STDOUT: call void @"_COp:thunk.ImplicitlyDefaultedDefault.Cpp"(ptr %return), !dbg !34 +// CHECK:STDOUT: ret void, !dbg !35 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.1a27c303748a2360"(ptr sret([4 x i8]) %return) #0 !dbg !36 { +// CHECK:STDOUT: call void @"_COp:thunk.ExplicitlyDefaultedDefault.Cpp"(ptr %return), !dbg !37 +// CHECK:STDOUT: ret void, !dbg !38 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: inlinehint mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN26ImplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %this) unnamed_addr #1 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN26ImplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %this) unnamed_addr #4 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !19 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: %x_ = getelementptr inbounds nuw %struct.ImplicitlyDefaultedDefault, ptr %this1, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %x_, align 4, !tbaa !14 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress nounwind uwtable -// CHECK:STDOUT: define dso_local void @_ZN26ExplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !16 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !16 -// CHECK:STDOUT: call void @_ZN26ExplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %0) #3 +// CHECK:STDOUT: store i32 1, ptr %x_, align 4, !tbaa !39 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN26ExplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %this) unnamed_addr #2 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN26ExplicitlyDefaultedDefaultC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %this) unnamed_addr #5 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !16 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !28 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: %x_ = getelementptr inbounds nuw %struct.ExplicitlyDefaultedDefault, ptr %this1, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %x_, align 4, !tbaa !18 +// CHECK:STDOUT: store i32 1, ptr %x_, align 4, !tbaa !41 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CF.Main() #3 !dbg !20 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc8_65.1.temp = alloca [4 x i8], align 1, !dbg !23 -// CHECK:STDOUT: %_.var.loc9 = alloca [4 x i8], align 1, !dbg !24 -// CHECK:STDOUT: %.loc12_65.1.temp = alloca [4 x i8], align 1, !dbg !25 -// CHECK:STDOUT: %_.var.loc13 = alloca [4 x i8], align 1, !dbg !26 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_65.1.temp), !dbg !23 -// CHECK:STDOUT: call void @_ZN26ImplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %.loc8_65.1.temp), !dbg !23 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var.loc9), !dbg !24 -// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.22b4681b019423d7"(ptr %_.var.loc9), !dbg !24 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_65.1.temp), !dbg !25 -// CHECK:STDOUT: call void @_ZN26ExplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %.loc12_65.1.temp), !dbg !25 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var.loc13), !dbg !26 -// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.1a27c303748a2360"(ptr %_.var.loc13), !dbg !26 -// CHECK:STDOUT: ret void, !dbg !27 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind -// CHECK:STDOUT: define void @"_COp:thunk.ImplicitlyDefaultedDefault.Cpp"(ptr sret([4 x i8]) %return) #4 !dbg !28 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_ZN26ImplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %return), !dbg !33 -// CHECK:STDOUT: ret void, !dbg !33 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind -// CHECK:STDOUT: define void @"_COp:thunk.ExplicitlyDefaultedDefault.Cpp"(ptr sret([4 x i8]) %return) #4 !dbg !34 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_ZN26ExplicitlyDefaultedDefaultC1Ev.carbon_thunk(ptr %return), !dbg !35 -// CHECK:STDOUT: ret void, !dbg !35 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #5 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.22b4681b019423d7"(ptr sret([4 x i8]) %return) #3 !dbg !36 { -// CHECK:STDOUT: call void @"_COp:thunk.ImplicitlyDefaultedDefault.Cpp"(ptr %return), !dbg !38 -// CHECK:STDOUT: ret void, !dbg !39 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.1a27c303748a2360"(ptr sret([4 x i8]) %return) #3 !dbg !40 { -// CHECK:STDOUT: call void @"_COp:thunk.ExplicitlyDefaultedDefault.Cpp"(ptr %return), !dbg !41 -// CHECK:STDOUT: ret void, !dbg !42 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { nounwind } -// CHECK:STDOUT: attributes #4 = { alwaysinline nounwind } -// CHECK:STDOUT: attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -493,82 +492,82 @@ fn Four() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS26ImplicitlyDefaultedDefault", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !8, i64 0} -// CHECK:STDOUT: !15 = !{!"_ZTS26ImplicitlyDefaultedDefault", !8, i64 0} -// CHECK:STDOUT: !16 = !{!17, !17, i64 0} -// CHECK:STDOUT: !17 = !{!"p1 _ZTS26ExplicitlyDefaultedDefault", !13, i64 0} -// CHECK:STDOUT: !18 = !{!19, !8, i64 0} -// CHECK:STDOUT: !19 = !{!"_ZTS26ExplicitlyDefaultedDefault", !8, i64 0} -// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !21, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !21 = !DISubroutineType(types: !22) -// CHECK:STDOUT: !22 = !{null} -// CHECK:STDOUT: !23 = !DILocation(line: 8, column: 7, scope: !20) -// CHECK:STDOUT: !24 = !DILocation(line: 9, column: 3, scope: !20) -// CHECK:STDOUT: !25 = !DILocation(line: 12, column: 7, scope: !20) -// CHECK:STDOUT: !26 = !DILocation(line: 13, column: 3, scope: !20) -// CHECK:STDOUT: !27 = !DILocation(line: 6, column: 1, scope: !20) -// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.ImplicitlyDefaultedDefault.Cpp", scope: null, file: !29, line: 2, type: !30, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !29 = !DIFile(filename: "./defaulted_default.h", directory: "") -// CHECK:STDOUT: !30 = !DISubroutineType(types: !31) -// CHECK:STDOUT: !31 = !{!32} -// CHECK:STDOUT: !32 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !33 = !DILocation(line: 2, column: 8, scope: !28) -// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.ExplicitlyDefaultedDefault.Cpp", scope: null, file: !29, line: 7, type: !30, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !35 = !DILocation(line: 7, column: 3, scope: !34) -// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.22b4681b019423d7", scope: null, file: !37, line: 9, type: !30, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !37 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "") -// CHECK:STDOUT: !38 = !DILocation(line: 9, column: 28, scope: !36) -// CHECK:STDOUT: !39 = !DILocation(line: 9, column: 21, scope: !36) -// CHECK:STDOUT: !40 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.1a27c303748a2360", scope: null, file: !37, line: 9, type: !30, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !41 = !DILocation(line: 9, column: 28, scope: !40) -// CHECK:STDOUT: !42 = !DILocation(line: 9, column: 21, scope: !40) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 8, column: 7, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 9, column: 3, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 12, column: 7, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 13, column: 3, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !19 = !{!20, !20, i64 0} +// CHECK:STDOUT: !20 = !{!"p1 _ZTS26ImplicitlyDefaultedDefault", !21, i64 0} +// CHECK:STDOUT: !21 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.ImplicitlyDefaultedDefault.Cpp", scope: null, file: !23, line: 2, type: !24, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !23 = !DIFile(filename: "./defaulted_default.h", directory: "") +// CHECK:STDOUT: !24 = !DISubroutineType(types: !25) +// CHECK:STDOUT: !25 = !{!26} +// CHECK:STDOUT: !26 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !27 = !DILocation(line: 2, column: 8, scope: !22) +// CHECK:STDOUT: !28 = !{!29, !29, i64 0} +// CHECK:STDOUT: !29 = !{!"p1 _ZTS26ExplicitlyDefaultedDefault", !21, i64 0} +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.ExplicitlyDefaultedDefault.Cpp", scope: null, file: !23, line: 7, type: !24, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !31 = !DILocation(line: 7, column: 3, scope: !30) +// CHECK:STDOUT: !32 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.22b4681b019423d7", scope: null, file: !33, line: 9, type: !24, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !33 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "") +// CHECK:STDOUT: !34 = !DILocation(line: 9, column: 28, scope: !32) +// CHECK:STDOUT: !35 = !DILocation(line: 9, column: 21, scope: !32) +// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.1a27c303748a2360", scope: null, file: !33, line: 9, type: !24, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !37 = !DILocation(line: 9, column: 28, scope: !36) +// CHECK:STDOUT: !38 = !DILocation(line: 9, column: 21, scope: !36) +// CHECK:STDOUT: !39 = !{!40, !8, i64 0} +// CHECK:STDOUT: !40 = !{!"_ZTS26ImplicitlyDefaultedDefault", !8, i64 0} +// CHECK:STDOUT: !41 = !{!42, !8, i64 0} +// CHECK:STDOUT: !42 = !{!"_ZTS26ExplicitlyDefaultedDefault", !8, i64 0} // CHECK:STDOUT: ; ModuleID = 'call_copy.carbon' // CHECK:STDOUT: source_filename = "call_copy.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCopy.Main(ptr sret([4 x i8]) %return, ptr %c) #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7_10.1.temp = alloca [4 x i8], align 1, !dbg !17 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_10.1.temp), !dbg !17 +// CHECK:STDOUT: call void @_ZN4CopyC1ERKS_.carbon_thunk(ptr %c, ptr %return), !dbg !17 +// CHECK:STDOUT: ret void, !dbg !18 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN4CopyC1ERKS_.carbon_thunk(ptr noundef %0, ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN4CopyC1ERKS_.carbon_thunk(ptr noundef %0, ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %2 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !19 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !19 +// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !19 +// CHECK:STDOUT: %2 = load ptr, ptr %.addr, align 8, !tbaa !19 // CHECK:STDOUT: call void @_ZN4CopyC1ERKS_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZN4CopyC1ERKS_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CCopy.Main(ptr sret([4 x i8]) %return, ptr %c) #2 !dbg !14 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_10.1.temp = alloca [4 x i8], align 1, !dbg !20 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_10.1.temp), !dbg !20 -// CHECK:STDOUT: call void @_ZN4CopyC1ERKS_.carbon_thunk(ptr %c, ptr %return), !dbg !20 -// CHECK:STDOUT: ret void, !dbg !21 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind -// CHECK:STDOUT: define void @"_COp:thunk.Copy.Cpp"(ptr sret([4 x i8]) %return, ptr %self) #3 !dbg !22 { +// CHECK:STDOUT: define void @"_COp:thunk.Copy.Cpp"(ptr sret([4 x i8]) %return, ptr %self) #2 !dbg !22 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_ZN4CopyC1ERKS_.carbon_thunk(ptr %self, ptr %return), !dbg !26 // CHECK:STDOUT: ret void, !dbg !26 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { alwaysinline nounwind } -// CHECK:STDOUT: attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: declare void @_ZN4CopyC1ERKS_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -585,21 +584,21 @@ fn Four() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS4Copy", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "Copy", linkageName: "_CCopy.Main", scope: null, file: !6, line: 6, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !18) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{!17, !17} -// CHECK:STDOUT: !17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !18 = !{!19} -// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !14, type: !17) -// CHECK:STDOUT: !20 = !DILocation(line: 7, column: 10, scope: !14) -// CHECK:STDOUT: !21 = !DILocation(line: 7, column: 3, scope: !14) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Copy.Cpp", scope: null, file: !23, line: 5, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !24) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Copy", linkageName: "_CCopy.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !15) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{!14, !14} +// CHECK:STDOUT: !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !15 = !{!16} +// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !14) +// CHECK:STDOUT: !17 = !DILocation(line: 7, column: 10, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !19 = !{!20, !20, i64 0} +// CHECK:STDOUT: !20 = !{!"p1 _ZTS4Copy", !21, i64 0} +// CHECK:STDOUT: !21 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Copy.Cpp", scope: null, file: !23, line: 5, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !24) // CHECK:STDOUT: !23 = !DIFile(filename: "./copy.h", directory: "") // CHECK:STDOUT: !24 = !{!25} -// CHECK:STDOUT: !25 = !DILocalVariable(arg: 1, scope: !22, type: !17) +// CHECK:STDOUT: !25 = !DILocalVariable(arg: 1, scope: !22, type: !14) // CHECK:STDOUT: !26 = !DILocation(line: 5, column: 3, scope: !22) // CHECK:STDOUT: ; ModuleID = 'call_c1_in_thunk.carbon' // CHECK:STDOUT: source_filename = "call_c1_in_thunk.carbon" @@ -629,45 +628,45 @@ fn Four() { // CHECK:STDOUT: @_ZTVN10__cxxabiv117__class_type_infoE = external global [0 x ptr] // CHECK:STDOUT: @_ZTS4Base = linkonce_odr dso_local constant [6 x i8] c"4Base\00", comdat, align 1 // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CF.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7_44.1.temp = alloca [8 x i8], align 1, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_44.1.temp), !dbg !14 +// CHECK:STDOUT: call void @_ZN7DerivedC1Ev.carbon_thunk(ptr %.loc7_44.1.temp), !dbg !14 +// CHECK:STDOUT: ret void, !dbg !15 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress nounwind uwtable -// CHECK:STDOUT: define dso_local void @_ZN7DerivedC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN7DerivedC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_ZN7DerivedC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #2 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !16 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !16 +// CHECK:STDOUT: call void @_ZN7DerivedC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #0 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: inlinehint mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN7DerivedC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %this) unnamed_addr #1 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr] }, ptr @_ZTV7Derived, i32 0, i32 0, i32 3), ptr %this1, align 8, !tbaa !14 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CF.Main() #2 !dbg !16 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_44.1.temp = alloca [8 x i8], align 1, !dbg !19 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_44.1.temp), !dbg !19 -// CHECK:STDOUT: call void @_ZN7DerivedC1Ev.carbon_thunk(ptr %.loc7_44.1.temp), !dbg !19 -// CHECK:STDOUT: ret void, !dbg !20 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: inlinehint mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN7DerivedC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %this) unnamed_addr #3 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !16 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr] }, ptr @_ZTV7Derived, i32 0, i32 0, i32 3), ptr %this1, align 8, !tbaa !19 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr] }, ptr @_ZTV7Derived, i32 0, i32 0, i32 3), { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -684,16 +683,16 @@ fn Four() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS7Derived", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"vtable pointer", !10, i64 0} -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !17, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !17 = !DISubroutineType(types: !18) -// CHECK:STDOUT: !18 = !{null} -// CHECK:STDOUT: !19 = !DILocation(line: 7, column: 24, scope: !16) -// CHECK:STDOUT: !20 = !DILocation(line: 6, column: 1, scope: !16) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 24, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !16 = !{!17, !17, i64 0} +// CHECK:STDOUT: !17 = !{!"p1 _ZTS7Derived", !18, i64 0} +// CHECK:STDOUT: !18 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !19 = !{!20, !20, i64 0} +// CHECK:STDOUT: !20 = !{!"vtable pointer", !10, i64 0} // CHECK:STDOUT: ; ModuleID = 'call_multi_argument.carbon' // CHECK:STDOUT: source_filename = "call_multi_argument.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" @@ -707,230 +706,40 @@ fn Four() { // CHECK:STDOUT: // CHECK:STDOUT: $_ZN1CC2Eiiii = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CZero.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #1 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void +// CHECK:STDOUT: %.loc7_26.1.temp = alloca [1 x i8], align 1, !dbg !14 +// CHECK:STDOUT: %.loc8_19.2.temp = alloca [1 x i8], align 1, !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_26.1.temp), !dbg !14 +// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %.loc7_26.1.temp), !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_19.2.temp), !dbg !15 +// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk_tuple(ptr %.loc8_19.2.temp), !dbg !15 +// CHECK:STDOUT: ret void, !dbg !16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk_tuple(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !17 // CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ei.carbon_thunk(i32 noundef %0, ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1CC1Ev.carbon_thunk_tuple(ptr noundef %return) #1 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %2 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %2) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %this, i32 noundef %0) unnamed_addr #1 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ei.carbon_thunk_tuple(i32 noundef %0, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %2 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %2) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Eii.carbon_thunk(i32 noundef %0, i32 noundef %1, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %2 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %3 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %4 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Eii(ptr noundef nonnull align 1 dereferenceable(1) %2, i32 noundef %3, i32 noundef %4) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Eii(ptr noundef nonnull align 1 dereferenceable(1) %this, i32 noundef %0, i32 noundef %1) unnamed_addr #1 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: %this2 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Eii.carbon_thunk_tuple(i32 noundef %0, i32 noundef %1, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %2 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %3 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %4 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Eii(ptr noundef nonnull align 1 dereferenceable(1) %2, i32 noundef %3, i32 noundef %4) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Eiiii.carbon_thunk3(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %.addr2 = alloca i32, align 4 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %3 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %4 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %5 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: %6 = load i32, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef 0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %this, i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) unnamed_addr #1 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %.addr2 = alloca i32, align 4 -// CHECK:STDOUT: %.addr3 = alloca i32, align 4 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %3, ptr %.addr3, align 4, !tbaa !7 -// CHECK:STDOUT: %this4 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Eiiii.carbon_thunk_tuple3(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %.addr2 = alloca i32, align 4 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %3 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %4 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %5 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: %6 = load i32, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef 0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Eiiii.carbon_thunk(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %.addr2 = alloca i32, align 4 -// CHECK:STDOUT: %.addr3 = alloca i32, align 4 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %3, ptr %.addr3, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %4 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %5 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %6 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: %7 = load i32, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: %8 = load i32, ptr %.addr3, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Eiiii.carbon_thunk_tuple(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca i32, align 4 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %.addr2 = alloca i32, align 4 -// CHECK:STDOUT: %.addr3 = alloca i32, align 4 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %3, ptr %.addr3, align 4, !tbaa !7 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %4 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %5 = load i32, ptr %.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %6 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: %7 = load i32, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: %8 = load i32, ptr %.addr3, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8) +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CZero.Main() #2 !dbg !14 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_26.1.temp = alloca [1 x i8], align 1, !dbg !17 -// CHECK:STDOUT: %.loc8_19.2.temp = alloca [1 x i8], align 1, !dbg !18 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_26.1.temp), !dbg !17 -// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %.loc7_26.1.temp), !dbg !17 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_19.2.temp), !dbg !18 -// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk_tuple(ptr %.loc8_19.2.temp), !dbg !18 -// CHECK:STDOUT: ret void, !dbg !19 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_COne.Main() #2 !dbg !20 { +// CHECK:STDOUT: define void @_COne.Main() #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc12_27.1.temp = alloca [1 x i8], align 1, !dbg !21 // CHECK:STDOUT: %.loc13_18.1.temp = alloca [1 x i8], align 1, !dbg !22 @@ -944,8 +753,34 @@ fn Four() { // CHECK:STDOUT: ret void, !dbg !24 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Ei.carbon_thunk(i32 noundef %0, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %2 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %2) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Ei.carbon_thunk_tuple(i32 noundef %0, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %2 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %1, i32 noundef %2) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CTwo.Main() #2 !dbg !25 { +// CHECK:STDOUT: define void @_CTwo.Main() #0 !dbg !25 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_30.1.temp = alloca [1 x i8], align 1, !dbg !26 // CHECK:STDOUT: %.loc19_23.2.temp = alloca [1 x i8], align 1, !dbg !27 @@ -956,8 +791,40 @@ fn Four() { // CHECK:STDOUT: ret void, !dbg !28 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Eii.carbon_thunk(i32 noundef %0, i32 noundef %1, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %2 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %3 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %4 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Eii(ptr noundef nonnull align 1 dereferenceable(1) %2, i32 noundef %3, i32 noundef %4) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Eii.carbon_thunk_tuple(i32 noundef %0, i32 noundef %1, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %2 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %3 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %4 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Eii(ptr noundef nonnull align 1 dereferenceable(1) %2, i32 noundef %3, i32 noundef %4) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CThree.Main() #2 !dbg !29 { +// CHECK:STDOUT: define void @_CThree.Main() #0 !dbg !29 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc23_33.1.temp = alloca [1 x i8], align 1, !dbg !30 // CHECK:STDOUT: %.loc24_26.2.temp = alloca [1 x i8], align 1, !dbg !31 @@ -968,8 +835,46 @@ fn Four() { // CHECK:STDOUT: ret void, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Eiiii.carbon_thunk3(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %.addr2 = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %3 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %4 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %5 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: %6 = load i32, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef 0) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Eiiii.carbon_thunk_tuple3(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %.addr2 = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %3 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %4 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %5 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: %6 = load i32, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef 0) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CFour.Main() #2 !dbg !33 { +// CHECK:STDOUT: define void @_CFour.Main() #0 !dbg !33 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc28_36.1.temp = alloca [1 x i8], align 1, !dbg !34 // CHECK:STDOUT: %.loc29_29.2.temp = alloca [1 x i8], align 1, !dbg !35 @@ -980,20 +885,111 @@ fn Four() { // CHECK:STDOUT: ret void, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Eiiii.carbon_thunk(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %.addr2 = alloca i32, align 4 +// CHECK:STDOUT: %.addr3 = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %3, ptr %.addr3, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %4 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %5 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %6 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: %7 = load i32, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: %8 = load i32, ptr %.addr3, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN1CC1Eiiii.carbon_thunk_tuple(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %.addr2 = alloca i32, align 4 +// CHECK:STDOUT: %.addr3 = alloca i32, align 4 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %3, ptr %.addr3, align 4, !tbaa !7 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %4 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %5 = load i32, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %6 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: %7 = load i32, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: %8 = load i32, ptr %.addr3, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #3 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Ei(ptr noundef nonnull align 1 dereferenceable(1) %this, i32 noundef %0) unnamed_addr #3 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !17 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Eii(ptr noundef nonnull align 1 dereferenceable(1) %this, i32 noundef %0, i32 noundef %1) unnamed_addr #3 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !17 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: %this2 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1CC2Eiiii(ptr noundef nonnull align 1 dereferenceable(1) %this, i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) unnamed_addr #3 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: %.addr = alloca i32, align 4 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %.addr2 = alloca i32, align 4 +// CHECK:STDOUT: %.addr3 = alloca i32, align 4 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !17 +// CHECK:STDOUT: store i32 %0, ptr %.addr, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %3, ptr %.addr3, align 4, !tbaa !7 +// CHECK:STDOUT: %this4 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives -// CHECK:STDOUT: uselistorder ptr @_ZN1CC2Ev, { 1, 0 } -// CHECK:STDOUT: uselistorder ptr @_ZN1CC2Ei, { 1, 0 } -// CHECK:STDOUT: uselistorder ptr @_ZN1CC2Eii, { 1, 0 } -// CHECK:STDOUT: uselistorder ptr @_ZN1CC2Eiiii, { 3, 2, 1, 0 } +// CHECK:STDOUT: uselistorder ptr @_ZN1CC1Ei.carbon_thunk, { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -1010,29 +1006,29 @@ fn Four() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "Zero", linkageName: "_CZero.Main", scope: null, file: !6, line: 6, type: !15, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{null} -// CHECK:STDOUT: !17 = !DILocation(line: 7, column: 18, scope: !14) -// CHECK:STDOUT: !18 = !DILocation(line: 8, column: 18, scope: !14) -// CHECK:STDOUT: !19 = !DILocation(line: 6, column: 1, scope: !14) -// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "One", linkageName: "_COne.Main", scope: null, file: !6, line: 11, type: !15, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Zero", linkageName: "_CZero.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 18, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 8, column: 18, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !17 = !{!18, !18, i64 0} +// CHECK:STDOUT: !18 = !{!"p1 _ZTS1C", !19, i64 0} +// CHECK:STDOUT: !19 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "One", linkageName: "_COne.Main", scope: null, file: !6, line: 11, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !21 = !DILocation(line: 12, column: 18, scope: !20) // CHECK:STDOUT: !22 = !DILocation(line: 13, column: 18, scope: !20) // CHECK:STDOUT: !23 = !DILocation(line: 14, column: 18, scope: !20) // CHECK:STDOUT: !24 = !DILocation(line: 11, column: 1, scope: !20) -// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Two", linkageName: "_CTwo.Main", scope: null, file: !6, line: 17, type: !15, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Two", linkageName: "_CTwo.Main", scope: null, file: !6, line: 17, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !26 = !DILocation(line: 18, column: 18, scope: !25) // CHECK:STDOUT: !27 = !DILocation(line: 19, column: 18, scope: !25) // CHECK:STDOUT: !28 = !DILocation(line: 17, column: 1, scope: !25) -// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Three", linkageName: "_CThree.Main", scope: null, file: !6, line: 22, type: !15, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Three", linkageName: "_CThree.Main", scope: null, file: !6, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !30 = !DILocation(line: 23, column: 18, scope: !29) // CHECK:STDOUT: !31 = !DILocation(line: 24, column: 18, scope: !29) // CHECK:STDOUT: !32 = !DILocation(line: 22, column: 1, scope: !29) -// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "Four", linkageName: "_CFour.Main", scope: null, file: !6, line: 27, type: !15, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "Four", linkageName: "_CFour.Main", scope: null, file: !6, line: 27, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !34 = !DILocation(line: 28, column: 18, scope: !33) // CHECK:STDOUT: !35 = !DILocation(line: 29, column: 18, scope: !33) // CHECK:STDOUT: !36 = !DILocation(line: 27, column: 1, scope: !33) diff --git a/toolchain/lower/testdata/interop/cpp/extern_c.carbon b/toolchain/lower/testdata/interop/cpp/extern_c.carbon index cdbcee2269ea..2480c2ca3de4 100644 --- a/toolchain/lower/testdata/interop/cpp/extern_c.carbon +++ b/toolchain/lower/testdata/interop/cpp/extern_c.carbon @@ -224,8 +224,15 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: %struct.X = type { i8 } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main(ptr sret({}) %return, ptr %a, ptr %b) #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_Zpl1XS_.carbon_thunk(ptr %a, ptr %b, ptr %return), !dbg !18 +// CHECK:STDOUT: ret void, !dbg !19 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Zpl1XS_.carbon_thunk(ptr noundef %0, ptr noundef %1, ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_Zpl1XS_.carbon_thunk(ptr noundef %0, ptr noundef %1, ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %.addr1 = alloca ptr, align 8 @@ -233,28 +240,21 @@ fn MyF() { // CHECK:STDOUT: %agg.tmp = alloca %struct.X, align 1 // CHECK:STDOUT: %agg.tmp2 = alloca %struct.X, align 1 // CHECK:STDOUT: %undef.agg.tmp = alloca %struct.X, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %1, ptr %.addr1, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %2 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %3 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %4 = load ptr, ptr %.addr1, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !20 +// CHECK:STDOUT: store ptr %1, ptr %.addr1, align 8, !tbaa !20 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !20 +// CHECK:STDOUT: %2 = load ptr, ptr %return.addr, align 8, !tbaa !20 +// CHECK:STDOUT: %3 = load ptr, ptr %.addr, align 8, !tbaa !20 +// CHECK:STDOUT: %4 = load ptr, ptr %.addr1, align 8, !tbaa !20 // CHECK:STDOUT: call void @_Zpl1XS_() // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Zpl1XS_() #1 +// CHECK:STDOUT: declare void @_Zpl1XS_() #2 // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CMyF.Main(ptr sret({}) %return, ptr %a, ptr %b) #2 !dbg !14 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_Zpl1XS_.carbon_thunk(ptr %a, ptr %b, ptr %return), !dbg !21 -// CHECK:STDOUT: ret void, !dbg !22 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -271,18 +271,18 @@ fn MyF() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1X", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "MyF", linkageName: "_CMyF.Main", scope: null, file: !6, line: 6, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !18) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{!17, !17, !17} -// CHECK:STDOUT: !17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !18 = !{!19, !20} -// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !14, type: !17) -// CHECK:STDOUT: !20 = !DILocalVariable(arg: 2, scope: !14, type: !17) -// CHECK:STDOUT: !21 = !DILocation(line: 7, column: 10, scope: !14) -// CHECK:STDOUT: !22 = !DILocation(line: 7, column: 3, scope: !14) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "MyF", linkageName: "_CMyF.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !15) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{!14, !14, !14} +// CHECK:STDOUT: !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !15 = !{!16, !17} +// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !14) +// CHECK:STDOUT: !17 = !DILocalVariable(arg: 2, scope: !11, type: !14) +// CHECK:STDOUT: !18 = !DILocation(line: 7, column: 10, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !20 = !{!21, !21, i64 0} +// CHECK:STDOUT: !21 = !{!"p1 _ZTS1X", !22, i64 0} +// CHECK:STDOUT: !22 = !{!"any pointer", !9, i64 0} // CHECK:STDOUT: ; ModuleID = 'import_extern_c_with_asm_label.carbon' // CHECK:STDOUT: source_filename = "import_extern_c_with_asm_label.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" diff --git a/toolchain/lower/testdata/interop/cpp/function_decl.carbon b/toolchain/lower/testdata/interop/cpp/function_decl.carbon index 289e647a8581..8d2301d3de7c 100644 --- a/toolchain/lower/testdata/interop/cpp/function_decl.carbon +++ b/toolchain/lower/testdata/interop/cpp/function_decl.carbon @@ -381,46 +381,8 @@ fn MyF() -> i32 { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z13NoReturnValueii.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_Z13NoReturnValueii(i32 noundef 1, i32 noundef 2) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z13NoReturnValueii(i32 noundef, i32 noundef) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z13NoReturnValueii.carbon_thunk1(i32 noundef %a) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.addr = alloca i32, align 4 -// CHECK:STDOUT: store i32 %a, ptr %a.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %0 = load i32, ptr %a.addr, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_Z13NoReturnValueii(i32 noundef %0, i32 noundef 2) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef i32 @_Z17SimpleReturnValueii.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %call = call noundef i32 @_Z17SimpleReturnValueii(i32 noundef 1, i32 noundef 2) -// CHECK:STDOUT: ret i32 %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef i32 @_Z17SimpleReturnValueii(i32 noundef, i32 noundef) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef i32 @_Z17SimpleReturnValueii.carbon_thunk1(i32 noundef %a) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.addr = alloca i32, align 4 -// CHECK:STDOUT: store i32 %a, ptr %a.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %0 = load i32, ptr %a.addr, align 4, !tbaa !7 -// CHECK:STDOUT: %call = call noundef i32 @_Z17SimpleReturnValueii(i32 noundef %0, i32 noundef 2) -// CHECK:STDOUT: ret i32 %call -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CMyF.Main() #2 !dbg !11 { +// CHECK:STDOUT: define i32 @_CMyF.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %value.var = alloca i32, align 4, !dbg !15 // CHECK:STDOUT: call void @_Z13NoReturnValueii.carbon_thunk0(), !dbg !16 @@ -438,8 +400,46 @@ fn MyF() -> i32 { // CHECK:STDOUT: ret i32 %.loc14, !dbg !25 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z13NoReturnValueii.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_Z13NoReturnValueii(i32 noundef 1, i32 noundef 2) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z13NoReturnValueii.carbon_thunk1(i32 noundef %a) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.addr = alloca i32, align 4 +// CHECK:STDOUT: store i32 %a, ptr %a.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %0 = load i32, ptr %a.addr, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_Z13NoReturnValueii(i32 noundef %0, i32 noundef 2) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z13NoReturnValueii(i32 noundef, i32 noundef) #2 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef i32 @_Z17SimpleReturnValueii.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %call = call noundef i32 @_Z17SimpleReturnValueii(i32 noundef 1, i32 noundef 2) +// CHECK:STDOUT: ret i32 %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef i32 @_Z17SimpleReturnValueii.carbon_thunk1(i32 noundef %a) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %a.addr = alloca i32, align 4 +// CHECK:STDOUT: store i32 %a, ptr %a.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %0 = load i32, ptr %a.addr, align 4, !tbaa !7 +// CHECK:STDOUT: %call = call noundef i32 @_Z17SimpleReturnValueii(i32 noundef %0, i32 noundef 2) +// CHECK:STDOUT: ret i32 %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef i32 @_Z17SimpleReturnValueii(i32 noundef, i32 noundef) #2 +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #2 !dbg !26 { +// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !26 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !31 // CHECK:STDOUT: } @@ -447,9 +447,13 @@ fn MyF() -> i32 { // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder ptr @_Z13NoReturnValueii, { 2, 1, 0 } +// CHECK:STDOUT: uselistorder ptr @_Z17SimpleReturnValueii, { 2, 1, 0 } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} diff --git a/toolchain/lower/testdata/interop/cpp/method.carbon b/toolchain/lower/testdata/interop/cpp/method.carbon index d91ee27b3107..836d13a5037c 100644 --- a/toolchain/lower/testdata/interop/cpp/method.carbon +++ b/toolchain/lower/testdata/interop/cpp/method.carbon @@ -83,37 +83,37 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: // CHECK:STDOUT: $_ZNK1A6by_valEv = comdat any // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CUseVal.Main(ptr %a) #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %by_val__carbon_thunk.call = call i32 @_ZNK1A6by_valEv.carbon_thunk(ptr %a), !dbg !18 +// CHECK:STDOUT: ret i32 %by_val__carbon_thunk.call, !dbg !19 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef i32 @_ZNK1A6by_valEv.carbon_thunk(ptr noundef nonnull align 8 dereferenceable(12) %this) #0 { +// CHECK:STDOUT: define internal noundef i32 @_ZNK1A6by_valEv.carbon_thunk(ptr noundef nonnull align 8 dereferenceable(12) %this) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %this.addr, align 8, !tbaa !11, !nonnull !14, !align !15 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !20 +// CHECK:STDOUT: %0 = load ptr, ptr %this.addr, align 8, !tbaa !20, !nonnull !23, !align !24 // CHECK:STDOUT: %call = call noundef i32 @_ZNK1A6by_valEv(ptr noundef nonnull align 8 dereferenceable(12) %0) // CHECK:STDOUT: ret i32 %call // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local noundef i32 @_ZNK1A6by_valEv(ptr noundef nonnull align 8 dereferenceable(12) %this) #1 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local noundef i32 @_ZNK1A6by_valEv(ptr noundef nonnull align 8 dereferenceable(12) %this) #2 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !20 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: %n = getelementptr inbounds nuw %struct.A, ptr %this1, i32 0, i32 1 -// CHECK:STDOUT: %0 = load i32, ptr %n, align 8, !tbaa !16 +// CHECK:STDOUT: %0 = load i32, ptr %n, align 8, !tbaa !25 // CHECK:STDOUT: ret i32 %0 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CUseVal.Main(ptr %a) #2 !dbg !19 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %by_val__carbon_thunk.call = call i32 @_ZNK1A6by_valEv.carbon_thunk(ptr %a), !dbg !26 -// CHECK:STDOUT: ret i32 %by_val__carbon_thunk.call, !dbg !27 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -130,23 +130,23 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1A", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{} -// CHECK:STDOUT: !15 = !{i64 8} -// CHECK:STDOUT: !16 = !{!17, !8, i64 8} -// CHECK:STDOUT: !17 = !{!"_ZTS1A", !18, i64 0, !8, i64 8} -// CHECK:STDOUT: !18 = !{!"_ZTS4Base"} -// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "UseVal", linkageName: "_CUseVal.Main", scope: null, file: !6, line: 6, type: !20, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !24) -// CHECK:STDOUT: !20 = !DISubroutineType(types: !21) -// CHECK:STDOUT: !21 = !{!22, !23} -// CHECK:STDOUT: !22 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -// CHECK:STDOUT: !23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !24 = !{!25} -// CHECK:STDOUT: !25 = !DILocalVariable(arg: 1, scope: !19, type: !23) -// CHECK:STDOUT: !26 = !DILocation(line: 7, column: 10, scope: !19) -// CHECK:STDOUT: !27 = !DILocation(line: 7, column: 3, scope: !19) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "UseVal", linkageName: "_CUseVal.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !16) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{!14, !15} +// CHECK:STDOUT: !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +// CHECK:STDOUT: !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !16 = !{!17} +// CHECK:STDOUT: !17 = !DILocalVariable(arg: 1, scope: !11, type: !15) +// CHECK:STDOUT: !18 = !DILocation(line: 7, column: 10, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !20 = !{!21, !21, i64 0} +// CHECK:STDOUT: !21 = !{!"p1 _ZTS1A", !22, i64 0} +// CHECK:STDOUT: !22 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !23 = !{} +// CHECK:STDOUT: !24 = !{i64 8} +// CHECK:STDOUT: !25 = !{!26, !8, i64 8} +// CHECK:STDOUT: !26 = !{!"_ZTS1A", !27, i64 0, !8, i64 8} +// CHECK:STDOUT: !27 = !{!"_ZTS4Base"} // CHECK:STDOUT: ; ModuleID = 'call_by_ref.carbon' // CHECK:STDOUT: source_filename = "call_by_ref.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" @@ -268,70 +268,70 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: // CHECK:STDOUT: @int_1.30e = internal constant i8 1 // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall.Main(ptr %n) #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7_14.3.temp = alloca i8, align 1, !dbg !17 +// CHECK:STDOUT: %.loc8_14.3.temp = alloca i8, align 1, !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_14.3.temp), !dbg !17 +// CHECK:STDOUT: call void @_ZNK9NeedThunk8ImplicitEa.carbon_thunk(ptr %n, ptr @int_1.30e), !dbg !19 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_14.3.temp), !dbg !18 +// CHECK:STDOUT: call void @_ZNH9NeedThunk8ExplicitES_a.carbon_thunk(ptr %n, ptr @int_1.30e), !dbg !20 +// CHECK:STDOUT: call void @"_COp.43bece552030817c:core.Destroy.Core"(ptr @int_1.30e), !dbg !18 +// CHECK:STDOUT: call void @"_COp.43bece552030817c:core.Destroy.Core"(ptr @int_1.30e), !dbg !17 +// CHECK:STDOUT: ret void, !dbg !21 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZNK9NeedThunk8ImplicitEa.carbon_thunk(ptr noundef nonnull align 1 dereferenceable(1) %this, ptr noundef %c) #0 { +// CHECK:STDOUT: define internal void @_ZNK9NeedThunk8ImplicitEa.carbon_thunk(ptr noundef nonnull align 1 dereferenceable(1) %this, ptr noundef %c) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 // CHECK:STDOUT: %c.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %c, ptr %c.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %0 = load ptr, ptr %this.addr, align 8, !tbaa !11, !nonnull !16 -// CHECK:STDOUT: %1 = load ptr, ptr %c.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %2 = load i8, ptr %1, align 1, !tbaa !17 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !22 +// CHECK:STDOUT: store ptr %c, ptr %c.addr, align 8, !tbaa !25 +// CHECK:STDOUT: %0 = load ptr, ptr %this.addr, align 8, !tbaa !22, !nonnull !27 +// CHECK:STDOUT: %1 = load ptr, ptr %c.addr, align 8, !tbaa !25 +// CHECK:STDOUT: %2 = load i8, ptr %1, align 1, !tbaa !28 // CHECK:STDOUT: call void @_ZNK9NeedThunk8ImplicitEa(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef signext %2) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZNK9NeedThunk8ImplicitEa(ptr noundef nonnull align 1 dereferenceable(1), i8 noundef signext) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZNH9NeedThunk8ExplicitES_a.carbon_thunk(ptr noundef %0, ptr noundef %c) #0 { +// CHECK:STDOUT: define internal void @_ZNH9NeedThunk8ExplicitES_a.carbon_thunk(ptr noundef %0, ptr noundef %c) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %c.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %struct.NeedThunk, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %c, ptr %c.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %2 = load ptr, ptr %c.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %3 = load i8, ptr %2, align 1, !tbaa !17 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !22 +// CHECK:STDOUT: store ptr %c, ptr %c.addr, align 8, !tbaa !25 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !22 +// CHECK:STDOUT: %2 = load ptr, ptr %c.addr, align 8, !tbaa !25 +// CHECK:STDOUT: %3 = load i8, ptr %2, align 1, !tbaa !28 // CHECK:STDOUT: call void @_ZNH9NeedThunk8ExplicitES_a(i8 noundef signext %3) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZNH9NeedThunk8ExplicitES_a(i8 noundef signext) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CCall.Main(ptr %n) #2 !dbg !18 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_14.3.temp = alloca i8, align 1, !dbg !24 -// CHECK:STDOUT: %.loc8_14.3.temp = alloca i8, align 1, !dbg !25 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_14.3.temp), !dbg !24 -// CHECK:STDOUT: call void @_ZNK9NeedThunk8ImplicitEa.carbon_thunk(ptr %n, ptr @int_1.30e), !dbg !26 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc8_14.3.temp), !dbg !25 -// CHECK:STDOUT: call void @_ZNH9NeedThunk8ExplicitES_a.carbon_thunk(ptr %n, ptr @int_1.30e), !dbg !27 -// CHECK:STDOUT: call void @"_COp.43bece552030817c:core.Destroy.Core"(ptr @int_1.30e), !dbg !25 -// CHECK:STDOUT: call void @"_COp.43bece552030817c:core.Destroy.Core"(ptr @int_1.30e), !dbg !24 -// CHECK:STDOUT: ret void, !dbg !28 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.43bece552030817c:core.Destroy.Core"(ptr %self) #2 !dbg !29 { +// CHECK:STDOUT: define weak_odr void @"_COp.43bece552030817c:core.Destroy.Core"(ptr %self) #0 !dbg !29 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !35 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_ZNK9NeedThunk8ImplicitEa(ptr noundef nonnull align 1 dereferenceable(1), i8 noundef signext) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_ZNH9NeedThunk8ExplicitES_a(i8 noundef signext) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @"_COp.43bece552030817c:core.Destroy.Core", { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -348,24 +348,24 @@ fn Call(n: Cpp.NeedThunk) { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS9NeedThunk", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"p1 omnipotent char", !13, i64 0} -// CHECK:STDOUT: !16 = !{} -// CHECK:STDOUT: !17 = !{!9, !9, i64 0} -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "Call", linkageName: "_CCall.Main", scope: null, file: !6, line: 6, type: !19, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !22) -// CHECK:STDOUT: !19 = !DISubroutineType(types: !20) -// CHECK:STDOUT: !20 = !{null, !21} -// CHECK:STDOUT: !21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !22 = !{!23} -// CHECK:STDOUT: !23 = !DILocalVariable(arg: 1, scope: !18, type: !21) -// CHECK:STDOUT: !24 = !DILocation(line: 7, column: 14, scope: !18) -// CHECK:STDOUT: !25 = !DILocation(line: 8, column: 14, scope: !18) -// CHECK:STDOUT: !26 = !DILocation(line: 7, column: 3, scope: !18) -// CHECK:STDOUT: !27 = !DILocation(line: 8, column: 3, scope: !18) -// CHECK:STDOUT: !28 = !DILocation(line: 6, column: 1, scope: !18) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Call", linkageName: "_CCall.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !15) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null, !14} +// CHECK:STDOUT: !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !15 = !{!16} +// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !14) +// CHECK:STDOUT: !17 = !DILocation(line: 7, column: 14, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 8, column: 14, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !20 = !DILocation(line: 8, column: 3, scope: !11) +// CHECK:STDOUT: !21 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !22 = !{!23, !23, i64 0} +// CHECK:STDOUT: !23 = !{!"p1 _ZTS9NeedThunk", !24, i64 0} +// CHECK:STDOUT: !24 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !25 = !{!26, !26, i64 0} +// CHECK:STDOUT: !26 = !{!"p1 omnipotent char", !24, i64 0} +// CHECK:STDOUT: !27 = !{} +// CHECK:STDOUT: !28 = !{!9, !9, i64 0} // CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Op", linkageName: "_COp.43bece552030817c:core.Destroy.Core", scope: null, file: !6, line: 8, type: !30, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !33) // CHECK:STDOUT: !30 = !DISubroutineType(types: !31) // CHECK:STDOUT: !31 = !{null, !32} diff --git a/toolchain/lower/testdata/interop/cpp/nullptr.carbon b/toolchain/lower/testdata/interop/cpp/nullptr.carbon index a4e0bfe98c7b..a12a177ebcf0 100644 --- a/toolchain/lower/testdata/interop/cpp/nullptr.carbon +++ b/toolchain/lower/testdata/interop/cpp/nullptr.carbon @@ -54,106 +54,102 @@ fn ConvertNullptrConstant() -> Core.Optional(i32*) { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z11TakeNullptrDn.carbon_thunk(ptr noundef %n) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %n.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %n, ptr %n.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %n.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_Z11TakeNullptrDn(ptr null) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11TakeNullptrDn(ptr) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z13ReturnNullptrv.carbon_thunk(ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %call = call ptr @_Z13ReturnNullptrv() -// CHECK:STDOUT: store ptr %call, ptr %0, align 8, !tbaa !14 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare ptr @_Z13ReturnNullptrv() #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassNullptr.Main() #2 !dbg !16 { +// CHECK:STDOUT: define void @_CPassNullptr.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_18.2.temp = alloca ptr, align 8, !dbg !19 -// CHECK:STDOUT: %.loc14_22.1.temp = alloca ptr, align 8, !dbg !20 -// CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4"(ptr poison), !dbg !19 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_18.2.temp), !dbg !19 -// CHECK:STDOUT: store ptr %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call, ptr %.loc12_18.2.temp, align 8, !dbg !19 -// CHECK:STDOUT: %.loc12_18.4 = load ptr, ptr %.loc12_18.2.temp, align 8, !dbg !19 -// CHECK:STDOUT: call void @_Z7TakePtrPi(ptr %.loc12_18.4), !dbg !21 -// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr poison), !dbg !20 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc14_22.1.temp), !dbg !20 -// CHECK:STDOUT: store ptr %Cpp.nullptr_t.as.Copy.impl.Op.call, ptr %.loc14_22.1.temp, align 8, !dbg !20 -// CHECK:STDOUT: call void @_Z11TakeNullptrDn.carbon_thunk(ptr %.loc14_22.1.temp), !dbg !22 -// CHECK:STDOUT: call void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %.loc14_22.1.temp), !dbg !20 -// CHECK:STDOUT: call void @"_COp.dc33c1983710215f:core.Destroy.Core"(ptr %.loc12_18.2.temp), !dbg !19 -// CHECK:STDOUT: ret void, !dbg !23 +// CHECK:STDOUT: %.loc12_18.2.temp = alloca ptr, align 8, !dbg !14 +// CHECK:STDOUT: %.loc14_22.1.temp = alloca ptr, align 8, !dbg !15 +// CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4"(ptr poison), !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_18.2.temp), !dbg !14 +// CHECK:STDOUT: store ptr %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call, ptr %.loc12_18.2.temp, align 8, !dbg !14 +// CHECK:STDOUT: %.loc12_18.4 = load ptr, ptr %.loc12_18.2.temp, align 8, !dbg !14 +// CHECK:STDOUT: call void @_Z7TakePtrPi(ptr %.loc12_18.4), !dbg !16 +// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr poison), !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc14_22.1.temp), !dbg !15 +// CHECK:STDOUT: store ptr %Cpp.nullptr_t.as.Copy.impl.Op.call, ptr %.loc14_22.1.temp, align 8, !dbg !15 +// CHECK:STDOUT: call void @_Z11TakeNullptrDn.carbon_thunk(ptr %.loc14_22.1.temp), !dbg !17 +// CHECK:STDOUT: call void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %.loc14_22.1.temp), !dbg !15 +// CHECK:STDOUT: call void @"_COp.dc33c1983710215f:core.Destroy.Core"(ptr %.loc12_18.2.temp), !dbg !14 +// CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z7TakePtrPi(ptr noundef) #1 // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z11TakeNullptrDn.carbon_thunk(ptr noundef %n) #2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %n.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %n, ptr %n.addr, align 8, !tbaa !19 +// CHECK:STDOUT: %0 = load ptr, ptr %n.addr, align 8, !tbaa !19 +// CHECK:STDOUT: call void @_Z11TakeNullptrDn(ptr null) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: declare ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %self) #2 !dbg !24 { +// CHECK:STDOUT: define weak_odr void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %self) #0 !dbg !22 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !30 +// CHECK:STDOUT: ret void, !dbg !28 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.ca2ce9262234b385:core.Destroy.Core"(ptr %self) #2 !dbg !31 { +// CHECK:STDOUT: define weak_odr void @"_COp.ca2ce9262234b385:core.Destroy.Core"(ptr %self) #0 !dbg !29 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !34 +// CHECK:STDOUT: ret void, !dbg !32 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.dc33c1983710215f:core.Destroy.Core"(ptr %self) #2 !dbg !35 { +// CHECK:STDOUT: define weak_odr void @"_COp.dc33c1983710215f:core.Destroy.Core"(ptr %self) #0 !dbg !33 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !38 +// CHECK:STDOUT: ret void, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnNullptr.Main() #2 !dbg !39 { +// CHECK:STDOUT: define ptr @_CReturnNullptr.Main() #0 !dbg !37 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr poison), !dbg !42 -// CHECK:STDOUT: ret ptr %Cpp.nullptr_t.as.Copy.impl.Op.call, !dbg !43 +// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr poison), !dbg !40 +// CHECK:STDOUT: ret ptr %Cpp.nullptr_t.as.Copy.impl.Op.call, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnNullptrCopy.Main() #2 !dbg !44 { +// CHECK:STDOUT: define ptr @_CReturnNullptrCopy.Main() #0 !dbg !42 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca ptr, align 8, !dbg !45 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !45 -// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call.loc22 = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr poison), !dbg !46 -// CHECK:STDOUT: store ptr %Cpp.nullptr_t.as.Copy.impl.Op.call.loc22, ptr %a.var, align 8, !dbg !45 -// CHECK:STDOUT: %.loc23 = load ptr, ptr %a.var, align 8, !dbg !47 -// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call.loc23 = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr %.loc23), !dbg !47 -// CHECK:STDOUT: call void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %a.var), !dbg !45 -// CHECK:STDOUT: ret ptr %Cpp.nullptr_t.as.Copy.impl.Op.call.loc23, !dbg !48 +// CHECK:STDOUT: %a.var = alloca ptr, align 8, !dbg !43 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !43 +// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call.loc22 = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr poison), !dbg !44 +// CHECK:STDOUT: store ptr %Cpp.nullptr_t.as.Copy.impl.Op.call.loc22, ptr %a.var, align 8, !dbg !43 +// CHECK:STDOUT: %.loc23 = load ptr, ptr %a.var, align 8, !dbg !45 +// CHECK:STDOUT: %Cpp.nullptr_t.as.Copy.impl.Op.call.loc23 = call ptr @"_COp.NullptrT.CppCompat.Core:Copy.Core"(ptr %.loc23), !dbg !45 +// CHECK:STDOUT: call void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %a.var), !dbg !43 +// CHECK:STDOUT: ret ptr %Cpp.nullptr_t.as.Copy.impl.Op.call.loc23, !dbg !46 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnConvertedNullptrIndirectly.Main() #2 !dbg !49 { +// CHECK:STDOUT: define ptr @_CReturnConvertedNullptrIndirectly.Main() #0 !dbg !47 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %a.var = alloca ptr, align 8, !dbg !50 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !50 -// CHECK:STDOUT: call void @_Z13ReturnNullptrv.carbon_thunk(ptr %a.var), !dbg !51 -// CHECK:STDOUT: %.loc28_10 = load ptr, ptr %a.var, align 8, !dbg !52 -// CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4"(ptr %.loc28_10), !dbg !53 -// CHECK:STDOUT: call void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %a.var), !dbg !50 -// CHECK:STDOUT: ret ptr %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call, !dbg !53 +// CHECK:STDOUT: %a.var = alloca ptr, align 8, !dbg !48 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %a.var), !dbg !48 +// CHECK:STDOUT: call void @_Z13ReturnNullptrv.carbon_thunk(ptr %a.var), !dbg !49 +// CHECK:STDOUT: %.loc28_10 = load ptr, ptr %a.var, align 8, !dbg !50 +// CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4"(ptr %.loc28_10), !dbg !51 +// CHECK:STDOUT: call void @"_COp.705e422c84320121:core.Destroy.Core"(ptr %a.var), !dbg !48 +// CHECK:STDOUT: ret ptr %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call, !dbg !51 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z13ReturnNullptrv.carbon_thunk(ptr noundef %return) #2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !19 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !19 +// CHECK:STDOUT: %call = call ptr @_Z13ReturnNullptrv() +// CHECK:STDOUT: store ptr %call, ptr %0, align 8, !tbaa !52 +// CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnConvertedNullptrDirectly.Main() #2 !dbg !54 { +// CHECK:STDOUT: define ptr @_CReturnConvertedNullptrDirectly.Main() #0 !dbg !54 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc32_28.1.temp = alloca ptr, align 8, !dbg !55 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc32_28.1.temp), !dbg !55 @@ -165,14 +161,14 @@ fn ConvertNullptrConstant() -> Core.Optional(i32*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CConvertNullptrConstant.Main() #2 !dbg !57 { +// CHECK:STDOUT: define ptr @_CConvertNullptrConstant.Main() #0 !dbg !57 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4"(ptr poison), !dbg !58 // CHECK:STDOUT: ret ptr %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call, !dbg !58 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4"(ptr %self) #2 !dbg !59 { +// CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4"(ptr %self) #0 !dbg !59 { // CHECK:STDOUT: %1 = call ptr @_CNone.Optional.Core.95809cda2a4fffc7(), !dbg !65 // CHECK:STDOUT: ret ptr %1, !dbg !66 // CHECK:STDOUT: } @@ -183,17 +179,21 @@ fn ConvertNullptrConstant() -> Core.Optional(i32*) { // CHECK:STDOUT: declare ptr @_CMake.NullptrT.CppCompat.Core() // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @_CNone.Optional.Core.95809cda2a4fffc7() #2 !dbg !67 { +// CHECK:STDOUT: define linkonce_odr ptr @_CNone.Optional.Core.95809cda2a4fffc7() #0 !dbg !67 { // CHECK:STDOUT: ret ptr null, !dbg !69 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z11TakeNullptrDn(ptr) #1 +// CHECK:STDOUT: +// CHECK:STDOUT: declare ptr @_Z13ReturnNullptrv() #1 +// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @"_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4", { 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } // CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} @@ -211,62 +211,62 @@ fn ConvertNullptrConstant() -> Core.Optional(i32*) { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 std::nullptr_t", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"std::nullptr_t", !9, i64 0} -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "PassNullptr", linkageName: "_CPassNullptr.Main", scope: null, file: !6, line: 11, type: !17, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !17 = !DISubroutineType(types: !18) -// CHECK:STDOUT: !18 = !{null} -// CHECK:STDOUT: !19 = !DILocation(line: 12, column: 15, scope: !16) -// CHECK:STDOUT: !20 = !DILocation(line: 14, column: 19, scope: !16) -// CHECK:STDOUT: !21 = !DILocation(line: 12, column: 3, scope: !16) -// CHECK:STDOUT: !22 = !DILocation(line: 14, column: 3, scope: !16) -// CHECK:STDOUT: !23 = !DILocation(line: 11, column: 1, scope: !16) -// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "Op", linkageName: "_COp.705e422c84320121:core.Destroy.Core", scope: null, file: !6, line: 14, type: !25, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !28) -// CHECK:STDOUT: !25 = !DISubroutineType(types: !26) -// CHECK:STDOUT: !26 = !{null, !27} -// CHECK:STDOUT: !27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !28 = !{!29} -// CHECK:STDOUT: !29 = !DILocalVariable(arg: 1, scope: !24, type: !27) -// CHECK:STDOUT: !30 = !DILocation(line: 14, column: 19, scope: !24) -// CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Op", linkageName: "_COp.ca2ce9262234b385:core.Destroy.Core", scope: null, file: !6, line: 12, type: !25, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !32) -// CHECK:STDOUT: !32 = !{!33} -// CHECK:STDOUT: !33 = !DILocalVariable(arg: 1, scope: !31, type: !27) -// CHECK:STDOUT: !34 = !DILocation(line: 12, column: 15, scope: !31) -// CHECK:STDOUT: !35 = distinct !DISubprogram(name: "Op", linkageName: "_COp.dc33c1983710215f:core.Destroy.Core", scope: null, file: !6, line: 12, type: !25, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !36) -// CHECK:STDOUT: !36 = !{!37} -// CHECK:STDOUT: !37 = !DILocalVariable(arg: 1, scope: !35, type: !27) -// CHECK:STDOUT: !38 = !DILocation(line: 12, column: 15, scope: !35) -// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "ReturnNullptr", linkageName: "_CReturnNullptr.Main", scope: null, file: !6, line: 17, type: !40, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !40 = !DISubroutineType(types: !41) -// CHECK:STDOUT: !41 = !{!27} -// CHECK:STDOUT: !42 = !DILocation(line: 18, column: 10, scope: !39) -// CHECK:STDOUT: !43 = !DILocation(line: 18, column: 3, scope: !39) -// CHECK:STDOUT: !44 = distinct !DISubprogram(name: "ReturnNullptrCopy", linkageName: "_CReturnNullptrCopy.Main", scope: null, file: !6, line: 21, type: !40, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !45 = !DILocation(line: 22, column: 3, scope: !44) -// CHECK:STDOUT: !46 = !DILocation(line: 22, column: 26, scope: !44) -// CHECK:STDOUT: !47 = !DILocation(line: 23, column: 10, scope: !44) -// CHECK:STDOUT: !48 = !DILocation(line: 23, column: 3, scope: !44) -// CHECK:STDOUT: !49 = distinct !DISubprogram(name: "ReturnConvertedNullptrIndirectly", linkageName: "_CReturnConvertedNullptrIndirectly.Main", scope: null, file: !6, line: 26, type: !40, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !50 = !DILocation(line: 27, column: 3, scope: !49) -// CHECK:STDOUT: !51 = !DILocation(line: 27, column: 26, scope: !49) -// CHECK:STDOUT: !52 = !DILocation(line: 28, column: 10, scope: !49) -// CHECK:STDOUT: !53 = !DILocation(line: 28, column: 3, scope: !49) -// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "ReturnConvertedNullptrDirectly", linkageName: "_CReturnConvertedNullptrDirectly.Main", scope: null, file: !6, line: 31, type: !40, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "PassNullptr", linkageName: "_CPassNullptr.Main", scope: null, file: !6, line: 11, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 12, column: 15, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 14, column: 19, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 12, column: 3, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 14, column: 3, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 11, column: 1, scope: !11) +// CHECK:STDOUT: !19 = !{!20, !20, i64 0} +// CHECK:STDOUT: !20 = !{!"p1 std::nullptr_t", !21, i64 0} +// CHECK:STDOUT: !21 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "Op", linkageName: "_COp.705e422c84320121:core.Destroy.Core", scope: null, file: !6, line: 14, type: !23, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !26) +// CHECK:STDOUT: !23 = !DISubroutineType(types: !24) +// CHECK:STDOUT: !24 = !{null, !25} +// CHECK:STDOUT: !25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !26 = !{!27} +// CHECK:STDOUT: !27 = !DILocalVariable(arg: 1, scope: !22, type: !25) +// CHECK:STDOUT: !28 = !DILocation(line: 14, column: 19, scope: !22) +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Op", linkageName: "_COp.ca2ce9262234b385:core.Destroy.Core", scope: null, file: !6, line: 12, type: !23, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !30) +// CHECK:STDOUT: !30 = !{!31} +// CHECK:STDOUT: !31 = !DILocalVariable(arg: 1, scope: !29, type: !25) +// CHECK:STDOUT: !32 = !DILocation(line: 12, column: 15, scope: !29) +// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "Op", linkageName: "_COp.dc33c1983710215f:core.Destroy.Core", scope: null, file: !6, line: 12, type: !23, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !34) +// CHECK:STDOUT: !34 = !{!35} +// CHECK:STDOUT: !35 = !DILocalVariable(arg: 1, scope: !33, type: !25) +// CHECK:STDOUT: !36 = !DILocation(line: 12, column: 15, scope: !33) +// CHECK:STDOUT: !37 = distinct !DISubprogram(name: "ReturnNullptr", linkageName: "_CReturnNullptr.Main", scope: null, file: !6, line: 17, type: !38, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !38 = !DISubroutineType(types: !39) +// CHECK:STDOUT: !39 = !{!25} +// CHECK:STDOUT: !40 = !DILocation(line: 18, column: 10, scope: !37) +// CHECK:STDOUT: !41 = !DILocation(line: 18, column: 3, scope: !37) +// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "ReturnNullptrCopy", linkageName: "_CReturnNullptrCopy.Main", scope: null, file: !6, line: 21, type: !38, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !43 = !DILocation(line: 22, column: 3, scope: !42) +// CHECK:STDOUT: !44 = !DILocation(line: 22, column: 26, scope: !42) +// CHECK:STDOUT: !45 = !DILocation(line: 23, column: 10, scope: !42) +// CHECK:STDOUT: !46 = !DILocation(line: 23, column: 3, scope: !42) +// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "ReturnConvertedNullptrIndirectly", linkageName: "_CReturnConvertedNullptrIndirectly.Main", scope: null, file: !6, line: 26, type: !38, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !48 = !DILocation(line: 27, column: 3, scope: !47) +// CHECK:STDOUT: !49 = !DILocation(line: 27, column: 26, scope: !47) +// CHECK:STDOUT: !50 = !DILocation(line: 28, column: 10, scope: !47) +// CHECK:STDOUT: !51 = !DILocation(line: 28, column: 3, scope: !47) +// CHECK:STDOUT: !52 = !{!53, !53, i64 0} +// CHECK:STDOUT: !53 = !{!"std::nullptr_t", !9, i64 0} +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "ReturnConvertedNullptrDirectly", linkageName: "_CReturnConvertedNullptrDirectly.Main", scope: null, file: !6, line: 31, type: !38, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !55 = !DILocation(line: 32, column: 10, scope: !54) // CHECK:STDOUT: !56 = !DILocation(line: 32, column: 3, scope: !54) -// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "ConvertNullptrConstant", linkageName: "_CConvertNullptrConstant.Main", scope: null, file: !6, line: 35, type: !40, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "ConvertNullptrConstant", linkageName: "_CConvertNullptrConstant.Main", scope: null, file: !6, line: 35, type: !38, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !58 = !DILocation(line: 36, column: 3, scope: !57) // CHECK:STDOUT: !59 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.NullptrT.CppCompat.Core:ImplicitAs.83dbfcd16e56a769.Core.b88d1103f417c6d4", scope: null, file: !60, line: 51, type: !61, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !63) // CHECK:STDOUT: !60 = !DIFile(filename: "{{.*}}/prelude/types/cpp/nullptr.carbon", directory: "") // CHECK:STDOUT: !61 = !DISubroutineType(types: !62) -// CHECK:STDOUT: !62 = !{!27, !27} +// CHECK:STDOUT: !62 = !{!25, !25} // CHECK:STDOUT: !63 = !{!64} -// CHECK:STDOUT: !64 = !DILocalVariable(arg: 1, scope: !59, type: !27) +// CHECK:STDOUT: !64 = !DILocalVariable(arg: 1, scope: !59, type: !25) // CHECK:STDOUT: !65 = !DILocation(line: 52, column: 14, scope: !59) // CHECK:STDOUT: !66 = !DILocation(line: 52, column: 7, scope: !59) -// CHECK:STDOUT: !67 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.95809cda2a4fffc7", scope: null, file: !68, line: 27, type: !40, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !67 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.95809cda2a4fffc7", scope: null, file: !68, line: 27, type: !38, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !68 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") // CHECK:STDOUT: !69 = !DILocation(line: 28, column: 5, scope: !67) diff --git a/toolchain/lower/testdata/interop/cpp/parameters.carbon b/toolchain/lower/testdata/interop/cpp/parameters.carbon index 2694ea67dd1a..c570ff0c5cfb 100644 --- a/toolchain/lower/testdata/interop/cpp/parameters.carbon +++ b/toolchain/lower/testdata/interop/cpp/parameters.carbon @@ -120,105 +120,88 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: @_Cc.Main = global i16 0 // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @_C__global_init.Main, ptr null }] // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMyF.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7_19.3.temp = alloca i8, align 1, !dbg !14 +// CHECK:STDOUT: %.loc7_22.3.temp = alloca i16, align 2, !dbg !15 +// CHECK:STDOUT: %.loc9_21.3.temp = alloca i8, align 1, !dbg !16 +// CHECK:STDOUT: %.loc9_24.3.temp = alloca i16, align 2, !dbg !17 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_19.3.temp), !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_22.3.temp), !dbg !15 +// CHECK:STDOUT: call void @_Z11pass_signedasil.carbon_thunk(ptr @int_1.30e, ptr @int_2.305, i32 3, i64 4), !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc9_21.3.temp), !dbg !16 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc9_24.3.temp), !dbg !17 +// CHECK:STDOUT: call void @_Z13pass_unsignedhtjm.carbon_thunk(ptr @int_1.e80, ptr @int_2.fb2, i32 3, i64 4), !dbg !19 +// CHECK:STDOUT: call void @"_COp.ecaf8c3e76291eee:core.Destroy.Core"(ptr @int_2.fb2), !dbg !17 +// CHECK:STDOUT: call void @"_COp.3de38e83520d6bec:core.Destroy.Core"(ptr @int_1.e80), !dbg !16 +// CHECK:STDOUT: call void @"_COp.406738f1b62008ed:core.Destroy.Core"(ptr @int_2.305), !dbg !15 +// CHECK:STDOUT: call void @"_COp.43bece552030817c:core.Destroy.Core"(ptr @int_1.30e), !dbg !14 +// CHECK:STDOUT: ret void, !dbg !20 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z11pass_signedasil.carbon_thunk(ptr noundef %0, ptr noundef %1, i32 noundef %2, i64 noundef %3) #0 { +// CHECK:STDOUT: define internal void @_Z11pass_signedasil.carbon_thunk(ptr noundef %0, ptr noundef %1, i32 noundef %2, i64 noundef %3) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %.addr1 = alloca ptr, align 8 // CHECK:STDOUT: %.addr2 = alloca i32, align 4 // CHECK:STDOUT: %.addr3 = alloca i64, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %1, ptr %.addr1, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !21 +// CHECK:STDOUT: store ptr %1, ptr %.addr1, align 8, !tbaa !24 // CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: store i64 %3, ptr %.addr3, align 8, !tbaa !16 -// CHECK:STDOUT: %4 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %5 = load i8, ptr %4, align 1, !tbaa !18 -// CHECK:STDOUT: %6 = load ptr, ptr %.addr1, align 8, !tbaa !14 -// CHECK:STDOUT: %7 = load i16, ptr %6, align 2, !tbaa !19 +// CHECK:STDOUT: store i64 %3, ptr %.addr3, align 8, !tbaa !26 +// CHECK:STDOUT: %4 = load ptr, ptr %.addr, align 8, !tbaa !21 +// CHECK:STDOUT: %5 = load i8, ptr %4, align 1, !tbaa !28 +// CHECK:STDOUT: %6 = load ptr, ptr %.addr1, align 8, !tbaa !24 +// CHECK:STDOUT: %7 = load i16, ptr %6, align 2, !tbaa !29 // CHECK:STDOUT: %8 = load i32, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: %9 = load i64, ptr %.addr3, align 8, !tbaa !16 +// CHECK:STDOUT: %9 = load i64, ptr %.addr3, align 8, !tbaa !26 // CHECK:STDOUT: call void @_Z11pass_signedasil(i8 noundef signext %5, i16 noundef signext %7, i32 noundef %8, i64 noundef %9) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11pass_signedasil(i8 noundef signext, i16 noundef signext, i32 noundef, i64 noundef) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z13pass_unsignedhtjm.carbon_thunk(ptr noundef %0, ptr noundef %1, i32 noundef %2, i64 noundef %3) #0 { +// CHECK:STDOUT: define internal void @_Z13pass_unsignedhtjm.carbon_thunk(ptr noundef %0, ptr noundef %1, i32 noundef %2, i64 noundef %3) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %.addr1 = alloca ptr, align 8 // CHECK:STDOUT: %.addr2 = alloca i32, align 4 // CHECK:STDOUT: %.addr3 = alloca i64, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %1, ptr %.addr1, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !21 +// CHECK:STDOUT: store ptr %1, ptr %.addr1, align 8, !tbaa !24 // CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: store i64 %3, ptr %.addr3, align 8, !tbaa !16 -// CHECK:STDOUT: %4 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %5 = load i8, ptr %4, align 1, !tbaa !18 -// CHECK:STDOUT: %6 = load ptr, ptr %.addr1, align 8, !tbaa !14 -// CHECK:STDOUT: %7 = load i16, ptr %6, align 2, !tbaa !19 +// CHECK:STDOUT: store i64 %3, ptr %.addr3, align 8, !tbaa !26 +// CHECK:STDOUT: %4 = load ptr, ptr %.addr, align 8, !tbaa !21 +// CHECK:STDOUT: %5 = load i8, ptr %4, align 1, !tbaa !28 +// CHECK:STDOUT: %6 = load ptr, ptr %.addr1, align 8, !tbaa !24 +// CHECK:STDOUT: %7 = load i16, ptr %6, align 2, !tbaa !29 // CHECK:STDOUT: %8 = load i32, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: %9 = load i64, ptr %.addr3, align 8, !tbaa !16 +// CHECK:STDOUT: %9 = load i64, ptr %.addr3, align 8, !tbaa !26 // CHECK:STDOUT: call void @_Z13pass_unsignedhtjm(i8 noundef zeroext %5, i16 noundef zeroext %7, i32 noundef %8, i64 noundef %9) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z13pass_unsignedhtjm(i8 noundef zeroext, i16 noundef zeroext, i32 noundef, i64 noundef) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z10pass_shorts.carbon_thunk(ptr noundef %0) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %2 = load i16, ptr %1, align 2, !tbaa !19 -// CHECK:STDOUT: call void @_Z10pass_shorts(i16 noundef signext %2) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z10pass_shorts(i16 noundef signext) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CMyF.Main() #2 !dbg !21 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_19.3.temp = alloca i8, align 1, !dbg !24 -// CHECK:STDOUT: %.loc7_22.3.temp = alloca i16, align 2, !dbg !25 -// CHECK:STDOUT: %.loc9_21.3.temp = alloca i8, align 1, !dbg !26 -// CHECK:STDOUT: %.loc9_24.3.temp = alloca i16, align 2, !dbg !27 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_19.3.temp), !dbg !24 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_22.3.temp), !dbg !25 -// CHECK:STDOUT: call void @_Z11pass_signedasil.carbon_thunk(ptr @int_1.30e, ptr @int_2.305, i32 3, i64 4), !dbg !28 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc9_21.3.temp), !dbg !26 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc9_24.3.temp), !dbg !27 -// CHECK:STDOUT: call void @_Z13pass_unsignedhtjm.carbon_thunk(ptr @int_1.e80, ptr @int_2.fb2, i32 3, i64 4), !dbg !29 -// CHECK:STDOUT: call void @"_COp.ecaf8c3e76291eee:core.Destroy.Core"(ptr @int_2.fb2), !dbg !27 -// CHECK:STDOUT: call void @"_COp.3de38e83520d6bec:core.Destroy.Core"(ptr @int_1.e80), !dbg !26 -// CHECK:STDOUT: call void @"_COp.406738f1b62008ed:core.Destroy.Core"(ptr @int_2.305), !dbg !25 -// CHECK:STDOUT: call void @"_COp.43bece552030817c:core.Destroy.Core"(ptr @int_1.30e), !dbg !24 -// CHECK:STDOUT: ret void, !dbg !30 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.ecaf8c3e76291eee:core.Destroy.Core"(ptr %self) #2 !dbg !31 { +// CHECK:STDOUT: define weak_odr void @"_COp.ecaf8c3e76291eee:core.Destroy.Core"(ptr %self) #0 !dbg !31 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !37 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.3de38e83520d6bec:core.Destroy.Core"(ptr %self) #2 !dbg !38 { +// CHECK:STDOUT: define weak_odr void @"_COp.3de38e83520d6bec:core.Destroy.Core"(ptr %self) #0 !dbg !38 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.406738f1b62008ed:core.Destroy.Core"(ptr %self) #2 !dbg !45 { +// CHECK:STDOUT: define weak_odr void @"_COp.406738f1b62008ed:core.Destroy.Core"(ptr %self) #0 !dbg !45 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !51 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.43bece552030817c:core.Destroy.Core"(ptr %self) #2 !dbg !52 { +// CHECK:STDOUT: define weak_odr void @"_COp.43bece552030817c:core.Destroy.Core"(ptr %self) #0 !dbg !52 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !58 // CHECK:STDOUT: } @@ -226,7 +209,7 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: declare i16 @_CMakeShort.Main() // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassShort.Main(i16 %a, ptr %b) #2 !dbg !59 { +// CHECK:STDOUT: define void @_CPassShort.Main(i16 %a, ptr %b) #0 !dbg !59 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc17_18.1.temp = alloca i16, align 2, !dbg !66 // CHECK:STDOUT: %.loc18_18.3.temp = alloca i16, align 2, !dbg !67 @@ -254,23 +237,41 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: ret void, !dbg !74 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z10pass_shorts.carbon_thunk(ptr noundef %0) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !24 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !24 +// CHECK:STDOUT: %2 = load i16, ptr %1, align 2, !tbaa !29 +// CHECK:STDOUT: call void @_Z10pass_shorts(i16 noundef signext %2) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define internal void @_C__global_init.Main() #2 !dbg !75 { +// CHECK:STDOUT: define internal void @_C__global_init.Main() #0 !dbg !75 { // CHECK:STDOUT: entry: // CHECK:STDOUT: store i16 poison, ptr @_Cc.Main, align 2, !dbg !76 // CHECK:STDOUT: ret void, !dbg !77 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z11pass_signedasil(i8 noundef signext, i16 noundef signext, i32 noundef, i64 noundef) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z13pass_unsignedhtjm(i8 noundef zeroext, i16 noundef zeroext, i32 noundef, i64 noundef) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z10pass_shorts(i16 noundef signext) #3 +// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder ptr @_Z10pass_shorts.carbon_thunk, { 3, 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 7, 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -287,26 +288,26 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 omnipotent char", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"p1 short", !13, i64 0} -// CHECK:STDOUT: !16 = !{!17, !17, i64 0} -// CHECK:STDOUT: !17 = !{!"long", !9, i64 0} -// CHECK:STDOUT: !18 = !{!9, !9, i64 0} -// CHECK:STDOUT: !19 = !{!20, !20, i64 0} -// CHECK:STDOUT: !20 = !{!"short", !9, i64 0} -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "MyF", linkageName: "_CMyF.Main", scope: null, file: !6, line: 6, type: !22, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !22 = !DISubroutineType(types: !23) -// CHECK:STDOUT: !23 = !{null} -// CHECK:STDOUT: !24 = !DILocation(line: 7, column: 19, scope: !21) -// CHECK:STDOUT: !25 = !DILocation(line: 7, column: 22, scope: !21) -// CHECK:STDOUT: !26 = !DILocation(line: 9, column: 21, scope: !21) -// CHECK:STDOUT: !27 = !DILocation(line: 9, column: 24, scope: !21) -// CHECK:STDOUT: !28 = !DILocation(line: 7, column: 3, scope: !21) -// CHECK:STDOUT: !29 = !DILocation(line: 9, column: 3, scope: !21) -// CHECK:STDOUT: !30 = !DILocation(line: 6, column: 1, scope: !21) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "MyF", linkageName: "_CMyF.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 19, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 7, column: 22, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 9, column: 21, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 9, column: 24, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 9, column: 3, scope: !11) +// CHECK:STDOUT: !20 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !21 = !{!22, !22, i64 0} +// CHECK:STDOUT: !22 = !{!"p1 omnipotent char", !23, i64 0} +// CHECK:STDOUT: !23 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !24 = !{!25, !25, i64 0} +// CHECK:STDOUT: !25 = !{!"p1 short", !23, i64 0} +// CHECK:STDOUT: !26 = !{!27, !27, i64 0} +// CHECK:STDOUT: !27 = !{!"long", !9, i64 0} +// CHECK:STDOUT: !28 = !{!9, !9, i64 0} +// CHECK:STDOUT: !29 = !{!30, !30, i64 0} +// CHECK:STDOUT: !30 = !{!"short", !9, i64 0} // CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Op", linkageName: "_COp.ecaf8c3e76291eee:core.Destroy.Core", scope: null, file: !6, line: 9, type: !32, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !35) // CHECK:STDOUT: !32 = !DISubroutineType(types: !33) // CHECK:STDOUT: !33 = !{null, !34} @@ -351,7 +352,7 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: !72 = !DILocation(line: 19, column: 3, scope: !59) // CHECK:STDOUT: !73 = !DILocation(line: 20, column: 3, scope: !59) // CHECK:STDOUT: !74 = !DILocation(line: 16, column: 1, scope: !59) -// CHECK:STDOUT: !75 = distinct !DISubprogram(name: "__global_init", linkageName: "_C__global_init.Main", scope: null, file: !6, type: !22, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !75 = distinct !DISubprogram(name: "__global_init", linkageName: "_C__global_init.Main", scope: null, file: !6, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !76 = !DILocation(line: 14, column: 1, scope: !75) // CHECK:STDOUT: !77 = !DILocation(line: 0, scope: !75) // CHECK:STDOUT: ; ModuleID = 'import_struct.carbon' @@ -361,24 +362,47 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: // CHECK:STDOUT: %struct.X = type { i32, i32, i32 } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CTest.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.var = alloca [12 x i8], align 1, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !14 +// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.64f6b96556a8f2d4"(ptr %x.var), !dbg !14 +// CHECK:STDOUT: %.loc8_4.a = getelementptr inbounds nuw [12 x i8], ptr %x.var, i32 0, i32 0, !dbg !15 +// CHECK:STDOUT: store i32 1, ptr %.loc8_4.a, align 4, !dbg !15 +// CHECK:STDOUT: %.loc9_4.b = getelementptr inbounds nuw [12 x i8], ptr %x.var, i32 0, i32 4, !dbg !16 +// CHECK:STDOUT: store i32 2, ptr %.loc9_4.b, align 4, !dbg !16 +// CHECK:STDOUT: %.loc10_4.c = getelementptr inbounds nuw [12 x i8], ptr %x.var, i32 0, i32 8, !dbg !17 +// CHECK:STDOUT: store i32 3, ptr %.loc10_4.c, align 4, !dbg !17 +// CHECK:STDOUT: call void @_Z11pass_struct1X.carbon_thunk(ptr %x.var), !dbg !18 +// CHECK:STDOUT: ret void, !dbg !19 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress nounwind uwtable -// CHECK:STDOUT: define dso_local void @_ZN1XC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1XC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !20 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !20 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_COp:thunk.X.Cpp"(ptr sret([12 x i8]) %return) #2 !dbg !23 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_ZN1XC1Ev.carbon_thunk(ptr %return), !dbg !28 +// CHECK:STDOUT: ret void, !dbg !28 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z11pass_struct1X.carbon_thunk(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z11pass_struct1X.carbon_thunk(ptr noundef %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %struct.X, align 4 // CHECK:STDOUT: %agg.tmp.coerce = alloca { i64, i32 }, align 4 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp, ptr align 4 %1, i64 12, i1 false), !tbaa.struct !14 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !20 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !20 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp, ptr align 4 %1, i64 12, i1 false), !tbaa.struct !29 // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %agg.tmp.coerce, ptr align 4 %agg.tmp, i64 12, i1 false) // CHECK:STDOUT: %2 = getelementptr inbounds nuw { i64, i32 }, ptr %agg.tmp.coerce, i32 0, i32 0 // CHECK:STDOUT: %3 = load i64, ptr %2, align 4 @@ -388,53 +412,30 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11pass_struct1X(i64, i32) #2 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #3 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CTest.Main() #4 !dbg !15 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.var = alloca [12 x i8], align 1, !dbg !18 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %x.var), !dbg !18 -// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.64f6b96556a8f2d4"(ptr %x.var), !dbg !18 -// CHECK:STDOUT: %.loc8_4.a = getelementptr inbounds nuw [12 x i8], ptr %x.var, i32 0, i32 0, !dbg !19 -// CHECK:STDOUT: store i32 1, ptr %.loc8_4.a, align 4, !dbg !19 -// CHECK:STDOUT: %.loc9_4.b = getelementptr inbounds nuw [12 x i8], ptr %x.var, i32 0, i32 4, !dbg !20 -// CHECK:STDOUT: store i32 2, ptr %.loc9_4.b, align 4, !dbg !20 -// CHECK:STDOUT: %.loc10_4.c = getelementptr inbounds nuw [12 x i8], ptr %x.var, i32 0, i32 8, !dbg !21 -// CHECK:STDOUT: store i32 3, ptr %.loc10_4.c, align 4, !dbg !21 -// CHECK:STDOUT: call void @_Z11pass_struct1X.carbon_thunk(ptr %x.var), !dbg !22 -// CHECK:STDOUT: ret void, !dbg !23 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind -// CHECK:STDOUT: define void @"_COp:thunk.X.Cpp"(ptr sret([12 x i8]) %return) #5 !dbg !24 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_ZN1XC1Ev.carbon_thunk(ptr %return), !dbg !29 -// CHECK:STDOUT: ret void, !dbg !29 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #6 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.64f6b96556a8f2d4"(ptr sret([12 x i8]) %return) #4 !dbg !30 { +// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.64f6b96556a8f2d4"(ptr sret([12 x i8]) %return) #0 !dbg !30 { // CHECK:STDOUT: call void @"_COp:thunk.X.Cpp"(ptr %return), !dbg !32 // CHECK:STDOUT: ret void, !dbg !33 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z11pass_struct1X(i64, i32) #5 +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #6 +// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.memcpy.p0.p0.i64, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } -// CHECK:STDOUT: attributes #4 = { nounwind } -// CHECK:STDOUT: attributes #5 = { alwaysinline nounwind } -// CHECK:STDOUT: attributes #6 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #3 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -451,26 +452,26 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1X", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{i64 0, i64 4, !7, i64 4, i64 4, !7, i64 8, i64 4, !7} -// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "Test", linkageName: "_CTest.Main", scope: null, file: !6, line: 6, type: !16, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !16 = !DISubroutineType(types: !17) -// CHECK:STDOUT: !17 = !{null} -// CHECK:STDOUT: !18 = !DILocation(line: 7, column: 3, scope: !15) -// CHECK:STDOUT: !19 = !DILocation(line: 8, column: 3, scope: !15) -// CHECK:STDOUT: !20 = !DILocation(line: 9, column: 3, scope: !15) -// CHECK:STDOUT: !21 = !DILocation(line: 10, column: 3, scope: !15) -// CHECK:STDOUT: !22 = !DILocation(line: 11, column: 3, scope: !15) -// CHECK:STDOUT: !23 = !DILocation(line: 6, column: 1, scope: !15) -// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.X.Cpp", scope: null, file: !25, line: 2, type: !26, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !25 = !DIFile(filename: "./struct.h", directory: "") -// CHECK:STDOUT: !26 = !DISubroutineType(types: !27) -// CHECK:STDOUT: !27 = !{!28} -// CHECK:STDOUT: !28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !29 = !DILocation(line: 2, column: 8, scope: !24) -// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.64f6b96556a8f2d4", scope: null, file: !31, line: 9, type: !26, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Test", linkageName: "_CTest.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 8, column: 3, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 9, column: 3, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 10, column: 3, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 11, column: 3, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !20 = !{!21, !21, i64 0} +// CHECK:STDOUT: !21 = !{!"p1 _ZTS1X", !22, i64 0} +// CHECK:STDOUT: !22 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !23 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.X.Cpp", scope: null, file: !24, line: 2, type: !25, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !24 = !DIFile(filename: "./struct.h", directory: "") +// CHECK:STDOUT: !25 = !DISubroutineType(types: !26) +// CHECK:STDOUT: !26 = !{!27} +// CHECK:STDOUT: !27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !28 = !DILocation(line: 2, column: 8, scope: !23) +// CHECK:STDOUT: !29 = !{i64 0, i64 4, !7, i64 4, i64 4, !7, i64 8, i64 4, !7} +// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.64f6b96556a8f2d4", scope: null, file: !31, line: 9, type: !25, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !31 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "") // CHECK:STDOUT: !32 = !DILocation(line: 9, column: 28, scope: !30) // CHECK:STDOUT: !33 = !DILocation(line: 9, column: 21, scope: !30) @@ -481,41 +482,37 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: // CHECK:STDOUT: %class.Y = type { i32, i32, i32 } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassRefExpr.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %y.var = alloca [12 x i8], align 1, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %y.var), !dbg !14 +// CHECK:STDOUT: %.loc8_4.a = getelementptr inbounds nuw [12 x i8], ptr %y.var, i32 0, i32 0, !dbg !15 +// CHECK:STDOUT: store i32 1, ptr %.loc8_4.a, align 4, !dbg !15 +// CHECK:STDOUT: %.loc9_4.b = getelementptr inbounds nuw [12 x i8], ptr %y.var, i32 0, i32 4, !dbg !16 +// CHECK:STDOUT: store i32 2, ptr %.loc9_4.b, align 4, !dbg !16 +// CHECK:STDOUT: %.loc10_4.c = getelementptr inbounds nuw [12 x i8], ptr %y.var, i32 0, i32 8, !dbg !17 +// CHECK:STDOUT: store i32 3, ptr %.loc10_4.c, align 4, !dbg !17 +// CHECK:STDOUT: call void @_Z11pass_struct1Y.carbon_thunk(ptr %y.var), !dbg !18 +// CHECK:STDOUT: ret void, !dbg !19 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z11pass_struct1Y.carbon_thunk(ptr noundef %0) #0 { +// CHECK:STDOUT: define internal void @_Z11pass_struct1Y.carbon_thunk(ptr noundef %0) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.Y, align 4 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !20 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !20 // CHECK:STDOUT: call void @_ZN1YC1ERKS_(ptr noundef nonnull align 4 dereferenceable(12) %agg.tmp, ptr noundef nonnull align 4 dereferenceable(12) %1) // CHECK:STDOUT: call void @_Z11pass_struct1Y(ptr noundef dead_on_return %agg.tmp) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11pass_struct1Y(ptr noundef dead_on_return) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_ZN1YC1ERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassRefExpr.Main() #2 !dbg !14 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %y.var = alloca [12 x i8], align 1, !dbg !17 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %y.var), !dbg !17 -// CHECK:STDOUT: %.loc8_4.a = getelementptr inbounds nuw [12 x i8], ptr %y.var, i32 0, i32 0, !dbg !18 -// CHECK:STDOUT: store i32 1, ptr %.loc8_4.a, align 4, !dbg !18 -// CHECK:STDOUT: %.loc9_4.b = getelementptr inbounds nuw [12 x i8], ptr %y.var, i32 0, i32 4, !dbg !19 -// CHECK:STDOUT: store i32 2, ptr %.loc9_4.b, align 4, !dbg !19 -// CHECK:STDOUT: %.loc10_4.c = getelementptr inbounds nuw [12 x i8], ptr %y.var, i32 0, i32 8, !dbg !20 -// CHECK:STDOUT: store i32 3, ptr %.loc10_4.c, align 4, !dbg !20 -// CHECK:STDOUT: call void @_Z11pass_struct1Y.carbon_thunk(ptr %y.var), !dbg !21 -// CHECK:STDOUT: ret void, !dbg !22 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: declare void @_CMake.Main(ptr sret([12 x i8])) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassInitExpr.Main() #2 !dbg !23 { +// CHECK:STDOUT: define void @_CPassInitExpr.Main() #0 !dbg !23 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc17_24.1.temp = alloca [12 x i8], align 1, !dbg !24 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc17_24.1.temp), !dbg !24 @@ -525,22 +522,26 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassValueExpr.Main(ptr %y) #2 !dbg !27 { +// CHECK:STDOUT: define void @_CPassValueExpr.Main(ptr %y) #0 !dbg !27 { // CHECK:STDOUT: entry: // CHECK:STDOUT: call void @_Z11pass_struct1Y.carbon_thunk(ptr %y), !dbg !33 // CHECK:STDOUT: ret void, !dbg !34 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z11pass_struct1Y(ptr noundef dead_on_return) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_ZN1YC1ERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -557,19 +558,19 @@ fn PassValueExpr(y: Cpp.Y) { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1Y", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "PassRefExpr", linkageName: "_CPassRefExpr.Main", scope: null, file: !6, line: 6, type: !15, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{null} -// CHECK:STDOUT: !17 = !DILocation(line: 7, column: 3, scope: !14) -// CHECK:STDOUT: !18 = !DILocation(line: 8, column: 3, scope: !14) -// CHECK:STDOUT: !19 = !DILocation(line: 9, column: 3, scope: !14) -// CHECK:STDOUT: !20 = !DILocation(line: 10, column: 3, scope: !14) -// CHECK:STDOUT: !21 = !DILocation(line: 11, column: 3, scope: !14) -// CHECK:STDOUT: !22 = !DILocation(line: 6, column: 1, scope: !14) -// CHECK:STDOUT: !23 = distinct !DISubprogram(name: "PassInitExpr", linkageName: "_CPassInitExpr.Main", scope: null, file: !6, line: 16, type: !15, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "PassRefExpr", linkageName: "_CPassRefExpr.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 8, column: 3, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 9, column: 3, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 10, column: 3, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 11, column: 3, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !20 = !{!21, !21, i64 0} +// CHECK:STDOUT: !21 = !{!"p1 _ZTS1Y", !22, i64 0} +// CHECK:STDOUT: !22 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !23 = distinct !DISubprogram(name: "PassInitExpr", linkageName: "_CPassInitExpr.Main", scope: null, file: !6, line: 16, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !24 = !DILocation(line: 17, column: 19, scope: !23) // CHECK:STDOUT: !25 = !DILocation(line: 17, column: 3, scope: !23) // CHECK:STDOUT: !26 = !DILocation(line: 16, column: 1, scope: !23) diff --git a/toolchain/lower/testdata/interop/cpp/pointer.carbon b/toolchain/lower/testdata/interop/cpp/pointer.carbon index 240094a63fa6..02b21ac674b3 100644 --- a/toolchain/lower/testdata/interop/cpp/pointer.carbon +++ b/toolchain/lower/testdata/interop/cpp/pointer.carbon @@ -107,62 +107,62 @@ fn Convert() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr noundef %0) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci(ptr noundef %1, i32 noundef 0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z16TakePtrWithThunkP1Ci(ptr noundef, i32 noundef) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef ptr @_Z18ReturnPtrWithThunki.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %call = call noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef 0) -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassPtr.Main(ptr %p) #2 !dbg !14 { +// CHECK:STDOUT: define void @_CPassPtr.Main(ptr %p) #0 !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_Z7TakePtrP1C(ptr %p), !dbg !20 -// CHECK:STDOUT: ret void, !dbg !21 +// CHECK:STDOUT: call void @_Z7TakePtrP1C(ptr %p), !dbg !17 +// CHECK:STDOUT: ret void, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z7TakePtrP1C(ptr noundef) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnPtr.Main() #2 !dbg !22 { +// CHECK:STDOUT: define ptr @_CReturnPtr.Main() #0 !dbg !19 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %ReturnPtr.call = call ptr @_Z9ReturnPtrv(), !dbg !25 -// CHECK:STDOUT: ret ptr %ReturnPtr.call, !dbg !26 +// CHECK:STDOUT: %ReturnPtr.call = call ptr @_Z9ReturnPtrv(), !dbg !22 +// CHECK:STDOUT: ret ptr %ReturnPtr.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare noundef ptr @_Z9ReturnPtrv() #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassPtrWithThunk.Main(ptr %p) #2 !dbg !27 { +// CHECK:STDOUT: define void @_CPassPtrWithThunk.Main(ptr %p) #0 !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr %p), !dbg !30 -// CHECK:STDOUT: ret void, !dbg !31 +// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr %p), !dbg !27 +// CHECK:STDOUT: ret void, !dbg !28 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr noundef %0) #2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !29 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !29 +// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci(ptr noundef %1, i32 noundef 0) +// CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnPtrWithThunk.Main() #2 !dbg !32 { +// CHECK:STDOUT: define ptr @_CReturnPtrWithThunk.Main() #0 !dbg !32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnPtrWithThunk__carbon_thunk.call = call ptr @_Z18ReturnPtrWithThunki.carbon_thunk0(), !dbg !33 // CHECK:STDOUT: ret ptr %ReturnPtrWithThunk__carbon_thunk.call, !dbg !34 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef ptr @_Z18ReturnPtrWithThunki.carbon_thunk0() #2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %call = call noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef 0) +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z16TakePtrWithThunkP1Ci(ptr noundef, i32 noundef) #1 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef) #1 +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } // CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -179,28 +179,28 @@ fn Convert() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "PassPtr", linkageName: "_CPassPtr.Main", scope: null, file: !6, line: 14, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !18) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{null, !17} -// CHECK:STDOUT: !17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !18 = !{!19} -// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !14, type: !17) -// CHECK:STDOUT: !20 = !DILocation(line: 15, column: 3, scope: !14) -// CHECK:STDOUT: !21 = !DILocation(line: 14, column: 1, scope: !14) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "ReturnPtr", linkageName: "_CReturnPtr.Main", scope: null, file: !6, line: 18, type: !23, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !23 = !DISubroutineType(types: !24) -// CHECK:STDOUT: !24 = !{!17} -// CHECK:STDOUT: !25 = !DILocation(line: 19, column: 10, scope: !22) -// CHECK:STDOUT: !26 = !DILocation(line: 19, column: 3, scope: !22) -// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "PassPtrWithThunk", linkageName: "_CPassPtrWithThunk.Main", scope: null, file: !6, line: 22, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !28) -// CHECK:STDOUT: !28 = !{!29} -// CHECK:STDOUT: !29 = !DILocalVariable(arg: 1, scope: !27, type: !17) -// CHECK:STDOUT: !30 = !DILocation(line: 23, column: 3, scope: !27) -// CHECK:STDOUT: !31 = !DILocation(line: 22, column: 1, scope: !27) -// CHECK:STDOUT: !32 = distinct !DISubprogram(name: "ReturnPtrWithThunk", linkageName: "_CReturnPtrWithThunk.Main", scope: null, file: !6, line: 26, type: !23, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "PassPtr", linkageName: "_CPassPtr.Main", scope: null, file: !6, line: 14, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !15) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null, !14} +// CHECK:STDOUT: !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !15 = !{!16} +// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !14) +// CHECK:STDOUT: !17 = !DILocation(line: 15, column: 3, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 14, column: 1, scope: !11) +// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "ReturnPtr", linkageName: "_CReturnPtr.Main", scope: null, file: !6, line: 18, type: !20, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !20 = !DISubroutineType(types: !21) +// CHECK:STDOUT: !21 = !{!14} +// CHECK:STDOUT: !22 = !DILocation(line: 19, column: 10, scope: !19) +// CHECK:STDOUT: !23 = !DILocation(line: 19, column: 3, scope: !19) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "PassPtrWithThunk", linkageName: "_CPassPtrWithThunk.Main", scope: null, file: !6, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !25) +// CHECK:STDOUT: !25 = !{!26} +// CHECK:STDOUT: !26 = !DILocalVariable(arg: 1, scope: !24, type: !14) +// CHECK:STDOUT: !27 = !DILocation(line: 23, column: 3, scope: !24) +// CHECK:STDOUT: !28 = !DILocation(line: 22, column: 1, scope: !24) +// CHECK:STDOUT: !29 = !{!30, !30, i64 0} +// CHECK:STDOUT: !30 = !{!"p1 _ZTS1C", !31, i64 0} +// CHECK:STDOUT: !31 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !32 = distinct !DISubprogram(name: "ReturnPtrWithThunk", linkageName: "_CReturnPtrWithThunk.Main", scope: null, file: !6, line: 26, type: !20, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !33 = !DILocation(line: 27, column: 10, scope: !32) // CHECK:STDOUT: !34 = !DILocation(line: 27, column: 3, scope: !32) // CHECK:STDOUT: ; ModuleID = 'nullable.carbon' @@ -208,97 +208,93 @@ fn Convert() { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr noundef %0) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci(ptr noundef %1, i32 noundef 0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z16TakePtrWithThunkP1Ci(ptr noundef, i32 noundef) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef ptr @_Z18ReturnPtrWithThunki.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %call = call noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef 0) -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassPtr.Main(ptr %_) #2 !dbg !14 { +// CHECK:STDOUT: define void @_CPassPtr.Main(ptr %_) #0 !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !20 +// CHECK:STDOUT: ret void, !dbg !17 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassNonnullPtr.Main(ptr %p) #2 !dbg !21 { +// CHECK:STDOUT: define void @_CPassNonnullPtr.Main(ptr %p) #0 !dbg !18 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_15.2.temp = alloca ptr, align 8, !dbg !24 -// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a"(ptr %p), !dbg !24 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc22_15.2.temp), !dbg !24 -// CHECK:STDOUT: store ptr %U.binding.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc22_15.2.temp, align 8, !dbg !24 -// CHECK:STDOUT: %.loc22_15.4 = load ptr, ptr %.loc22_15.2.temp, align 8, !dbg !24 -// CHECK:STDOUT: call void @_Z7TakePtrP1C(ptr %.loc22_15.4), !dbg !25 -// CHECK:STDOUT: call void @"_COp.b17d31fafee11ec0:core.Destroy.Core"(ptr %.loc22_15.2.temp), !dbg !24 -// CHECK:STDOUT: ret void, !dbg !26 +// CHECK:STDOUT: %.loc22_15.2.temp = alloca ptr, align 8, !dbg !21 +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a"(ptr %p), !dbg !21 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc22_15.2.temp), !dbg !21 +// CHECK:STDOUT: store ptr %U.binding.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc22_15.2.temp, align 8, !dbg !21 +// CHECK:STDOUT: %.loc22_15.4 = load ptr, ptr %.loc22_15.2.temp, align 8, !dbg !21 +// CHECK:STDOUT: call void @_Z7TakePtrP1C(ptr %.loc22_15.4), !dbg !22 +// CHECK:STDOUT: call void @"_COp.b17d31fafee11ec0:core.Destroy.Core"(ptr %.loc22_15.2.temp), !dbg !21 +// CHECK:STDOUT: ret void, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare void @_Z7TakePtrP1C(ptr noundef) #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.52ae03024b07a1ce:core.Destroy.Core"(ptr %self) #2 !dbg !27 { +// CHECK:STDOUT: define weak_odr void @"_COp.52ae03024b07a1ce:core.Destroy.Core"(ptr %self) #0 !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !30 +// CHECK:STDOUT: ret void, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.b17d31fafee11ec0:core.Destroy.Core"(ptr %self) #2 !dbg !31 { +// CHECK:STDOUT: define weak_odr void @"_COp.b17d31fafee11ec0:core.Destroy.Core"(ptr %self) #0 !dbg !28 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !34 +// CHECK:STDOUT: ret void, !dbg !31 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnPtr.Main() #2 !dbg !35 { +// CHECK:STDOUT: define ptr @_CReturnPtr.Main() #0 !dbg !32 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %ReturnPtr.call = call ptr @_Z9ReturnPtrv(), !dbg !38 -// CHECK:STDOUT: ret ptr %ReturnPtr.call, !dbg !39 +// CHECK:STDOUT: %ReturnPtr.call = call ptr @_Z9ReturnPtrv(), !dbg !35 +// CHECK:STDOUT: ret ptr %ReturnPtr.call, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: declare noundef ptr @_Z9ReturnPtrv() #1 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassPtrWithThunk.Main(ptr %_) #2 !dbg !40 { +// CHECK:STDOUT: define void @_CPassPtrWithThunk.Main(ptr %_) #0 !dbg !37 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !43 +// CHECK:STDOUT: ret void, !dbg !40 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassNonnullPtrWithThunk.Main(ptr %p) #2 !dbg !44 { +// CHECK:STDOUT: define void @_CPassNonnullPtrWithThunk.Main(ptr %p) #0 !dbg !41 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc35_24.2.temp = alloca ptr, align 8, !dbg !47 -// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a"(ptr %p), !dbg !47 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc35_24.2.temp), !dbg !47 -// CHECK:STDOUT: store ptr %U.binding.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc35_24.2.temp, align 8, !dbg !47 -// CHECK:STDOUT: %.loc35_24.4 = load ptr, ptr %.loc35_24.2.temp, align 8, !dbg !47 -// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr %.loc35_24.4), !dbg !48 -// CHECK:STDOUT: call void @"_COp.b17d31fafee11ec0:core.Destroy.Core"(ptr %.loc35_24.2.temp), !dbg !47 -// CHECK:STDOUT: ret void, !dbg !49 +// CHECK:STDOUT: %.loc35_24.2.temp = alloca ptr, align 8, !dbg !44 +// CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call = call ptr @"_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a"(ptr %p), !dbg !44 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc35_24.2.temp), !dbg !44 +// CHECK:STDOUT: store ptr %U.binding.as_type.as.ImplicitAs.impl.Convert.call, ptr %.loc35_24.2.temp, align 8, !dbg !44 +// CHECK:STDOUT: %.loc35_24.4 = load ptr, ptr %.loc35_24.2.temp, align 8, !dbg !44 +// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr %.loc35_24.4), !dbg !45 +// CHECK:STDOUT: call void @"_COp.b17d31fafee11ec0:core.Destroy.Core"(ptr %.loc35_24.2.temp), !dbg !44 +// CHECK:STDOUT: ret void, !dbg !46 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z16TakePtrWithThunkP1Ci.carbon_thunk1(ptr noundef %0) #2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !47 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !47 +// CHECK:STDOUT: call void @_Z16TakePtrWithThunkP1Ci(ptr noundef %1, i32 noundef 0) +// CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @_CReturnPtrWithThunk.Main() #2 !dbg !50 { +// CHECK:STDOUT: define ptr @_CReturnPtrWithThunk.Main() #0 !dbg !50 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnPtrWithThunk__carbon_thunk.call = call ptr @_Z18ReturnPtrWithThunki.carbon_thunk0(), !dbg !51 // CHECK:STDOUT: ret ptr %ReturnPtrWithThunk__carbon_thunk.call, !dbg !52 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef ptr @_Z18ReturnPtrWithThunki.carbon_thunk0() #2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %call = call noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef 0) +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a"(ptr %self) #2 !dbg !53 { +// CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a"(ptr %self) #0 !dbg !53 { // CHECK:STDOUT: %1 = call ptr @"_CConvert.90961d7b1ce4f089:OptionalAs.0e326e799dad0c64.Core.8f431b36581f9e63"(ptr %self), !dbg !59 // CHECK:STDOUT: ret ptr %1, !dbg !60 // CHECK:STDOUT: } @@ -307,19 +303,19 @@ fn Convert() { // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.90961d7b1ce4f089:OptionalAs.0e326e799dad0c64.Core.8f431b36581f9e63"(ptr %self) #2 !dbg !61 { +// CHECK:STDOUT: define linkonce_odr ptr @"_CConvert.90961d7b1ce4f089:OptionalAs.0e326e799dad0c64.Core.8f431b36581f9e63"(ptr %self) #0 !dbg !61 { // CHECK:STDOUT: %1 = call ptr @_CSome.Optional.Core.8f431b36581f9e63(ptr %self), !dbg !64 // CHECK:STDOUT: ret ptr %1, !dbg !65 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @_CSome.Optional.Core.8f431b36581f9e63(ptr %value) #2 !dbg !66 { +// CHECK:STDOUT: define linkonce_odr ptr @_CSome.Optional.Core.8f431b36581f9e63(ptr %value) #0 !dbg !66 { // CHECK:STDOUT: %1 = call ptr @"_CSome.e8f8f92d3d08d149:OptionalStorage.Core.f53db17714b9f655"(ptr %value), !dbg !69 // CHECK:STDOUT: ret ptr %1, !dbg !70 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr ptr @"_CSome.e8f8f92d3d08d149:OptionalStorage.Core.f53db17714b9f655"(ptr %self) #2 !dbg !71 { +// CHECK:STDOUT: define linkonce_odr ptr @"_CSome.e8f8f92d3d08d149:OptionalStorage.Core.f53db17714b9f655"(ptr %self) #0 !dbg !71 { // CHECK:STDOUT: %1 = alloca ptr, align 8, !dbg !74 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %1), !dbg !74 // CHECK:STDOUT: store ptr poison, ptr %1, align 8, !dbg !74 @@ -329,13 +325,17 @@ fn Convert() { // CHECK:STDOUT: ret ptr %2, !dbg !77 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z16TakePtrWithThunkP1Ci(ptr noundef, i32 noundef) #1 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef ptr @_Z18ReturnPtrWithThunki(i32 noundef) #1 +// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @"_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a", { 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 2, 1 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #0 = { nounwind } // CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} @@ -353,69 +353,69 @@ fn Convert() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "PassPtr", linkageName: "_CPassPtr.Main", scope: null, file: !6, line: 14, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !18) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{null, !17} -// CHECK:STDOUT: !17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !18 = !{!19} -// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !14, type: !17) -// CHECK:STDOUT: !20 = !DILocation(line: 14, column: 1, scope: !14) -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "PassNonnullPtr", linkageName: "_CPassNonnullPtr.Main", scope: null, file: !6, line: 19, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !22) -// CHECK:STDOUT: !22 = !{!23} -// CHECK:STDOUT: !23 = !DILocalVariable(arg: 1, scope: !21, type: !17) -// CHECK:STDOUT: !24 = !DILocation(line: 22, column: 15, scope: !21) -// CHECK:STDOUT: !25 = !DILocation(line: 22, column: 3, scope: !21) -// CHECK:STDOUT: !26 = !DILocation(line: 19, column: 1, scope: !21) -// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "Op", linkageName: "_COp.52ae03024b07a1ce:core.Destroy.Core", scope: null, file: !6, line: 22, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !28) -// CHECK:STDOUT: !28 = !{!29} -// CHECK:STDOUT: !29 = !DILocalVariable(arg: 1, scope: !27, type: !17) -// CHECK:STDOUT: !30 = !DILocation(line: 22, column: 15, scope: !27) -// CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Op", linkageName: "_COp.b17d31fafee11ec0:core.Destroy.Core", scope: null, file: !6, line: 22, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !32) -// CHECK:STDOUT: !32 = !{!33} -// CHECK:STDOUT: !33 = !DILocalVariable(arg: 1, scope: !31, type: !17) -// CHECK:STDOUT: !34 = !DILocation(line: 22, column: 15, scope: !31) -// CHECK:STDOUT: !35 = distinct !DISubprogram(name: "ReturnPtr", linkageName: "_CReturnPtr.Main", scope: null, file: !6, line: 25, type: !36, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !36 = !DISubroutineType(types: !37) -// CHECK:STDOUT: !37 = !{!17} -// CHECK:STDOUT: !38 = !DILocation(line: 26, column: 10, scope: !35) -// CHECK:STDOUT: !39 = !DILocation(line: 26, column: 3, scope: !35) -// CHECK:STDOUT: !40 = distinct !DISubprogram(name: "PassPtrWithThunk", linkageName: "_CPassPtrWithThunk.Main", scope: null, file: !6, line: 29, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !41) -// CHECK:STDOUT: !41 = !{!42} -// CHECK:STDOUT: !42 = !DILocalVariable(arg: 1, scope: !40, type: !17) -// CHECK:STDOUT: !43 = !DILocation(line: 29, column: 1, scope: !40) -// CHECK:STDOUT: !44 = distinct !DISubprogram(name: "PassNonnullPtrWithThunk", linkageName: "_CPassNonnullPtrWithThunk.Main", scope: null, file: !6, line: 34, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !45) -// CHECK:STDOUT: !45 = !{!46} -// CHECK:STDOUT: !46 = !DILocalVariable(arg: 1, scope: !44, type: !17) -// CHECK:STDOUT: !47 = !DILocation(line: 35, column: 24, scope: !44) -// CHECK:STDOUT: !48 = !DILocation(line: 35, column: 3, scope: !44) -// CHECK:STDOUT: !49 = !DILocation(line: 34, column: 1, scope: !44) -// CHECK:STDOUT: !50 = distinct !DISubprogram(name: "ReturnPtrWithThunk", linkageName: "_CReturnPtrWithThunk.Main", scope: null, file: !6, line: 38, type: !36, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "PassPtr", linkageName: "_CPassPtr.Main", scope: null, file: !6, line: 14, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !15) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null, !14} +// CHECK:STDOUT: !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !15 = !{!16} +// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !14) +// CHECK:STDOUT: !17 = !DILocation(line: 14, column: 1, scope: !11) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "PassNonnullPtr", linkageName: "_CPassNonnullPtr.Main", scope: null, file: !6, line: 19, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !19) +// CHECK:STDOUT: !19 = !{!20} +// CHECK:STDOUT: !20 = !DILocalVariable(arg: 1, scope: !18, type: !14) +// CHECK:STDOUT: !21 = !DILocation(line: 22, column: 15, scope: !18) +// CHECK:STDOUT: !22 = !DILocation(line: 22, column: 3, scope: !18) +// CHECK:STDOUT: !23 = !DILocation(line: 19, column: 1, scope: !18) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "Op", linkageName: "_COp.52ae03024b07a1ce:core.Destroy.Core", scope: null, file: !6, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !25) +// CHECK:STDOUT: !25 = !{!26} +// CHECK:STDOUT: !26 = !DILocalVariable(arg: 1, scope: !24, type: !14) +// CHECK:STDOUT: !27 = !DILocation(line: 22, column: 15, scope: !24) +// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Op", linkageName: "_COp.b17d31fafee11ec0:core.Destroy.Core", scope: null, file: !6, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !29) +// CHECK:STDOUT: !29 = !{!30} +// CHECK:STDOUT: !30 = !DILocalVariable(arg: 1, scope: !28, type: !14) +// CHECK:STDOUT: !31 = !DILocation(line: 22, column: 15, scope: !28) +// CHECK:STDOUT: !32 = distinct !DISubprogram(name: "ReturnPtr", linkageName: "_CReturnPtr.Main", scope: null, file: !6, line: 25, type: !33, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !33 = !DISubroutineType(types: !34) +// CHECK:STDOUT: !34 = !{!14} +// CHECK:STDOUT: !35 = !DILocation(line: 26, column: 10, scope: !32) +// CHECK:STDOUT: !36 = !DILocation(line: 26, column: 3, scope: !32) +// CHECK:STDOUT: !37 = distinct !DISubprogram(name: "PassPtrWithThunk", linkageName: "_CPassPtrWithThunk.Main", scope: null, file: !6, line: 29, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !38) +// CHECK:STDOUT: !38 = !{!39} +// CHECK:STDOUT: !39 = !DILocalVariable(arg: 1, scope: !37, type: !14) +// CHECK:STDOUT: !40 = !DILocation(line: 29, column: 1, scope: !37) +// CHECK:STDOUT: !41 = distinct !DISubprogram(name: "PassNonnullPtrWithThunk", linkageName: "_CPassNonnullPtrWithThunk.Main", scope: null, file: !6, line: 34, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !42) +// CHECK:STDOUT: !42 = !{!43} +// CHECK:STDOUT: !43 = !DILocalVariable(arg: 1, scope: !41, type: !14) +// CHECK:STDOUT: !44 = !DILocation(line: 35, column: 24, scope: !41) +// CHECK:STDOUT: !45 = !DILocation(line: 35, column: 3, scope: !41) +// CHECK:STDOUT: !46 = !DILocation(line: 34, column: 1, scope: !41) +// CHECK:STDOUT: !47 = !{!48, !48, i64 0} +// CHECK:STDOUT: !48 = !{!"p1 _ZTS1C", !49, i64 0} +// CHECK:STDOUT: !49 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !50 = distinct !DISubprogram(name: "ReturnPtrWithThunk", linkageName: "_CReturnPtrWithThunk.Main", scope: null, file: !6, line: 38, type: !33, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !51 = !DILocation(line: 39, column: 10, scope: !50) // CHECK:STDOUT: !52 = !DILocation(line: 39, column: 3, scope: !50) // CHECK:STDOUT: !53 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.e5cf8fcbb4feaae2:ImplicitAs.0f95c9e18c91e00a.Core.e76fd6d2be138e4a", scope: null, file: !54, line: 96, type: !55, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !57) // CHECK:STDOUT: !54 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "") // CHECK:STDOUT: !55 = !DISubroutineType(types: !56) -// CHECK:STDOUT: !56 = !{!17, !17} +// CHECK:STDOUT: !56 = !{!14, !14} // CHECK:STDOUT: !57 = !{!58} -// CHECK:STDOUT: !58 = !DILocalVariable(arg: 1, scope: !53, type: !17) +// CHECK:STDOUT: !58 = !DILocalVariable(arg: 1, scope: !53, type: !14) // CHECK:STDOUT: !59 = !DILocation(line: 97, column: 12, scope: !53) // CHECK:STDOUT: !60 = !DILocation(line: 97, column: 5, scope: !53) // CHECK:STDOUT: !61 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.90961d7b1ce4f089:OptionalAs.0e326e799dad0c64.Core.8f431b36581f9e63", scope: null, file: !54, line: 71, type: !55, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !62) // CHECK:STDOUT: !62 = !{!63} -// CHECK:STDOUT: !63 = !DILocalVariable(arg: 1, scope: !61, type: !17) +// CHECK:STDOUT: !63 = !DILocalVariable(arg: 1, scope: !61, type: !14) // CHECK:STDOUT: !64 = !DILocation(line: 72, column: 12, scope: !61) // CHECK:STDOUT: !65 = !DILocation(line: 72, column: 5, scope: !61) // CHECK:STDOUT: !66 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.8f431b36581f9e63", scope: null, file: !54, line: 30, type: !55, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !67) // CHECK:STDOUT: !67 = !{!68} -// CHECK:STDOUT: !68 = !DILocalVariable(arg: 1, scope: !66, type: !17) +// CHECK:STDOUT: !68 = !DILocalVariable(arg: 1, scope: !66, type: !14) // CHECK:STDOUT: !69 = !DILocation(line: 31, column: 12, scope: !66) // CHECK:STDOUT: !70 = !DILocation(line: 31, column: 5, scope: !66) // CHECK:STDOUT: !71 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.e8f8f92d3d08d149:OptionalStorage.Core.f53db17714b9f655", scope: null, file: !54, line: 150, type: !55, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !72) // CHECK:STDOUT: !72 = !{!73} -// CHECK:STDOUT: !73 = !DILocalVariable(arg: 1, scope: !71, type: !17) +// CHECK:STDOUT: !73 = !DILocalVariable(arg: 1, scope: !71, type: !14) // CHECK:STDOUT: !74 = !DILocation(line: 151, column: 14, scope: !71) // CHECK:STDOUT: !75 = !DILocation(line: 153, column: 5, scope: !71) // CHECK:STDOUT: !76 = !DILocation(line: 151, column: 18, scope: !71) diff --git a/toolchain/lower/testdata/interop/cpp/reference.carbon b/toolchain/lower/testdata/interop/cpp/reference.carbon index 0293df59b2c0..6204c388ba22 100644 --- a/toolchain/lower/testdata/interop/cpp/reference.carbon +++ b/toolchain/lower/testdata/interop/cpp/reference.carbon @@ -137,105 +137,97 @@ fn GetRefs() { // CHECK:STDOUT: @int_42.c68 = internal constant i32 42 // CHECK:STDOUT: @C.val.loc19_20.3 = internal constant {} zeroinitializer // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassRefs.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !14 +// CHECK:STDOUT: %.loc19_18.2.temp = alloca {}, align 8, !dbg !15 +// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !16 +// CHECK:STDOUT: %.loc24_22.3.temp = alloca i32, align 4, !dbg !17 +// CHECK:STDOUT: %.loc25_23.2.temp = alloca i32, align 4, !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !14 +// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr %c.var), !dbg !14 +// CHECK:STDOUT: call void @_Z8TakeCRefR1C(ptr %c.var), !dbg !19 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc19_18.2.temp), !dbg !15 +// CHECK:STDOUT: call void @_Z9TakeCRRefO1C.carbon_thunk(ptr @C.val.loc19_20.3), !dbg !20 +// CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr %c.var), !dbg !21 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !16 +// CHECK:STDOUT: store i32 poison, ptr %n.var, align 4, !dbg !16 +// CHECK:STDOUT: call void @_Z10TakeIntRefRi(ptr %n.var), !dbg !22 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc24_22.3.temp), !dbg !17 +// CHECK:STDOUT: call void @_Z11TakeIntRRefOi.carbon_thunk(ptr @int_42.c68), !dbg !23 +// CHECK:STDOUT: %.loc25_23.1 = load i32, ptr %n.var, align 4, !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc25_23.2.temp), !dbg !18 +// CHECK:STDOUT: store i32 %.loc25_23.1, ptr %.loc25_23.2.temp, align 4, !dbg !18 +// CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr %.loc25_23.2.temp), !dbg !24 +// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %.loc25_23.2.temp), !dbg !18 +// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr @int_42.c68), !dbg !17 +// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %n.var), !dbg !16 +// CHECK:STDOUT: ret void, !dbg !25 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress nounwind uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !26 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !26 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_COp:thunk.C.Cpp"(ptr sret({}) %return) #2 !dbg !29 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %return), !dbg !33 +// CHECK:STDOUT: ret void, !dbg !33 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z8TakeCRefR1C(ptr noundef nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z9TakeCRRefO1C.carbon_thunk(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z9TakeCRRefO1C.carbon_thunk(ptr noundef %0) #4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !26 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !26 // CHECK:STDOUT: call void @_Z9TakeCRRefO1C(ptr noundef nonnull align 1 dereferenceable(1) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z9TakeCRRefO1C(ptr noundef nonnull align 1 dereferenceable(1)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr noundef %0) #4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !26 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !26 // CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C(ptr noundef nonnull align 1 dereferenceable(1) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C(ptr noundef nonnull align 1 dereferenceable(1)) #2 +// CHECK:STDOUT: declare void @_Z10TakeIntRefRi(ptr noundef nonnull align 4 dereferenceable(4)) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi.carbon_thunk(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z11TakeIntRRefOi.carbon_thunk(ptr noundef %0) #4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !34 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !34 // CHECK:STDOUT: call void @_Z11TakeIntRRefOi(ptr noundef nonnull align 4 dereferenceable(4) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi(ptr noundef nonnull align 4 dereferenceable(4)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr noundef %0) #4 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !34 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !34 // CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi(ptr noundef nonnull align 4 dereferenceable(4) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi(ptr noundef nonnull align 4 dereferenceable(4)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassRefs.Main() #3 !dbg !16 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !19 -// CHECK:STDOUT: %.loc19_18.2.temp = alloca {}, align 8, !dbg !20 -// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !21 -// CHECK:STDOUT: %.loc24_22.3.temp = alloca i32, align 4, !dbg !22 -// CHECK:STDOUT: %.loc25_23.2.temp = alloca i32, align 4, !dbg !23 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !19 -// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr %c.var), !dbg !19 -// CHECK:STDOUT: call void @_Z8TakeCRefR1C(ptr %c.var), !dbg !24 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc19_18.2.temp), !dbg !20 -// CHECK:STDOUT: call void @_Z9TakeCRRefO1C.carbon_thunk(ptr @C.val.loc19_20.3), !dbg !25 -// CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C.carbon_thunk(ptr %c.var), !dbg !26 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !21 -// CHECK:STDOUT: store i32 poison, ptr %n.var, align 4, !dbg !21 -// CHECK:STDOUT: call void @_Z10TakeIntRefRi(ptr %n.var), !dbg !27 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc24_22.3.temp), !dbg !22 -// CHECK:STDOUT: call void @_Z11TakeIntRRefOi.carbon_thunk(ptr @int_42.c68), !dbg !28 -// CHECK:STDOUT: %.loc25_23.1 = load i32, ptr %n.var, align 4, !dbg !23 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc25_23.2.temp), !dbg !23 -// CHECK:STDOUT: store i32 %.loc25_23.1, ptr %.loc25_23.2.temp, align 4, !dbg !23 -// CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi.carbon_thunk(ptr %.loc25_23.2.temp), !dbg !29 -// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %.loc25_23.2.temp), !dbg !23 -// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr @int_42.c68), !dbg !22 -// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %n.var), !dbg !21 -// CHECK:STDOUT: ret void, !dbg !30 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind -// CHECK:STDOUT: define void @"_COp:thunk.C.Cpp"(ptr sret({}) %return) #4 !dbg !31 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %return), !dbg !35 -// CHECK:STDOUT: ret void, !dbg !35 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z8TakeCRefR1C(ptr noundef nonnull align 1 dereferenceable(1)) #2 -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z10TakeIntRefRi(ptr noundef nonnull align 4 dereferenceable(4)) #2 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #3 !dbg !36 { +// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !36 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !42 // CHECK:STDOUT: } @@ -244,20 +236,28 @@ fn GetRefs() { // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #5 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr sret({}) %return) #3 !dbg !43 { +// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr sret({}) %return) #0 !dbg !43 { // CHECK:STDOUT: call void @"_COp:thunk.C.Cpp"(ptr %return), !dbg !45 // CHECK:STDOUT: ret void, !dbg !46 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z9TakeCRRefO1C(ptr noundef nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C(ptr noundef nonnull align 1 dereferenceable(1)) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi(ptr noundef nonnull align 4 dereferenceable(4)) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi(ptr noundef nonnull align 4 dereferenceable(4)) #3 +// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @"_COp.7e389eab4a7e5487:core.Destroy.Core", { 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { nounwind } -// CHECK:STDOUT: attributes #4 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #4 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} @@ -275,31 +275,31 @@ fn GetRefs() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"p1 int", !13, i64 0} -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "PassRefs", linkageName: "_CPassRefs.Main", scope: null, file: !6, line: 16, type: !17, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !17 = !DISubroutineType(types: !18) -// CHECK:STDOUT: !18 = !{null} -// CHECK:STDOUT: !19 = !DILocation(line: 17, column: 3, scope: !16) -// CHECK:STDOUT: !20 = !DILocation(line: 19, column: 17, scope: !16) -// CHECK:STDOUT: !21 = !DILocation(line: 22, column: 3, scope: !16) -// CHECK:STDOUT: !22 = !DILocation(line: 24, column: 19, scope: !16) -// CHECK:STDOUT: !23 = !DILocation(line: 25, column: 23, scope: !16) -// CHECK:STDOUT: !24 = !DILocation(line: 18, column: 3, scope: !16) -// CHECK:STDOUT: !25 = !DILocation(line: 19, column: 3, scope: !16) -// CHECK:STDOUT: !26 = !DILocation(line: 20, column: 3, scope: !16) -// CHECK:STDOUT: !27 = !DILocation(line: 23, column: 3, scope: !16) -// CHECK:STDOUT: !28 = !DILocation(line: 24, column: 3, scope: !16) -// CHECK:STDOUT: !29 = !DILocation(line: 25, column: 3, scope: !16) -// CHECK:STDOUT: !30 = !DILocation(line: 16, column: 1, scope: !16) -// CHECK:STDOUT: !31 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.C.Cpp", scope: null, file: !6, line: 5, type: !32, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !32 = !DISubroutineType(types: !33) -// CHECK:STDOUT: !33 = !{!34} -// CHECK:STDOUT: !34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !35 = !DILocation(line: 5, column: 7, scope: !31) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "PassRefs", linkageName: "_CPassRefs.Main", scope: null, file: !6, line: 16, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 17, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 19, column: 17, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 22, column: 3, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 24, column: 19, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 25, column: 23, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 18, column: 3, scope: !11) +// CHECK:STDOUT: !20 = !DILocation(line: 19, column: 3, scope: !11) +// CHECK:STDOUT: !21 = !DILocation(line: 20, column: 3, scope: !11) +// CHECK:STDOUT: !22 = !DILocation(line: 23, column: 3, scope: !11) +// CHECK:STDOUT: !23 = !DILocation(line: 24, column: 3, scope: !11) +// CHECK:STDOUT: !24 = !DILocation(line: 25, column: 3, scope: !11) +// CHECK:STDOUT: !25 = !DILocation(line: 16, column: 1, scope: !11) +// CHECK:STDOUT: !26 = !{!27, !27, i64 0} +// CHECK:STDOUT: !27 = !{!"p1 _ZTS1C", !28, i64 0} +// CHECK:STDOUT: !28 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.C.Cpp", scope: null, file: !6, line: 5, type: !30, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !30 = !DISubroutineType(types: !31) +// CHECK:STDOUT: !31 = !{!32} +// CHECK:STDOUT: !32 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !33 = !DILocation(line: 5, column: 7, scope: !29) +// CHECK:STDOUT: !34 = !{!35, !35, i64 0} +// CHECK:STDOUT: !35 = !{!"p1 int", !28, i64 0} // CHECK:STDOUT: !36 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !6, line: 25, type: !37, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !40) // CHECK:STDOUT: !37 = !DISubroutineType(types: !38) // CHECK:STDOUT: !38 = !{null, !39} @@ -307,7 +307,7 @@ fn GetRefs() { // CHECK:STDOUT: !40 = !{!41} // CHECK:STDOUT: !41 = !DILocalVariable(arg: 1, scope: !36, type: !39) // CHECK:STDOUT: !42 = !DILocation(line: 25, column: 23, scope: !36) -// CHECK:STDOUT: !43 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b", scope: null, file: !44, line: 9, type: !32, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !43 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b", scope: null, file: !44, line: 9, type: !30, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !44 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "") // CHECK:STDOUT: !45 = !DILocation(line: 9, column: 28, scope: !43) // CHECK:STDOUT: !46 = !DILocation(line: 9, column: 21, scope: !43) @@ -322,154 +322,154 @@ fn GetRefs() { // CHECK:STDOUT: @int_42.c68 = internal constant i32 42 // CHECK:STDOUT: @C.val.loc20_20.3 = internal constant {} zeroinitializer // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CPassRefs.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !14 +// CHECK:STDOUT: %.loc20_18.2.temp = alloca {}, align 8, !dbg !15 +// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !16 +// CHECK:STDOUT: %.loc25_22.3.temp = alloca i32, align 4, !dbg !17 +// CHECK:STDOUT: %.loc26_23.2.temp = alloca i32, align 4, !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !14 +// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr %c.var), !dbg !14 +// CHECK:STDOUT: call void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr %c.var), !dbg !19 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc20_18.2.temp), !dbg !15 +// CHECK:STDOUT: call void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr @C.val.loc20_20.3), !dbg !20 +// CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr %c.var), !dbg !21 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !16 +// CHECK:STDOUT: store i32 poison, ptr %n.var, align 4, !dbg !16 +// CHECK:STDOUT: call void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr %n.var), !dbg !22 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc25_22.3.temp), !dbg !17 +// CHECK:STDOUT: call void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr @int_42.c68), !dbg !23 +// CHECK:STDOUT: %.loc26_23.1 = load i32, ptr %n.var, align 4, !dbg !18 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc26_23.2.temp), !dbg !18 +// CHECK:STDOUT: store i32 %.loc26_23.1, ptr %.loc26_23.2.temp, align 4, !dbg !18 +// CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr %.loc26_23.2.temp), !dbg !24 +// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %.loc26_23.2.temp), !dbg !18 +// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr @int_42.c68), !dbg !17 +// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %n.var), !dbg !16 +// CHECK:STDOUT: ret void, !dbg !25 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress nounwind uwtable -// CHECK:STDOUT: define dso_local void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1CC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !26 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !26 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind +// CHECK:STDOUT: define void @"_COp:thunk.C.Cpp"(ptr sret({}) %return) #2 !dbg !29 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %return), !dbg !33 +// CHECK:STDOUT: ret void, !dbg !33 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr noundef nonnull align 1 dereferenceable(1) %0) #1 { +// CHECK:STDOUT: define internal void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr noundef nonnull align 1 dereferenceable(1) %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11, !nonnull !14 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !26 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !26, !nonnull !34 // CHECK:STDOUT: call void @_Z8TakeCRefR1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z8TakeCRefR1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr noundef %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !26 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !26 // CHECK:STDOUT: call void @_Z9TakeCRRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z9TakeCRRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr noundef %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !26 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !26 // CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr noundef nonnull align 4 dereferenceable(4) %0) #1 { +// CHECK:STDOUT: define internal void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr noundef nonnull align 4 dereferenceable(4) %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !15 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !15, !nonnull !14, !align !17 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !35 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !35, !nonnull !34, !align !37 // CHECK:STDOUT: call void @_Z10TakeIntRefRi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z10TakeIntRefRi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr noundef %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !15 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !15 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !35 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !35 // CHECK:STDOUT: call void @_Z11TakeIntRRefOi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr noundef %0) #1 { +// CHECK:STDOUT: define internal void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr noundef %0) #3 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !15 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !15 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !35 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !35 // CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4) %1) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #2 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassRefs.Main() #3 !dbg !18 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !21 -// CHECK:STDOUT: %.loc20_18.2.temp = alloca {}, align 8, !dbg !22 -// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !23 -// CHECK:STDOUT: %.loc25_22.3.temp = alloca i32, align 4, !dbg !24 -// CHECK:STDOUT: %.loc26_23.2.temp = alloca i32, align 4, !dbg !25 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !21 -// CHECK:STDOUT: call void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr %c.var), !dbg !21 -// CHECK:STDOUT: call void @_Z8TakeCRefR1C10ForceThunk.carbon_thunk1(ptr %c.var), !dbg !26 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc20_18.2.temp), !dbg !22 -// CHECK:STDOUT: call void @_Z9TakeCRRefRK1C10ForceThunk.carbon_thunk1(ptr @C.val.loc20_20.3), !dbg !27 -// CHECK:STDOUT: call void @_Z13TakeConstCRefRK1C10ForceThunk.carbon_thunk1(ptr %c.var), !dbg !28 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !23 -// CHECK:STDOUT: store i32 poison, ptr %n.var, align 4, !dbg !23 -// CHECK:STDOUT: call void @_Z10TakeIntRefRi10ForceThunk.carbon_thunk1(ptr %n.var), !dbg !29 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc25_22.3.temp), !dbg !24 -// CHECK:STDOUT: call void @_Z11TakeIntRRefOi10ForceThunk.carbon_thunk1(ptr @int_42.c68), !dbg !30 -// CHECK:STDOUT: %.loc26_23.1 = load i32, ptr %n.var, align 4, !dbg !25 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc26_23.2.temp), !dbg !25 -// CHECK:STDOUT: store i32 %.loc26_23.1, ptr %.loc26_23.2.temp, align 4, !dbg !25 -// CHECK:STDOUT: call void @_Z15TakeConstIntRefRKi10ForceThunk.carbon_thunk1(ptr %.loc26_23.2.temp), !dbg !31 -// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %.loc26_23.2.temp), !dbg !25 -// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr @int_42.c68), !dbg !24 -// CHECK:STDOUT: call void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %n.var), !dbg !23 -// CHECK:STDOUT: ret void, !dbg !32 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind -// CHECK:STDOUT: define void @"_COp:thunk.C.Cpp"(ptr sret({}) %return) #4 !dbg !33 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_ZN1CC1Ev.carbon_thunk(ptr %return), !dbg !37 -// CHECK:STDOUT: ret void, !dbg !37 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #3 !dbg !38 { +// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !38 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #5 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr sret({}) %return) #3 !dbg !45 { +// CHECK:STDOUT: define linkonce_odr void @"_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b"(ptr sret({}) %return) #0 !dbg !45 { // CHECK:STDOUT: call void @"_COp:thunk.C.Cpp"(ptr %return), !dbg !47 // CHECK:STDOUT: ret void, !dbg !48 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z8TakeCRefR1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #5 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z9TakeCRRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #5 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z13TakeConstCRefRK1C10ForceThunk(ptr noundef nonnull align 1 dereferenceable(1)) #5 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z10TakeIntRefRi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #5 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z11TakeIntRRefOi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #5 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z15TakeConstIntRefRKi10ForceThunk(ptr noundef nonnull align 4 dereferenceable(4)) #5 +// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @"_COp.7e389eab4a7e5487:core.Destroy.Core", { 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { nounwind } -// CHECK:STDOUT: attributes #4 = { alwaysinline nounwind } -// CHECK:STDOUT: attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { alwaysinline nounwind } +// CHECK:STDOUT: attributes #3 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -486,33 +486,33 @@ fn GetRefs() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{} -// CHECK:STDOUT: !15 = !{!16, !16, i64 0} -// CHECK:STDOUT: !16 = !{!"p1 int", !13, i64 0} -// CHECK:STDOUT: !17 = !{i64 4} -// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "PassRefs", linkageName: "_CPassRefs.Main", scope: null, file: !6, line: 17, type: !19, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !19 = !DISubroutineType(types: !20) -// CHECK:STDOUT: !20 = !{null} -// CHECK:STDOUT: !21 = !DILocation(line: 18, column: 3, scope: !18) -// CHECK:STDOUT: !22 = !DILocation(line: 20, column: 17, scope: !18) -// CHECK:STDOUT: !23 = !DILocation(line: 23, column: 3, scope: !18) -// CHECK:STDOUT: !24 = !DILocation(line: 25, column: 19, scope: !18) -// CHECK:STDOUT: !25 = !DILocation(line: 26, column: 23, scope: !18) -// CHECK:STDOUT: !26 = !DILocation(line: 19, column: 3, scope: !18) -// CHECK:STDOUT: !27 = !DILocation(line: 20, column: 3, scope: !18) -// CHECK:STDOUT: !28 = !DILocation(line: 21, column: 3, scope: !18) -// CHECK:STDOUT: !29 = !DILocation(line: 24, column: 3, scope: !18) -// CHECK:STDOUT: !30 = !DILocation(line: 25, column: 3, scope: !18) -// CHECK:STDOUT: !31 = !DILocation(line: 26, column: 3, scope: !18) -// CHECK:STDOUT: !32 = !DILocation(line: 17, column: 1, scope: !18) -// CHECK:STDOUT: !33 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.C.Cpp", scope: null, file: !6, line: 5, type: !34, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !34 = !DISubroutineType(types: !35) -// CHECK:STDOUT: !35 = !{!36} -// CHECK:STDOUT: !36 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !37 = !DILocation(line: 5, column: 7, scope: !33) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "PassRefs", linkageName: "_CPassRefs.Main", scope: null, file: !6, line: 17, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 18, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 20, column: 17, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 23, column: 3, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 25, column: 19, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 26, column: 23, scope: !11) +// CHECK:STDOUT: !19 = !DILocation(line: 19, column: 3, scope: !11) +// CHECK:STDOUT: !20 = !DILocation(line: 20, column: 3, scope: !11) +// CHECK:STDOUT: !21 = !DILocation(line: 21, column: 3, scope: !11) +// CHECK:STDOUT: !22 = !DILocation(line: 24, column: 3, scope: !11) +// CHECK:STDOUT: !23 = !DILocation(line: 25, column: 3, scope: !11) +// CHECK:STDOUT: !24 = !DILocation(line: 26, column: 3, scope: !11) +// CHECK:STDOUT: !25 = !DILocation(line: 17, column: 1, scope: !11) +// CHECK:STDOUT: !26 = !{!27, !27, i64 0} +// CHECK:STDOUT: !27 = !{!"p1 _ZTS1C", !28, i64 0} +// CHECK:STDOUT: !28 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.C.Cpp", scope: null, file: !6, line: 5, type: !30, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !30 = !DISubroutineType(types: !31) +// CHECK:STDOUT: !31 = !{!32} +// CHECK:STDOUT: !32 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !33 = !DILocation(line: 5, column: 7, scope: !29) +// CHECK:STDOUT: !34 = !{} +// CHECK:STDOUT: !35 = !{!36, !36, i64 0} +// CHECK:STDOUT: !36 = !{!"p1 int", !28, i64 0} +// CHECK:STDOUT: !37 = !{i64 4} // CHECK:STDOUT: !38 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !6, line: 26, type: !39, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !42) // CHECK:STDOUT: !39 = !DISubroutineType(types: !40) // CHECK:STDOUT: !40 = !{null, !41} @@ -520,7 +520,7 @@ fn GetRefs() { // CHECK:STDOUT: !42 = !{!43} // CHECK:STDOUT: !43 = !DILocalVariable(arg: 1, scope: !38, type: !41) // CHECK:STDOUT: !44 = !DILocation(line: 26, column: 23, scope: !38) -// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b", scope: null, file: !46, line: 9, type: !34, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "Op", linkageName: "_COp.9b0a46309e124f8a:DefaultOrUnformed.Core.93349b0fe912a29b", scope: null, file: !46, line: 9, type: !30, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !46 = !DIFile(filename: "min_prelude/parts/default.carbon", directory: "") // CHECK:STDOUT: !47 = !DILocation(line: 9, column: 28, scope: !45) // CHECK:STDOUT: !48 = !DILocation(line: 9, column: 21, scope: !45) @@ -588,68 +588,8 @@ fn GetRefs() { // CHECK:STDOUT: // CHECK:STDOUT: %class.ForceThunk = type { i8 } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk.carbon_thunk0() #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 -// CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() -// CHECK:STDOUT: ret ptr %call -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CGetRefs.Main() #2 !dbg !11 { +// CHECK:STDOUT: define void @_CGetRefs.Main() #0 !dbg !11 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnCRef__carbon_thunk.call = call ptr @_Z10ReturnCRef10ForceThunk.carbon_thunk0(), !dbg !14 // CHECK:STDOUT: %ReturnCRRef__carbon_thunk.call = call ptr @_Z11ReturnCRRef10ForceThunk.carbon_thunk0(), !dbg !15 @@ -660,9 +600,69 @@ fn GetRefs() { // CHECK:STDOUT: ret void, !dbg !20 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 +// CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 +// CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 +// CHECK:STDOUT: %call = call noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 +// CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 +// CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk.carbon_thunk0() #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %agg.tmp = alloca %class.ForceThunk, align 1 +// CHECK:STDOUT: %call = call noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() +// CHECK:STDOUT: ret ptr %call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z10ReturnCRef10ForceThunk() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z11ReturnCRRef10ForceThunk() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef nonnull align 1 dereferenceable(1) ptr @_Z15ReturnConstCRef10ForceThunk() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z12ReturnIntRef10ForceThunk() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z13ReturnIntRRef10ForceThunk() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef nonnull align 4 dereferenceable(4) ptr @_Z17ReturnConstIntRef10ForceThunk() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} diff --git a/toolchain/lower/testdata/interop/cpp/return.carbon b/toolchain/lower/testdata/interop/cpp/return.carbon index 086333bdf4b9..69d8f449ed34 100644 --- a/toolchain/lower/testdata/interop/cpp/return.carbon +++ b/toolchain/lower/testdata/interop/cpp/return.carbon @@ -117,98 +117,68 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" // CHECK:STDOUT: target triple = "x86_64-unknown-linux-gnu" // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i8 @_CGetU8.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc6_40.1.temp = alloca i8, align 1, !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc6_40.1.temp), !dbg !15 +// CHECK:STDOUT: call void @_Z8ReturnU8v.carbon_thunk(ptr %.loc6_40.1.temp), !dbg !15 +// CHECK:STDOUT: %0 = load i8, ptr %.loc6_40.1.temp, align 1, !dbg !16 +// CHECK:STDOUT: ret i8 %0, !dbg !16 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z8ReturnU8v.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_Z8ReturnU8v.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !17 // CHECK:STDOUT: %call = call noundef zeroext i8 @_Z8ReturnU8v() -// CHECK:STDOUT: store i8 %call, ptr %0, align 1, !tbaa !14 +// CHECK:STDOUT: store i8 %call, ptr %0, align 1, !tbaa !20 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare noundef zeroext i8 @_Z8ReturnU8v() #1 +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i16 @_CGetU16.Main() #0 !dbg !21 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7_43.1.temp = alloca i16, align 2, !dbg !25 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_43.1.temp), !dbg !25 +// CHECK:STDOUT: call void @_Z9ReturnU16v.carbon_thunk(ptr %.loc7_43.1.temp), !dbg !25 +// CHECK:STDOUT: %0 = load i16, ptr %.loc7_43.1.temp, align 2, !dbg !26 +// CHECK:STDOUT: ret i16 %0, !dbg !26 +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z9ReturnU16v.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_Z9ReturnU16v.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !15 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !15 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !27 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !27 // CHECK:STDOUT: %call = call noundef zeroext i16 @_Z9ReturnU16v() -// CHECK:STDOUT: store i16 %call, ptr %0, align 2, !tbaa !17 +// CHECK:STDOUT: store i16 %call, ptr %0, align 2, !tbaa !29 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare noundef zeroext i16 @_Z9ReturnU16v() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z8ReturnI8v.carbon_thunk(ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %call = call noundef signext i8 @_Z8ReturnI8v() -// CHECK:STDOUT: store i8 %call, ptr %0, align 1, !tbaa !14 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef signext i8 @_Z8ReturnI8v() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z9ReturnI16v.carbon_thunk(ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !15 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !15 -// CHECK:STDOUT: %call = call noundef signext i16 @_Z9ReturnI16v() -// CHECK:STDOUT: store i16 %call, ptr %0, align 2, !tbaa !17 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare noundef signext i16 @_Z9ReturnI16v() #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i8 @_CGetU8.Main() #2 !dbg !19 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc6_40.1.temp = alloca i8, align 1, !dbg !23 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc6_40.1.temp), !dbg !23 -// CHECK:STDOUT: call void @_Z8ReturnU8v.carbon_thunk(ptr %.loc6_40.1.temp), !dbg !23 -// CHECK:STDOUT: %0 = load i8, ptr %.loc6_40.1.temp, align 1, !dbg !24 -// CHECK:STDOUT: ret i8 %0, !dbg !24 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i16 @_CGetU16.Main() #2 !dbg !25 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_43.1.temp = alloca i16, align 2, !dbg !29 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc7_43.1.temp), !dbg !29 -// CHECK:STDOUT: call void @_Z9ReturnU16v.carbon_thunk(ptr %.loc7_43.1.temp), !dbg !29 -// CHECK:STDOUT: %0 = load i16, ptr %.loc7_43.1.temp, align 2, !dbg !30 -// CHECK:STDOUT: ret i16 %0, !dbg !30 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CGetU32.Main() #2 !dbg !31 { +// CHECK:STDOUT: define i32 @_CGetU32.Main() #0 !dbg !31 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnU32.call = call i32 @_Z9ReturnU32v(), !dbg !35 // CHECK:STDOUT: ret i32 %ReturnU32.call, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare noundef i32 @_Z9ReturnU32v() #1 +// CHECK:STDOUT: declare noundef i32 @_Z9ReturnU32v() #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i64 @_CGetU64.Main() #2 !dbg !37 { +// CHECK:STDOUT: define i64 @_CGetU64.Main() #0 !dbg !37 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnU64.call = call i64 @_Z9ReturnU64v(), !dbg !41 // CHECK:STDOUT: ret i64 %ReturnU64.call, !dbg !42 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare noundef i64 @_Z9ReturnU64v() #1 +// CHECK:STDOUT: declare noundef i64 @_Z9ReturnU64v() #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i8 @_CGetI8.Main() #2 !dbg !43 { +// CHECK:STDOUT: define i8 @_CGetI8.Main() #0 !dbg !43 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc11_40.1.temp = alloca i8, align 1, !dbg !47 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc11_40.1.temp), !dbg !47 @@ -217,8 +187,19 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: ret i8 %0, !dbg !48 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z8ReturnI8v.carbon_thunk(ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %call = call noundef signext i8 @_Z8ReturnI8v() +// CHECK:STDOUT: store i8 %call, ptr %0, align 1, !tbaa !20 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i16 @_CGetI16.Main() #2 !dbg !49 { +// CHECK:STDOUT: define i16 @_CGetI16.Main() #0 !dbg !49 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc12_43.1.temp = alloca i16, align 2, !dbg !53 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_43.1.temp), !dbg !53 @@ -227,28 +208,39 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: ret i16 %0, !dbg !54 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z9ReturnI16v.carbon_thunk(ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !27 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !27 +// CHECK:STDOUT: %call = call noundef signext i16 @_Z9ReturnI16v() +// CHECK:STDOUT: store i16 %call, ptr %0, align 2, !tbaa !29 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CGetI32.Main() #2 !dbg !55 { +// CHECK:STDOUT: define i32 @_CGetI32.Main() #0 !dbg !55 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnI32.call = call i32 @_Z9ReturnI32v(), !dbg !59 // CHECK:STDOUT: ret i32 %ReturnI32.call, !dbg !60 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare noundef i32 @_Z9ReturnI32v() #1 +// CHECK:STDOUT: declare noundef i32 @_Z9ReturnI32v() #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i64 @_CGetI64.Main() #2 !dbg !61 { +// CHECK:STDOUT: define i64 @_CGetI64.Main() #0 !dbg !61 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ReturnI64.call = call i64 @_Z9ReturnI64v(), !dbg !65 // CHECK:STDOUT: ret i64 %ReturnI64.call, !dbg !66 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare noundef i64 @_Z9ReturnI64v() #1 +// CHECK:STDOUT: declare noundef i64 @_Z9ReturnI64v() #2 // CHECK:STDOUT: // CHECK:STDOUT: declare void @_CUse.Main(i8, i16, i32, i64, i8, i16, i32, i64) // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CLets.Main() #2 !dbg !67 { +// CHECK:STDOUT: define void @_CLets.Main() #0 !dbg !67 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc19_32.1.temp = alloca i8, align 1, !dbg !70 // CHECK:STDOUT: %.loc20_35.1.temp = alloca i16, align 2, !dbg !71 @@ -279,31 +271,31 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.406738f1b62008ed:core.Destroy.Core"(ptr %self) #2 !dbg !80 { +// CHECK:STDOUT: define weak_odr void @"_COp.406738f1b62008ed:core.Destroy.Core"(ptr %self) #0 !dbg !80 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !85 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.43bece552030817c:core.Destroy.Core"(ptr %self) #2 !dbg !86 { +// CHECK:STDOUT: define weak_odr void @"_COp.43bece552030817c:core.Destroy.Core"(ptr %self) #0 !dbg !86 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !91 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.ecaf8c3e76291eee:core.Destroy.Core"(ptr %self) #2 !dbg !92 { +// CHECK:STDOUT: define weak_odr void @"_COp.ecaf8c3e76291eee:core.Destroy.Core"(ptr %self) #0 !dbg !92 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !97 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.3de38e83520d6bec:core.Destroy.Core"(ptr %self) #2 !dbg !98 { +// CHECK:STDOUT: define weak_odr void @"_COp.3de38e83520d6bec:core.Destroy.Core"(ptr %self) #0 !dbg !98 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !103 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CVars.Main() #2 !dbg !104 { +// CHECK:STDOUT: define void @_CVars.Main() #0 !dbg !104 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %my_u8.var = alloca i8, align 1, !dbg !105 // CHECK:STDOUT: %my_u16.var = alloca i16, align 2, !dbg !106 @@ -354,25 +346,25 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.0d6779e60704359e:core.Destroy.Core"(ptr %self) #2 !dbg !131 { +// CHECK:STDOUT: define weak_odr void @"_COp.0d6779e60704359e:core.Destroy.Core"(ptr %self) #0 !dbg !131 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !136 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #2 !dbg !137 { +// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !137 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !142 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.798ffd80cf2992c3:core.Destroy.Core"(ptr %self) #2 !dbg !143 { +// CHECK:STDOUT: define weak_odr void @"_COp.798ffd80cf2992c3:core.Destroy.Core"(ptr %self) #0 !dbg !143 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !148 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.dab1523ded6661cc:core.Destroy.Core"(ptr %self) #2 !dbg !149 { +// CHECK:STDOUT: define weak_odr void @"_COp.dab1523ded6661cc:core.Destroy.Core"(ptr %self) #0 !dbg !149 { // CHECK:STDOUT: entry: // CHECK:STDOUT: ret void, !dbg !154 // CHECK:STDOUT: } @@ -380,12 +372,20 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) // CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 // CHECK:STDOUT: +// CHECK:STDOUT: declare noundef zeroext i8 @_Z8ReturnU8v() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef zeroext i16 @_Z9ReturnU16v() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef signext i8 @_Z8ReturnI8v() #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare noundef signext i16 @_Z9ReturnI16v() #2 +// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} @@ -403,26 +403,26 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 omnipotent char", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!9, !9, i64 0} -// CHECK:STDOUT: !15 = !{!16, !16, i64 0} -// CHECK:STDOUT: !16 = !{!"p1 short", !13, i64 0} +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "GetU8", linkageName: "_CGetU8.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{!14} +// CHECK:STDOUT: !14 = !DIBasicType(name: "int", size: 8, encoding: DW_ATE_unsigned) +// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 27, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 6, column: 20, scope: !11) // CHECK:STDOUT: !17 = !{!18, !18, i64 0} -// CHECK:STDOUT: !18 = !{!"short", !9, i64 0} -// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "GetU8", linkageName: "_CGetU8.Main", scope: null, file: !6, line: 6, type: !20, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !20 = !DISubroutineType(types: !21) -// CHECK:STDOUT: !21 = !{!22} -// CHECK:STDOUT: !22 = !DIBasicType(name: "int", size: 8, encoding: DW_ATE_unsigned) -// CHECK:STDOUT: !23 = !DILocation(line: 6, column: 27, scope: !19) -// CHECK:STDOUT: !24 = !DILocation(line: 6, column: 20, scope: !19) -// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "GetU16", linkageName: "_CGetU16.Main", scope: null, file: !6, line: 7, type: !26, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !26 = !DISubroutineType(types: !27) -// CHECK:STDOUT: !27 = !{!28} -// CHECK:STDOUT: !28 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_unsigned) -// CHECK:STDOUT: !29 = !DILocation(line: 7, column: 29, scope: !25) -// CHECK:STDOUT: !30 = !DILocation(line: 7, column: 22, scope: !25) +// CHECK:STDOUT: !18 = !{!"p1 omnipotent char", !19, i64 0} +// CHECK:STDOUT: !19 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !20 = !{!9, !9, i64 0} +// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "GetU16", linkageName: "_CGetU16.Main", scope: null, file: !6, line: 7, type: !22, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !22 = !DISubroutineType(types: !23) +// CHECK:STDOUT: !23 = !{!24} +// CHECK:STDOUT: !24 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_unsigned) +// CHECK:STDOUT: !25 = !DILocation(line: 7, column: 29, scope: !21) +// CHECK:STDOUT: !26 = !DILocation(line: 7, column: 22, scope: !21) +// CHECK:STDOUT: !27 = !{!28, !28, i64 0} +// CHECK:STDOUT: !28 = !{!"p1 short", !19, i64 0} +// CHECK:STDOUT: !29 = !{!30, !30, i64 0} +// CHECK:STDOUT: !30 = !{!"short", !9, i64 0} // CHECK:STDOUT: !31 = distinct !DISubprogram(name: "GetU32", linkageName: "_CGetU32.Main", scope: null, file: !6, line: 8, type: !32, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !32 = !DISubroutineType(types: !33) // CHECK:STDOUT: !33 = !{!34} @@ -486,15 +486,15 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: !91 = !DILocation(line: 24, column: 19, scope: !86) // CHECK:STDOUT: !92 = distinct !DISubprogram(name: "Op", linkageName: "_COp.ecaf8c3e76291eee:core.Destroy.Core", scope: null, file: !6, line: 20, type: !93, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !95) // CHECK:STDOUT: !93 = !DISubroutineType(types: !94) -// CHECK:STDOUT: !94 = !{null, !28} +// CHECK:STDOUT: !94 = !{null, !24} // CHECK:STDOUT: !95 = !{!96} -// CHECK:STDOUT: !96 = !DILocalVariable(arg: 1, scope: !92, type: !28) +// CHECK:STDOUT: !96 = !DILocalVariable(arg: 1, scope: !92, type: !24) // CHECK:STDOUT: !97 = !DILocation(line: 20, column: 21, scope: !92) // CHECK:STDOUT: !98 = distinct !DISubprogram(name: "Op", linkageName: "_COp.3de38e83520d6bec:core.Destroy.Core", scope: null, file: !6, line: 19, type: !99, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !101) // CHECK:STDOUT: !99 = !DISubroutineType(types: !100) -// CHECK:STDOUT: !100 = !{null, !22} +// CHECK:STDOUT: !100 = !{null, !14} // CHECK:STDOUT: !101 = !{!102} -// CHECK:STDOUT: !102 = !DILocalVariable(arg: 1, scope: !98, type: !22) +// CHECK:STDOUT: !102 = !DILocalVariable(arg: 1, scope: !98, type: !14) // CHECK:STDOUT: !103 = !DILocation(line: 19, column: 19, scope: !98) // CHECK:STDOUT: !104 = distinct !DISubprogram(name: "Vars", linkageName: "_CVars.Main", scope: null, file: !6, line: 32, type: !68, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !105 = !DILocation(line: 33, column: 3, scope: !104) @@ -554,27 +554,25 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: // CHECK:STDOUT: %struct.X = type { ptr, ptr } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CGetX.Main(ptr sret([16 x i8]) %return) #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_Z4Makev.carbon_thunk(ptr %return), !dbg !15 +// CHECK:STDOUT: ret void, !dbg !16 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z4Makev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_Z4Makev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !17 // CHECK:STDOUT: call void @_Z4Makev(ptr dead_on_unwind writable sret(%struct.X) align 8 %0) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z4Makev(ptr dead_on_unwind writable sret(%struct.X) align 8) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CGetX.Main(ptr sret([16 x i8]) %return) #2 !dbg !14 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_Z4Makev.carbon_thunk(ptr %return), !dbg !18 -// CHECK:STDOUT: ret void, !dbg !19 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CLet.Main() #2 !dbg !20 { +// CHECK:STDOUT: define void @_CLet.Main() #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc9_27.1.temp = alloca [16 x i8], align 1, !dbg !23 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc9_27.1.temp), !dbg !23 @@ -584,10 +582,10 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: declare void @_ZN1XD1Ev(ptr noundef nonnull align 8 dead_on_return(16) dereferenceable(16)) unnamed_addr #3 +// CHECK:STDOUT: declare void @_ZN1XD1Ev(ptr noundef nonnull align 8 dead_on_return(16) dereferenceable(16)) unnamed_addr #2 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CVar.Main() #2 !dbg !25 { +// CHECK:STDOUT: define void @_CVar.Main() #0 !dbg !25 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !26 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !26 @@ -597,16 +595,18 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z4Makev(ptr dead_on_unwind writable sret(%struct.X) align 8) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -623,15 +623,15 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1X", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "GetX", linkageName: "_CGetX.Main", scope: null, file: !6, line: 6, type: !15, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{!17} -// CHECK:STDOUT: !17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !18 = !DILocation(line: 6, column: 29, scope: !14) -// CHECK:STDOUT: !19 = !DILocation(line: 6, column: 22, scope: !14) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "GetX", linkageName: "_CGetX.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{!14} +// CHECK:STDOUT: !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !15 = !DILocation(line: 6, column: 29, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 6, column: 22, scope: !11) +// CHECK:STDOUT: !17 = !{!18, !18, i64 0} +// CHECK:STDOUT: !18 = !{!"p1 _ZTS1X", !19, i64 0} +// CHECK:STDOUT: !19 = !{!"any pointer", !9, i64 0} // CHECK:STDOUT: !20 = distinct !DISubprogram(name: "Let", linkageName: "_CLet.Main", scope: null, file: !6, line: 8, type: !21, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !21 = !DISubroutineType(types: !22) // CHECK:STDOUT: !22 = !{null} @@ -649,33 +649,33 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: %class.D = type { i8 } // CHECK:STDOUT: %class.C = type { i8 } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall.Main(ptr sret({}) %return, ptr %x) #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: call void @_Z1f1D.carbon_thunk(ptr %x, ptr %return), !dbg !17 +// CHECK:STDOUT: ret void, !dbg !18 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z1f1D.carbon_thunk(ptr noundef %0, ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_Z1f1D.carbon_thunk(ptr noundef %0, ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.D, align 1 // CHECK:STDOUT: %undef.agg.tmp = alloca %class.C, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %2 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !19 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !22 +// CHECK:STDOUT: %1 = load ptr, ptr %return.addr, align 8, !tbaa !22 +// CHECK:STDOUT: %2 = load ptr, ptr %.addr, align 8, !tbaa !19 // CHECK:STDOUT: call void @_Z1f1D() // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z1f1D() #1 +// CHECK:STDOUT: declare void @_Z1f1D() #2 // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CCall.Main(ptr sret({}) %return, ptr %x) #2 !dbg !16 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_Z1f1D.carbon_thunk(ptr %x, ptr %return), !dbg !22 -// CHECK:STDOUT: ret void, !dbg !23 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -692,16 +692,16 @@ fn Call(x: Cpp.D) -> Cpp.C { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1D", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"p1 _ZTS1C", !13, i64 0} -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "Call", linkageName: "_CCall.Main", scope: null, file: !6, line: 10, type: !17, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20) -// CHECK:STDOUT: !17 = !DISubroutineType(types: !18) -// CHECK:STDOUT: !18 = !{!19, !19} -// CHECK:STDOUT: !19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !20 = !{!21} -// CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !16, type: !19) -// CHECK:STDOUT: !22 = !DILocation(line: 11, column: 10, scope: !16) -// CHECK:STDOUT: !23 = !DILocation(line: 11, column: 3, scope: !16) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Call", linkageName: "_CCall.Main", scope: null, file: !6, line: 10, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !15) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{!14, !14} +// CHECK:STDOUT: !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !15 = !{!16} +// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !14) +// CHECK:STDOUT: !17 = !DILocation(line: 11, column: 10, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 11, column: 3, scope: !11) +// CHECK:STDOUT: !19 = !{!20, !20, i64 0} +// CHECK:STDOUT: !20 = !{!"p1 _ZTS1D", !21, i64 0} +// CHECK:STDOUT: !21 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !22 = !{!23, !23, i64 0} +// CHECK:STDOUT: !23 = !{!"p1 _ZTS1C", !21, i64 0} diff --git a/toolchain/lower/testdata/interop/cpp/std_initializer_list.carbon b/toolchain/lower/testdata/interop/cpp/std_initializer_list.carbon index 08ab88942dee..859c43f9606c 100644 --- a/toolchain/lower/testdata/interop/cpp/std_initializer_list.carbon +++ b/toolchain/lower/testdata/interop/cpp/std_initializer_list.carbon @@ -118,28 +118,84 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: // CHECK:STDOUT: %"class.std::initializer_list" = type { ptr, ptr } // CHECK:STDOUT: -// CHECK:STDOUT: $_ZN11vector_likeC2ESt16initializer_listIiE = comdat any -// CHECK:STDOUT: -// CHECK:STDOUT: $_ZN15nontrivial_dtorC2Ev = comdat any -// CHECK:STDOUT: // CHECK:STDOUT: $_ZN11vector_likeD2Ev = comdat any // CHECK:STDOUT: // CHECK:STDOUT: $_ZN15nontrivial_dtorD2Ev = comdat any // CHECK:STDOUT: +// CHECK:STDOUT: $_ZN11vector_likeC2ESt16initializer_listIiE = comdat any +// CHECK:STDOUT: +// CHECK:STDOUT: $_ZN15nontrivial_dtorC2Ev = comdat any +// CHECK:STDOUT: // CHECK:STDOUT: @array = internal constant [3 x i32] [i32 1, i32 2, i32 3] // CHECK:STDOUT: @array.loc13_50.15 = internal constant [3 x i32] [i32 1, i32 2, i32 3] // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_CWithinLifetime.Main() +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitDirectly.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !14 +// CHECK:STDOUT: %.loc13_50.3.temp = alloca [3 x i32], align 4, !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc13_50.3.temp), !dbg !15 +// CHECK:STDOUT: %.loc13_50.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 0, !dbg !15 +// CHECK:STDOUT: %.loc13_50.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 1, !dbg !15 +// CHECK:STDOUT: %.loc13_50.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 2, !dbg !15 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !14 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.end = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !14 +// CHECK:STDOUT: store ptr getelementptr inbounds ([3 x i32], ptr @array.loc13_50.15, i32 1), ptr %initializer_list.initializer_list.call.init_list.end, align 8, !dbg !14 +// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !16 +// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !15 +// CHECK:STDOUT: ret void, !dbg !17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !18 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret void, !dbg !24 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define weak_odr void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr %self) #0 !dbg !25 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret void, !dbg !31 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitVectorLike.Main() #0 !dbg !32 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [1 x i8], align 1, !dbg !33 +// CHECK:STDOUT: %.loc18_36.2.temp = alloca [16 x i8], align 1, !dbg !34 +// CHECK:STDOUT: %.loc18_36.4.temp = alloca [3 x i32], align 4, !dbg !34 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !33 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.2.temp), !dbg !34 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.4.temp), !dbg !34 +// CHECK:STDOUT: %.loc18_36.5.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 0, !dbg !34 +// CHECK:STDOUT: %.loc18_36.8.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 1, !dbg !34 +// CHECK:STDOUT: %.loc18_36.11.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 2, !dbg !34 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 0, !dbg !34 +// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !34 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.end = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 8, !dbg !34 +// CHECK:STDOUT: store ptr getelementptr inbounds ([3 x i32], ptr @array.loc13_50.15, i32 1), ptr %initializer_list.initializer_list.call.init_list.end, align 8, !dbg !34 +// CHECK:STDOUT: call void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr %.loc18_36.2.temp, ptr %_.var), !dbg !33 +// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !35 +// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !34 +// CHECK:STDOUT: call void @_ZN11vector_likeD2Ev(ptr %_.var), !dbg !33 +// CHECK:STDOUT: ret void, !dbg !36 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr noundef %list, ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr noundef %list, ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %list.addr = alloca ptr, align 8 // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %"class.std::initializer_list", align 8 -// CHECK:STDOUT: store ptr %list, ptr %list.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %1 = load ptr, ptr %list.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %agg.tmp, ptr align 8 %1, i64 16, i1 false), !tbaa.struct !16 +// CHECK:STDOUT: store ptr %list, ptr %list.addr, align 8, !tbaa !37 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !40 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !40 +// CHECK:STDOUT: %1 = load ptr, ptr %list.addr, align 8, !tbaa !37 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %agg.tmp, ptr align 8 %1, i64 16, i1 false), !tbaa.struct !42 // CHECK:STDOUT: %2 = getelementptr inbounds nuw { ptr, ptr }, ptr %agg.tmp, i32 0, i32 0 // CHECK:STDOUT: %3 = load ptr, ptr %2, align 8 // CHECK:STDOUT: %4 = getelementptr inbounds nuw { ptr, ptr }, ptr %agg.tmp, i32 0, i32 1 @@ -148,8 +204,68 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN11vector_likeD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !40 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitNontrivialDtor.Main() #0 !dbg !45 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !46 +// CHECK:STDOUT: %.loc23_69.17.temp = alloca [3 x [1 x i8]], align 1, !dbg !47 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !46 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc23_69.17.temp), !dbg !47 +// CHECK:STDOUT: %.loc23_69.18.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 0, !dbg !47 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.18.array.index), !dbg !47 +// CHECK:STDOUT: %.loc23_69.16.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 1, !dbg !47 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.16.array.index), !dbg !47 +// CHECK:STDOUT: %.loc23_69.15.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 2, !dbg !47 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.15.array.index), !dbg !47 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !46 +// CHECK:STDOUT: store ptr %.loc23_69.17.temp, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !46 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.end = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !46 +// CHECK:STDOUT: %initializer_list.initializer_list.call.array.end = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 1, !dbg !46 +// CHECK:STDOUT: store ptr %initializer_list.initializer_list.call.array.end, ptr %initializer_list.initializer_list.call.init_list.end, align 8, !dbg !46 +// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !48 +// CHECK:STDOUT: call void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %.loc23_69.17.temp), !dbg !47 +// CHECK:STDOUT: ret void, !dbg !49 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !50 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !50 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN15nontrivial_dtorD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !50 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define weak_odr void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %self) #0 !dbg !52 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret void, !dbg !55 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable // CHECK:STDOUT: define linkonce_odr dso_local void @_ZN11vector_likeC2ESt16initializer_listIiE(ptr noundef nonnull align 1 dereferenceable(1) %this, ptr %list.coerce0, ptr %list.coerce1) unnamed_addr #2 comdat align 2 { @@ -160,144 +276,29 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: store ptr %list.coerce0, ptr %0, align 8 // CHECK:STDOUT: %1 = getelementptr inbounds nuw { ptr, ptr }, ptr %list, i32 0, i32 1 // CHECK:STDOUT: store ptr %list.coerce1, ptr %1, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !40 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !19 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !19 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable // CHECK:STDOUT: define linkonce_odr dso_local void @_ZN15nontrivial_dtorC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !19 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !50 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_CWithinLifetime.Main() -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CInitDirectly.Main() #3 !dbg !21 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !24 -// CHECK:STDOUT: %.loc13_50.3.temp = alloca [3 x i32], align 4, !dbg !25 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !24 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc13_50.3.temp), !dbg !25 -// CHECK:STDOUT: %.loc13_50.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 0, !dbg !25 -// CHECK:STDOUT: %.loc13_50.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 1, !dbg !25 -// CHECK:STDOUT: %.loc13_50.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 2, !dbg !25 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !24 -// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !24 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.end = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !24 -// CHECK:STDOUT: store ptr getelementptr inbounds ([3 x i32], ptr @array.loc13_50.15, i32 1), ptr %initializer_list.initializer_list.call.init_list.end, align 8, !dbg !24 -// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !26 -// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !25 -// CHECK:STDOUT: ret void, !dbg !27 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #3 !dbg !28 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !34 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr %self) #3 !dbg !35 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !41 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CInitVectorLike.Main() #3 !dbg !42 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [1 x i8], align 1, !dbg !43 -// CHECK:STDOUT: %.loc18_36.2.temp = alloca [16 x i8], align 1, !dbg !44 -// CHECK:STDOUT: %.loc18_36.4.temp = alloca [3 x i32], align 4, !dbg !44 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !43 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.2.temp), !dbg !44 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.4.temp), !dbg !44 -// CHECK:STDOUT: %.loc18_36.5.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 0, !dbg !44 -// CHECK:STDOUT: %.loc18_36.8.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 1, !dbg !44 -// CHECK:STDOUT: %.loc18_36.11.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 2, !dbg !44 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 0, !dbg !44 -// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !44 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.end = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 8, !dbg !44 -// CHECK:STDOUT: store ptr getelementptr inbounds ([3 x i32], ptr @array.loc13_50.15, i32 1), ptr %initializer_list.initializer_list.call.init_list.end, align 8, !dbg !44 -// CHECK:STDOUT: call void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr %.loc18_36.2.temp, ptr %_.var), !dbg !43 -// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !45 -// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !44 -// CHECK:STDOUT: call void @_ZN11vector_likeD2Ev(ptr %_.var), !dbg !43 -// CHECK:STDOUT: ret void, !dbg !46 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN11vector_likeD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CInitNontrivialDtor.Main() #3 !dbg !47 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !48 -// CHECK:STDOUT: %.loc23_69.17.temp = alloca [3 x [1 x i8]], align 1, !dbg !49 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !48 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc23_69.17.temp), !dbg !49 -// CHECK:STDOUT: %.loc23_69.18.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 0, !dbg !49 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.18.array.index), !dbg !49 -// CHECK:STDOUT: %.loc23_69.16.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 1, !dbg !49 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.16.array.index), !dbg !49 -// CHECK:STDOUT: %.loc23_69.15.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 2, !dbg !49 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.15.array.index), !dbg !49 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !48 -// CHECK:STDOUT: store ptr %.loc23_69.17.temp, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !48 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.end = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !48 -// CHECK:STDOUT: %initializer_list.initializer_list.call.array.end = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 1, !dbg !48 -// CHECK:STDOUT: store ptr %initializer_list.initializer_list.call.array.end, ptr %initializer_list.initializer_list.call.init_list.end, align 8, !dbg !48 -// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !50 -// CHECK:STDOUT: call void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %.loc23_69.17.temp), !dbg !49 -// CHECK:STDOUT: ret void, !dbg !51 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN15nontrivial_dtorD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !19 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %self) #3 !dbg !52 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !55 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 -// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder ptr @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple, { 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { nounwind } -// CHECK:STDOUT: attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -314,50 +315,50 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTSSt16initializer_listIiE", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"p1 _ZTS11vector_like", !13, i64 0} -// CHECK:STDOUT: !16 = !{i64 0, i64 8, !17, i64 8, i64 8, !17} -// CHECK:STDOUT: !17 = !{!18, !18, i64 0} -// CHECK:STDOUT: !18 = !{!"p1 int", !13, i64 0} -// CHECK:STDOUT: !19 = !{!20, !20, i64 0} -// CHECK:STDOUT: !20 = !{!"p1 _ZTS15nontrivial_dtor", !13, i64 0} -// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "InitDirectly", linkageName: "_CInitDirectly.Main", scope: null, file: !6, line: 12, type: !22, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !22 = !DISubroutineType(types: !23) -// CHECK:STDOUT: !23 = !{null} -// CHECK:STDOUT: !24 = !DILocation(line: 13, column: 3, scope: !21) -// CHECK:STDOUT: !25 = !DILocation(line: 13, column: 42, scope: !21) -// CHECK:STDOUT: !26 = !DILocation(line: 14, column: 3, scope: !21) -// CHECK:STDOUT: !27 = !DILocation(line: 12, column: 1, scope: !21) -// CHECK:STDOUT: !28 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !6, line: 13, type: !29, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !32) -// CHECK:STDOUT: !29 = !DISubroutineType(types: !30) -// CHECK:STDOUT: !30 = !{null, !31} -// CHECK:STDOUT: !31 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -// CHECK:STDOUT: !32 = !{!33} -// CHECK:STDOUT: !33 = !DILocalVariable(arg: 1, scope: !28, type: !31) -// CHECK:STDOUT: !34 = !DILocation(line: 13, column: 42, scope: !28) -// CHECK:STDOUT: !35 = distinct !DISubprogram(name: "Op", linkageName: "_COp.bfd302cd235977c4:core.Destroy.Core", scope: null, file: !6, line: 13, type: !36, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !39) -// CHECK:STDOUT: !36 = !DISubroutineType(types: !37) -// CHECK:STDOUT: !37 = !{null, !38} -// CHECK:STDOUT: !38 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !39 = !{!40} -// CHECK:STDOUT: !40 = !DILocalVariable(arg: 1, scope: !35, type: !38) -// CHECK:STDOUT: !41 = !DILocation(line: 13, column: 42, scope: !35) -// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "InitVectorLike", linkageName: "_CInitVectorLike.Main", scope: null, file: !6, line: 17, type: !22, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !43 = !DILocation(line: 18, column: 3, scope: !42) -// CHECK:STDOUT: !44 = !DILocation(line: 18, column: 28, scope: !42) -// CHECK:STDOUT: !45 = !DILocation(line: 19, column: 3, scope: !42) -// CHECK:STDOUT: !46 = !DILocation(line: 17, column: 1, scope: !42) -// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "InitNontrivialDtor", linkageName: "_CInitNontrivialDtor.Main", scope: null, file: !6, line: 22, type: !22, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !48 = !DILocation(line: 23, column: 3, scope: !47) -// CHECK:STDOUT: !49 = !DILocation(line: 23, column: 58, scope: !47) -// CHECK:STDOUT: !50 = !DILocation(line: 24, column: 3, scope: !47) -// CHECK:STDOUT: !51 = !DILocation(line: 22, column: 1, scope: !47) -// CHECK:STDOUT: !52 = distinct !DISubprogram(name: "Op", linkageName: "_COp.3c5ceecfa63e1bfb:core.Destroy.Core", scope: null, file: !6, line: 23, type: !36, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !53) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "InitDirectly", linkageName: "_CInitDirectly.Main", scope: null, file: !6, line: 12, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 13, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 13, column: 42, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 14, column: 3, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 12, column: 1, scope: !11) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !6, line: 13, type: !19, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !22) +// CHECK:STDOUT: !19 = !DISubroutineType(types: !20) +// CHECK:STDOUT: !20 = !{null, !21} +// CHECK:STDOUT: !21 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +// CHECK:STDOUT: !22 = !{!23} +// CHECK:STDOUT: !23 = !DILocalVariable(arg: 1, scope: !18, type: !21) +// CHECK:STDOUT: !24 = !DILocation(line: 13, column: 42, scope: !18) +// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Op", linkageName: "_COp.bfd302cd235977c4:core.Destroy.Core", scope: null, file: !6, line: 13, type: !26, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !29) +// CHECK:STDOUT: !26 = !DISubroutineType(types: !27) +// CHECK:STDOUT: !27 = !{null, !28} +// CHECK:STDOUT: !28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !29 = !{!30} +// CHECK:STDOUT: !30 = !DILocalVariable(arg: 1, scope: !25, type: !28) +// CHECK:STDOUT: !31 = !DILocation(line: 13, column: 42, scope: !25) +// CHECK:STDOUT: !32 = distinct !DISubprogram(name: "InitVectorLike", linkageName: "_CInitVectorLike.Main", scope: null, file: !6, line: 17, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !33 = !DILocation(line: 18, column: 3, scope: !32) +// CHECK:STDOUT: !34 = !DILocation(line: 18, column: 28, scope: !32) +// CHECK:STDOUT: !35 = !DILocation(line: 19, column: 3, scope: !32) +// CHECK:STDOUT: !36 = !DILocation(line: 17, column: 1, scope: !32) +// CHECK:STDOUT: !37 = !{!38, !38, i64 0} +// CHECK:STDOUT: !38 = !{!"p1 _ZTSSt16initializer_listIiE", !39, i64 0} +// CHECK:STDOUT: !39 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !40 = !{!41, !41, i64 0} +// CHECK:STDOUT: !41 = !{!"p1 _ZTS11vector_like", !39, i64 0} +// CHECK:STDOUT: !42 = !{i64 0, i64 8, !43, i64 8, i64 8, !43} +// CHECK:STDOUT: !43 = !{!44, !44, i64 0} +// CHECK:STDOUT: !44 = !{!"p1 int", !39, i64 0} +// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "InitNontrivialDtor", linkageName: "_CInitNontrivialDtor.Main", scope: null, file: !6, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !46 = !DILocation(line: 23, column: 3, scope: !45) +// CHECK:STDOUT: !47 = !DILocation(line: 23, column: 58, scope: !45) +// CHECK:STDOUT: !48 = !DILocation(line: 24, column: 3, scope: !45) +// CHECK:STDOUT: !49 = !DILocation(line: 22, column: 1, scope: !45) +// CHECK:STDOUT: !50 = !{!51, !51, i64 0} +// CHECK:STDOUT: !51 = !{!"p1 _ZTS15nontrivial_dtor", !39, i64 0} +// CHECK:STDOUT: !52 = distinct !DISubprogram(name: "Op", linkageName: "_COp.3c5ceecfa63e1bfb:core.Destroy.Core", scope: null, file: !6, line: 23, type: !26, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !53) // CHECK:STDOUT: !53 = !{!54} -// CHECK:STDOUT: !54 = !DILocalVariable(arg: 1, scope: !52, type: !38) +// CHECK:STDOUT: !54 = !DILocalVariable(arg: 1, scope: !52, type: !28) // CHECK:STDOUT: !55 = !DILocation(line: 23, column: 58, scope: !52) // CHECK:STDOUT: ; ModuleID = 'use_pointer_size.carbon' // CHECK:STDOUT: source_filename = "use_pointer_size.carbon" @@ -366,28 +367,84 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: // CHECK:STDOUT: %"class.std::initializer_list" = type { ptr, i64 } // CHECK:STDOUT: -// CHECK:STDOUT: $_ZN11vector_likeC2ESt16initializer_listIiE = comdat any -// CHECK:STDOUT: -// CHECK:STDOUT: $_ZN15nontrivial_dtorC2Ev = comdat any -// CHECK:STDOUT: // CHECK:STDOUT: $_ZN11vector_likeD2Ev = comdat any // CHECK:STDOUT: // CHECK:STDOUT: $_ZN15nontrivial_dtorD2Ev = comdat any // CHECK:STDOUT: +// CHECK:STDOUT: $_ZN11vector_likeC2ESt16initializer_listIiE = comdat any +// CHECK:STDOUT: +// CHECK:STDOUT: $_ZN15nontrivial_dtorC2Ev = comdat any +// CHECK:STDOUT: // CHECK:STDOUT: @array = internal constant [3 x i32] [i32 1, i32 2, i32 3] // CHECK:STDOUT: @array.loc13_50.15 = internal constant [3 x i32] [i32 1, i32 2, i32 3] // CHECK:STDOUT: +// CHECK:STDOUT: declare void @_CWithinLifetime.Main() +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitDirectly.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !14 +// CHECK:STDOUT: %.loc13_50.3.temp = alloca [3 x i32], align 4, !dbg !15 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc13_50.3.temp), !dbg !15 +// CHECK:STDOUT: %.loc13_50.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 0, !dbg !15 +// CHECK:STDOUT: %.loc13_50.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 1, !dbg !15 +// CHECK:STDOUT: %.loc13_50.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 2, !dbg !15 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !14 +// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !14 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.size = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !14 +// CHECK:STDOUT: store i64 3, ptr %initializer_list.initializer_list.call.init_list.size, align 8, !dbg !14 +// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !16 +// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !15 +// CHECK:STDOUT: ret void, !dbg !17 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #0 !dbg !18 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret void, !dbg !24 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define weak_odr void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr %self) #0 !dbg !25 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret void, !dbg !31 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitVectorLike.Main() #0 !dbg !32 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [1 x i8], align 1, !dbg !33 +// CHECK:STDOUT: %.loc18_36.2.temp = alloca [16 x i8], align 1, !dbg !34 +// CHECK:STDOUT: %.loc18_36.4.temp = alloca [3 x i32], align 4, !dbg !34 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !33 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.2.temp), !dbg !34 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.4.temp), !dbg !34 +// CHECK:STDOUT: %.loc18_36.5.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 0, !dbg !34 +// CHECK:STDOUT: %.loc18_36.8.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 1, !dbg !34 +// CHECK:STDOUT: %.loc18_36.11.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 2, !dbg !34 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 0, !dbg !34 +// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !34 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.size = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 8, !dbg !34 +// CHECK:STDOUT: store i64 3, ptr %initializer_list.initializer_list.call.init_list.size, align 8, !dbg !34 +// CHECK:STDOUT: call void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr %.loc18_36.2.temp, ptr %_.var), !dbg !33 +// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !35 +// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !34 +// CHECK:STDOUT: call void @_ZN11vector_likeD2Ev(ptr %_.var), !dbg !33 +// CHECK:STDOUT: ret void, !dbg !36 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr noundef %list, ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr noundef %list, ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %list.addr = alloca ptr, align 8 // CHECK:STDOUT: %return.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %"class.std::initializer_list", align 8 -// CHECK:STDOUT: store ptr %list, ptr %list.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %1 = load ptr, ptr %list.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %agg.tmp, ptr align 8 %1, i64 16, i1 false), !tbaa.struct !16 +// CHECK:STDOUT: store ptr %list, ptr %list.addr, align 8, !tbaa !37 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !40 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !40 +// CHECK:STDOUT: %1 = load ptr, ptr %list.addr, align 8, !tbaa !37 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %agg.tmp, ptr align 8 %1, i64 16, i1 false), !tbaa.struct !42 // CHECK:STDOUT: %2 = getelementptr inbounds nuw { ptr, i64 }, ptr %agg.tmp, i32 0, i32 0 // CHECK:STDOUT: %3 = load ptr, ptr %2, align 8 // CHECK:STDOUT: %4 = getelementptr inbounds nuw { ptr, i64 }, ptr %agg.tmp, i32 0, i32 1 @@ -396,8 +453,67 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN11vector_likeD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !40 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CInitNontrivialDtor.Main() #0 !dbg !47 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !48 +// CHECK:STDOUT: %.loc23_69.17.temp = alloca [3 x [1 x i8]], align 1, !dbg !49 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !48 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc23_69.17.temp), !dbg !49 +// CHECK:STDOUT: %.loc23_69.18.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 0, !dbg !49 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.18.array.index), !dbg !49 +// CHECK:STDOUT: %.loc23_69.16.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 1, !dbg !49 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.16.array.index), !dbg !49 +// CHECK:STDOUT: %.loc23_69.15.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 2, !dbg !49 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.15.array.index), !dbg !49 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !48 +// CHECK:STDOUT: store ptr %.loc23_69.17.temp, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !48 +// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.size = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !48 +// CHECK:STDOUT: store i64 3, ptr %initializer_list.initializer_list.call.init_list.size, align 8, !dbg !48 +// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !50 +// CHECK:STDOUT: call void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %.loc23_69.17.temp), !dbg !49 +// CHECK:STDOUT: ret void, !dbg !51 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr noundef %return) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !52 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !52 +// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN15nontrivial_dtorD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %this.addr = alloca ptr, align 8 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !52 +// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define weak_odr void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %self) #0 !dbg !54 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: ret void, !dbg !57 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1 +// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable // CHECK:STDOUT: define linkonce_odr dso_local void @_ZN11vector_likeC2ESt16initializer_listIiE(ptr noundef nonnull align 1 dereferenceable(1) %this, ptr %list.coerce0, i64 %list.coerce1) unnamed_addr #2 comdat align 2 { @@ -408,143 +524,29 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: store ptr %list.coerce0, ptr %0, align 8 // CHECK:STDOUT: %1 = getelementptr inbounds nuw { ptr, i64 }, ptr %list, i32 0, i32 1 // CHECK:STDOUT: store i64 %list.coerce1, ptr %1, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !40 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !21 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !21 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %0) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable // CHECK:STDOUT: define linkonce_odr dso_local void @_ZN15nontrivial_dtorC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !21 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !52 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_CWithinLifetime.Main() -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CInitDirectly.Main() #3 !dbg !23 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !26 -// CHECK:STDOUT: %.loc13_50.3.temp = alloca [3 x i32], align 4, !dbg !27 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !26 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc13_50.3.temp), !dbg !27 -// CHECK:STDOUT: %.loc13_50.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 0, !dbg !27 -// CHECK:STDOUT: %.loc13_50.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 1, !dbg !27 -// CHECK:STDOUT: %.loc13_50.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc13_50.3.temp, i32 0, i64 2, !dbg !27 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !26 -// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !26 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.size = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !26 -// CHECK:STDOUT: store i64 3, ptr %initializer_list.initializer_list.call.init_list.size, align 8, !dbg !26 -// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !28 -// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !27 -// CHECK:STDOUT: ret void, !dbg !29 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.7e389eab4a7e5487:core.Destroy.Core"(ptr %self) #3 !dbg !30 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !36 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr %self) #3 !dbg !37 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !43 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CInitVectorLike.Main() #3 !dbg !44 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [1 x i8], align 1, !dbg !45 -// CHECK:STDOUT: %.loc18_36.2.temp = alloca [16 x i8], align 1, !dbg !46 -// CHECK:STDOUT: %.loc18_36.4.temp = alloca [3 x i32], align 4, !dbg !46 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !45 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.2.temp), !dbg !46 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_36.4.temp), !dbg !46 -// CHECK:STDOUT: %.loc18_36.5.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 0, !dbg !46 -// CHECK:STDOUT: %.loc18_36.8.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 1, !dbg !46 -// CHECK:STDOUT: %.loc18_36.11.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_36.4.temp, i32 0, i64 2, !dbg !46 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 0, !dbg !46 -// CHECK:STDOUT: store ptr @array.loc13_50.15, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !46 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.size = getelementptr inbounds nuw [16 x i8], ptr %.loc18_36.2.temp, i32 0, i32 8, !dbg !46 -// CHECK:STDOUT: store i64 3, ptr %initializer_list.initializer_list.call.init_list.size, align 8, !dbg !46 -// CHECK:STDOUT: call void @_ZN11vector_likeC1ESt16initializer_listIiE.carbon_thunk(ptr %.loc18_36.2.temp, ptr %_.var), !dbg !45 -// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !47 -// CHECK:STDOUT: call void @"_COp.bfd302cd235977c4:core.Destroy.Core"(ptr @array), !dbg !46 -// CHECK:STDOUT: call void @_ZN11vector_likeD2Ev(ptr %_.var), !dbg !45 -// CHECK:STDOUT: ret void, !dbg !48 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN11vector_likeD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !14 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CInitNontrivialDtor.Main() #3 !dbg !49 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [16 x i8], align 1, !dbg !50 -// CHECK:STDOUT: %.loc23_69.17.temp = alloca [3 x [1 x i8]], align 1, !dbg !51 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !50 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc23_69.17.temp), !dbg !51 -// CHECK:STDOUT: %.loc23_69.18.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 0, !dbg !51 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.18.array.index), !dbg !51 -// CHECK:STDOUT: %.loc23_69.16.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 1, !dbg !51 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.16.array.index), !dbg !51 -// CHECK:STDOUT: %.loc23_69.15.array.index = getelementptr inbounds [3 x [1 x i8]], ptr %.loc23_69.17.temp, i32 0, i64 2, !dbg !51 -// CHECK:STDOUT: call void @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple(ptr %.loc23_69.15.array.index), !dbg !51 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.begin = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 0, !dbg !50 -// CHECK:STDOUT: store ptr %.loc23_69.17.temp, ptr %initializer_list.initializer_list.call.init_list.begin, align 8, !dbg !50 -// CHECK:STDOUT: %initializer_list.initializer_list.call.init_list.size = getelementptr inbounds nuw [16 x i8], ptr %_.var, i32 0, i32 8, !dbg !50 -// CHECK:STDOUT: store i64 3, ptr %initializer_list.initializer_list.call.init_list.size, align 8, !dbg !50 -// CHECK:STDOUT: call void @_CWithinLifetime.Main(), !dbg !52 -// CHECK:STDOUT: call void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %.loc23_69.17.temp), !dbg !51 -// CHECK:STDOUT: ret void, !dbg !53 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN15nontrivial_dtorD2Ev(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #2 comdat align 2 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !21 -// CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define weak_odr void @"_COp.3c5ceecfa63e1bfb:core.Destroy.Core"(ptr %self) #3 !dbg !54 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: ret void, !dbg !57 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #4 -// CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives +// CHECK:STDOUT: uselistorder ptr @_ZN15nontrivial_dtorC1Ev.carbon_thunk_tuple, { 2, 1, 0 } // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 6, 5, 4, 3, 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #3 = { nounwind } -// CHECK:STDOUT: attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -561,50 +563,50 @@ fn InitNontrivialDtor() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTSSt16initializer_listIiE", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"p1 _ZTS11vector_like", !13, i64 0} -// CHECK:STDOUT: !16 = !{i64 0, i64 8, !17, i64 8, i64 8, !19} -// CHECK:STDOUT: !17 = !{!18, !18, i64 0} -// CHECK:STDOUT: !18 = !{!"p1 int", !13, i64 0} -// CHECK:STDOUT: !19 = !{!20, !20, i64 0} -// CHECK:STDOUT: !20 = !{!"long", !9, i64 0} -// CHECK:STDOUT: !21 = !{!22, !22, i64 0} -// CHECK:STDOUT: !22 = !{!"p1 _ZTS15nontrivial_dtor", !13, i64 0} -// CHECK:STDOUT: !23 = distinct !DISubprogram(name: "InitDirectly", linkageName: "_CInitDirectly.Main", scope: null, file: !6, line: 12, type: !24, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !24 = !DISubroutineType(types: !25) -// CHECK:STDOUT: !25 = !{null} -// CHECK:STDOUT: !26 = !DILocation(line: 13, column: 3, scope: !23) -// CHECK:STDOUT: !27 = !DILocation(line: 13, column: 42, scope: !23) -// CHECK:STDOUT: !28 = !DILocation(line: 14, column: 3, scope: !23) -// CHECK:STDOUT: !29 = !DILocation(line: 12, column: 1, scope: !23) -// CHECK:STDOUT: !30 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !6, line: 13, type: !31, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !34) -// CHECK:STDOUT: !31 = !DISubroutineType(types: !32) -// CHECK:STDOUT: !32 = !{null, !33} -// CHECK:STDOUT: !33 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -// CHECK:STDOUT: !34 = !{!35} -// CHECK:STDOUT: !35 = !DILocalVariable(arg: 1, scope: !30, type: !33) -// CHECK:STDOUT: !36 = !DILocation(line: 13, column: 42, scope: !30) -// CHECK:STDOUT: !37 = distinct !DISubprogram(name: "Op", linkageName: "_COp.bfd302cd235977c4:core.Destroy.Core", scope: null, file: !6, line: 13, type: !38, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !41) -// CHECK:STDOUT: !38 = !DISubroutineType(types: !39) -// CHECK:STDOUT: !39 = !{null, !40} -// CHECK:STDOUT: !40 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !41 = !{!42} -// CHECK:STDOUT: !42 = !DILocalVariable(arg: 1, scope: !37, type: !40) -// CHECK:STDOUT: !43 = !DILocation(line: 13, column: 42, scope: !37) -// CHECK:STDOUT: !44 = distinct !DISubprogram(name: "InitVectorLike", linkageName: "_CInitVectorLike.Main", scope: null, file: !6, line: 17, type: !24, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !45 = !DILocation(line: 18, column: 3, scope: !44) -// CHECK:STDOUT: !46 = !DILocation(line: 18, column: 28, scope: !44) -// CHECK:STDOUT: !47 = !DILocation(line: 19, column: 3, scope: !44) -// CHECK:STDOUT: !48 = !DILocation(line: 17, column: 1, scope: !44) -// CHECK:STDOUT: !49 = distinct !DISubprogram(name: "InitNontrivialDtor", linkageName: "_CInitNontrivialDtor.Main", scope: null, file: !6, line: 22, type: !24, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !50 = !DILocation(line: 23, column: 3, scope: !49) -// CHECK:STDOUT: !51 = !DILocation(line: 23, column: 58, scope: !49) -// CHECK:STDOUT: !52 = !DILocation(line: 24, column: 3, scope: !49) -// CHECK:STDOUT: !53 = !DILocation(line: 22, column: 1, scope: !49) -// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "Op", linkageName: "_COp.3c5ceecfa63e1bfb:core.Destroy.Core", scope: null, file: !6, line: 23, type: !38, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !55) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "InitDirectly", linkageName: "_CInitDirectly.Main", scope: null, file: !6, line: 12, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 13, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 13, column: 42, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 14, column: 3, scope: !11) +// CHECK:STDOUT: !17 = !DILocation(line: 12, column: 1, scope: !11) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "Op", linkageName: "_COp.7e389eab4a7e5487:core.Destroy.Core", scope: null, file: !6, line: 13, type: !19, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !22) +// CHECK:STDOUT: !19 = !DISubroutineType(types: !20) +// CHECK:STDOUT: !20 = !{null, !21} +// CHECK:STDOUT: !21 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +// CHECK:STDOUT: !22 = !{!23} +// CHECK:STDOUT: !23 = !DILocalVariable(arg: 1, scope: !18, type: !21) +// CHECK:STDOUT: !24 = !DILocation(line: 13, column: 42, scope: !18) +// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Op", linkageName: "_COp.bfd302cd235977c4:core.Destroy.Core", scope: null, file: !6, line: 13, type: !26, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !29) +// CHECK:STDOUT: !26 = !DISubroutineType(types: !27) +// CHECK:STDOUT: !27 = !{null, !28} +// CHECK:STDOUT: !28 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !29 = !{!30} +// CHECK:STDOUT: !30 = !DILocalVariable(arg: 1, scope: !25, type: !28) +// CHECK:STDOUT: !31 = !DILocation(line: 13, column: 42, scope: !25) +// CHECK:STDOUT: !32 = distinct !DISubprogram(name: "InitVectorLike", linkageName: "_CInitVectorLike.Main", scope: null, file: !6, line: 17, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !33 = !DILocation(line: 18, column: 3, scope: !32) +// CHECK:STDOUT: !34 = !DILocation(line: 18, column: 28, scope: !32) +// CHECK:STDOUT: !35 = !DILocation(line: 19, column: 3, scope: !32) +// CHECK:STDOUT: !36 = !DILocation(line: 17, column: 1, scope: !32) +// CHECK:STDOUT: !37 = !{!38, !38, i64 0} +// CHECK:STDOUT: !38 = !{!"p1 _ZTSSt16initializer_listIiE", !39, i64 0} +// CHECK:STDOUT: !39 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !40 = !{!41, !41, i64 0} +// CHECK:STDOUT: !41 = !{!"p1 _ZTS11vector_like", !39, i64 0} +// CHECK:STDOUT: !42 = !{i64 0, i64 8, !43, i64 8, i64 8, !45} +// CHECK:STDOUT: !43 = !{!44, !44, i64 0} +// CHECK:STDOUT: !44 = !{!"p1 int", !39, i64 0} +// CHECK:STDOUT: !45 = !{!46, !46, i64 0} +// CHECK:STDOUT: !46 = !{!"long", !9, i64 0} +// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "InitNontrivialDtor", linkageName: "_CInitNontrivialDtor.Main", scope: null, file: !6, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !48 = !DILocation(line: 23, column: 3, scope: !47) +// CHECK:STDOUT: !49 = !DILocation(line: 23, column: 58, scope: !47) +// CHECK:STDOUT: !50 = !DILocation(line: 24, column: 3, scope: !47) +// CHECK:STDOUT: !51 = !DILocation(line: 22, column: 1, scope: !47) +// CHECK:STDOUT: !52 = !{!53, !53, i64 0} +// CHECK:STDOUT: !53 = !{!"p1 _ZTS15nontrivial_dtor", !39, i64 0} +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "Op", linkageName: "_COp.3c5ceecfa63e1bfb:core.Destroy.Core", scope: null, file: !6, line: 23, type: !26, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !55) // CHECK:STDOUT: !55 = !{!56} -// CHECK:STDOUT: !56 = !DILocalVariable(arg: 1, scope: !54, type: !40) +// CHECK:STDOUT: !56 = !DILocalVariable(arg: 1, scope: !54, type: !28) // CHECK:STDOUT: !57 = !DILocation(line: 23, column: 58, scope: !54) diff --git a/toolchain/lower/testdata/interop/cpp/template.carbon b/toolchain/lower/testdata/interop/cpp/template.carbon index e965a2db4995..0c0c2e569373 100644 --- a/toolchain/lower/testdata/interop/cpp/template.carbon +++ b/toolchain/lower/testdata/interop/cpp/template.carbon @@ -96,37 +96,15 @@ fn Call3() { // CHECK:STDOUT: // CHECK:STDOUT: %class.Class = type { i8 } // CHECK:STDOUT: -// CHECK:STDOUT: $_Z8identityI5ClassET_S1_ = comdat any -// CHECK:STDOUT: // CHECK:STDOUT: $_Z8identityIiET_S0_ = comdat any // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z8identityI5ClassET_S1_.carbon_thunk(ptr noundef %x, ptr noundef %return) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %x.addr = alloca ptr, align 8 -// CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: %agg.tmp = alloca %class.Class, align 1 -// CHECK:STDOUT: %undef.agg.tmp = alloca %class.Class, align 1 -// CHECK:STDOUT: store ptr %x, ptr %x.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %x.addr, align 8, !tbaa !11 -// CHECK:STDOUT: call void @_Z8identityI5ClassET_S1_() -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_Z8identityI5ClassET_S1_() #1 comdat { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %x = alloca %class.Class, align 1 -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } +// CHECK:STDOUT: $_Z8identityI5ClassET_S1_ = comdat any // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CPassI32.Main(i32 %a) #2 !dbg !14 { +// CHECK:STDOUT: define i32 @_CPassI32.Main(i32 %a) #0 !dbg !11 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %identity.call = call i32 @_Z8identityIiET_S0_(i32 %a), !dbg !20 -// CHECK:STDOUT: ret i32 %identity.call, !dbg !21 +// CHECK:STDOUT: %identity.call = call i32 @_Z8identityIiET_S0_(i32 %a), !dbg !17 +// CHECK:STDOUT: ret i32 %identity.call, !dbg !18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable @@ -139,22 +117,44 @@ fn Call3() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CPassI32Explicitly.Main(i32 %a) #2 !dbg !22 { +// CHECK:STDOUT: define i32 @_CPassI32Explicitly.Main(i32 %a) #0 !dbg !19 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %identity.call = call i32 @_Z8identityIiET_S0_(i32 %a), !dbg !25 -// CHECK:STDOUT: ret i32 %identity.call, !dbg !26 +// CHECK:STDOUT: %identity.call = call i32 @_Z8identityIiET_S0_(i32 %a), !dbg !22 +// CHECK:STDOUT: ret i32 %identity.call, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CPassClass.Main(ptr sret({}) %return, ptr %a) #2 !dbg !27 { +// CHECK:STDOUT: define void @_CPassClass.Main(ptr sret({}) %return, ptr %a) #0 !dbg !24 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @_Z8identityI5ClassET_S1_.carbon_thunk(ptr %a, ptr %return), !dbg !33 -// CHECK:STDOUT: ret void, !dbg !34 +// CHECK:STDOUT: call void @_Z8identityI5ClassET_S1_.carbon_thunk(ptr %a, ptr %return), !dbg !30 +// CHECK:STDOUT: ret void, !dbg !31 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z8identityI5ClassET_S1_.carbon_thunk(ptr noundef %x, ptr noundef %return) #2 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x.addr = alloca ptr, align 8 +// CHECK:STDOUT: %return.addr = alloca ptr, align 8 +// CHECK:STDOUT: %agg.tmp = alloca %class.Class, align 1 +// CHECK:STDOUT: %undef.agg.tmp = alloca %class.Class, align 1 +// CHECK:STDOUT: store ptr %x, ptr %x.addr, align 8, !tbaa !32 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !32 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !32 +// CHECK:STDOUT: %1 = load ptr, ptr %x.addr, align 8, !tbaa !32 +// CHECK:STDOUT: call void @_Z8identityI5ClassET_S1_() +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: mustprogress nounwind uwtable +// CHECK:STDOUT: define linkonce_odr dso_local void @_Z8identityI5ClassET_S1_() #1 comdat { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %x = alloca %class.Class, align 1 +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: attributes #0 = { nounwind } // CHECK:STDOUT: attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } +// CHECK:STDOUT: attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -171,30 +171,30 @@ fn Call3() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS5Class", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "PassI32", linkageName: "_CPassI32.Main", scope: null, file: !6, line: 6, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !18) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{!17, !17} -// CHECK:STDOUT: !17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -// CHECK:STDOUT: !18 = !{!19} -// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !14, type: !17) -// CHECK:STDOUT: !20 = !DILocation(line: 7, column: 10, scope: !14) -// CHECK:STDOUT: !21 = !DILocation(line: 7, column: 3, scope: !14) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "PassI32Explicitly", linkageName: "_CPassI32Explicitly.Main", scope: null, file: !6, line: 10, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !23) -// CHECK:STDOUT: !23 = !{!24} -// CHECK:STDOUT: !24 = !DILocalVariable(arg: 1, scope: !22, type: !17) -// CHECK:STDOUT: !25 = !DILocation(line: 11, column: 10, scope: !22) -// CHECK:STDOUT: !26 = !DILocation(line: 11, column: 3, scope: !22) -// CHECK:STDOUT: !27 = distinct !DISubprogram(name: "PassClass", linkageName: "_CPassClass.Main", scope: null, file: !6, line: 14, type: !28, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !31) -// CHECK:STDOUT: !28 = !DISubroutineType(types: !29) -// CHECK:STDOUT: !29 = !{!30, !30} -// CHECK:STDOUT: !30 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !31 = !{!32} -// CHECK:STDOUT: !32 = !DILocalVariable(arg: 1, scope: !27, type: !30) -// CHECK:STDOUT: !33 = !DILocation(line: 15, column: 10, scope: !27) -// CHECK:STDOUT: !34 = !DILocation(line: 15, column: 3, scope: !27) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "PassI32", linkageName: "_CPassI32.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !15) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{!14, !14} +// CHECK:STDOUT: !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +// CHECK:STDOUT: !15 = !{!16} +// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !14) +// CHECK:STDOUT: !17 = !DILocation(line: 7, column: 10, scope: !11) +// CHECK:STDOUT: !18 = !DILocation(line: 7, column: 3, scope: !11) +// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "PassI32Explicitly", linkageName: "_CPassI32Explicitly.Main", scope: null, file: !6, line: 10, type: !12, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20) +// CHECK:STDOUT: !20 = !{!21} +// CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !19, type: !14) +// CHECK:STDOUT: !22 = !DILocation(line: 11, column: 10, scope: !19) +// CHECK:STDOUT: !23 = !DILocation(line: 11, column: 3, scope: !19) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "PassClass", linkageName: "_CPassClass.Main", scope: null, file: !6, line: 14, type: !25, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !28) +// CHECK:STDOUT: !25 = !DISubroutineType(types: !26) +// CHECK:STDOUT: !26 = !{!27, !27} +// CHECK:STDOUT: !27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !28 = !{!29} +// CHECK:STDOUT: !29 = !DILocalVariable(arg: 1, scope: !24, type: !27) +// CHECK:STDOUT: !30 = !DILocation(line: 15, column: 10, scope: !24) +// CHECK:STDOUT: !31 = !DILocation(line: 15, column: 3, scope: !24) +// CHECK:STDOUT: !32 = !{!33, !33, i64 0} +// CHECK:STDOUT: !33 = !{!"p1 _ZTS5Class", !34, i64 0} +// CHECK:STDOUT: !34 = !{!"any pointer", !9, i64 0} // CHECK:STDOUT: ; ModuleID = 'variadic.carbon' // CHECK:STDOUT: source_filename = "variadic.carbon" // CHECK:STDOUT: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" @@ -266,65 +266,28 @@ fn Call3() { // CHECK:STDOUT: @X.val = internal constant {} zeroinitializer // CHECK:STDOUT: @X.val.loc12_14.3 = internal constant {} zeroinitializer // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CCall1.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc12_12.2.temp = alloca {}, align 8, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_12.2.temp), !dbg !14 +// CHECK:STDOUT: call void @_Z3fooIJEEv1XDpT_.carbon_thunk(ptr @X.val.loc12_14.3), !dbg !15 +// CHECK:STDOUT: ret void, !dbg !16 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z3fooIJEEv1XDpT_.carbon_thunk(ptr noundef %0) #0 { +// CHECK:STDOUT: define internal void @_Z3fooIJEEv1XDpT_.carbon_thunk(ptr noundef %0) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.addr = alloca ptr, align 8 // CHECK:STDOUT: %agg.tmp = alloca %class.X, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %1 = load ptr, ptr %.addr, align 8, !tbaa !17 // CHECK:STDOUT: call void @_Z3fooIJEEv1XDpT_() // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z3fooIJEEv1XDpT_() #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z3fooIJiEEv1XDpT_.carbon_thunk(ptr noundef %0, i32 noundef %1) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %agg.tmp = alloca %class.X, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: %2 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %3 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_Z3fooIJiEEv1XDpT_(i32 noundef %3) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z3fooIJiEEv1XDpT_(i32 noundef) #1 -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_Z3fooIJiiEEv1XDpT_.carbon_thunk(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.addr = alloca ptr, align 8 -// CHECK:STDOUT: %.addr1 = alloca i32, align 4 -// CHECK:STDOUT: %.addr2 = alloca i32, align 4 -// CHECK:STDOUT: %agg.tmp = alloca %class.X, align 1 -// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: %3 = load ptr, ptr %.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %4 = load i32, ptr %.addr1, align 4, !tbaa !7 -// CHECK:STDOUT: %5 = load i32, ptr %.addr2, align 4, !tbaa !7 -// CHECK:STDOUT: call void @_Z3fooIJiiEEv1XDpT_(i32 noundef %4, i32 noundef %5) -// CHECK:STDOUT: ret void -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: declare void @_Z3fooIJiiEEv1XDpT_(i32 noundef, i32 noundef) #1 -// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CCall1.Main() #2 !dbg !14 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_12.2.temp = alloca {}, align 8, !dbg !17 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc12_12.2.temp), !dbg !17 -// CHECK:STDOUT: call void @_Z3fooIJEEv1XDpT_.carbon_thunk(ptr @X.val.loc12_14.3), !dbg !18 -// CHECK:STDOUT: ret void, !dbg !19 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CCall2.Main() #2 !dbg !20 { +// CHECK:STDOUT: define void @_CCall2.Main() #0 !dbg !20 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc18_12.2.temp = alloca {}, align 8, !dbg !21 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_12.2.temp), !dbg !21 @@ -332,8 +295,22 @@ fn Call3() { // CHECK:STDOUT: ret void, !dbg !23 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z3fooIJiEEv1XDpT_.carbon_thunk(ptr noundef %0, i32 noundef %1) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca ptr, align 8 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %agg.tmp = alloca %class.X, align 1 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !17 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: %2 = load ptr, ptr %.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %3 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_Z3fooIJiEEv1XDpT_(i32 noundef %3) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CCall3.Main() #2 !dbg !24 { +// CHECK:STDOUT: define void @_CCall3.Main() #0 !dbg !24 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %.loc24_12.2.temp = alloca {}, align 8, !dbg !25 // CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc24_12.2.temp), !dbg !25 @@ -341,16 +318,39 @@ fn Call3() { // CHECK:STDOUT: ret void, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable +// CHECK:STDOUT: define internal void @_Z3fooIJiiEEv1XDpT_.carbon_thunk(ptr noundef %0, i32 noundef %1, i32 noundef %2) #1 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.addr = alloca ptr, align 8 +// CHECK:STDOUT: %.addr1 = alloca i32, align 4 +// CHECK:STDOUT: %.addr2 = alloca i32, align 4 +// CHECK:STDOUT: %agg.tmp = alloca %class.X, align 1 +// CHECK:STDOUT: store ptr %0, ptr %.addr, align 8, !tbaa !17 +// CHECK:STDOUT: store i32 %1, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: store i32 %2, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: %3 = load ptr, ptr %.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %4 = load i32, ptr %.addr1, align 4, !tbaa !7 +// CHECK:STDOUT: %5 = load i32, ptr %.addr2, align 4, !tbaa !7 +// CHECK:STDOUT: call void @_Z3fooIJiiEEv1XDpT_(i32 noundef %4, i32 noundef %5) +// CHECK:STDOUT: ret void +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z3fooIJEEv1XDpT_() #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z3fooIJiEEv1XDpT_(i32 noundef) #3 +// CHECK:STDOUT: +// CHECK:STDOUT: declare void @_Z3fooIJiiEEv1XDpT_(i32 noundef, i32 noundef) #3 // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives // CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 2, 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} // CHECK:STDOUT: !llvm.dbg.cu = !{!5} @@ -367,20 +367,20 @@ fn Call3() { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1X", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "Call1", linkageName: "_CCall1.Main", scope: null, file: !6, line: 10, type: !15, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !15 = !DISubroutineType(types: !16) -// CHECK:STDOUT: !16 = !{null} -// CHECK:STDOUT: !17 = !DILocation(line: 12, column: 11, scope: !14) -// CHECK:STDOUT: !18 = !DILocation(line: 12, column: 3, scope: !14) -// CHECK:STDOUT: !19 = !DILocation(line: 10, column: 1, scope: !14) -// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "Call2", linkageName: "_CCall2.Main", scope: null, file: !6, line: 16, type: !15, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Call1", linkageName: "_CCall1.Main", scope: null, file: !6, line: 10, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 12, column: 11, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 12, column: 3, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 10, column: 1, scope: !11) +// CHECK:STDOUT: !17 = !{!18, !18, i64 0} +// CHECK:STDOUT: !18 = !{!"p1 _ZTS1X", !19, i64 0} +// CHECK:STDOUT: !19 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "Call2", linkageName: "_CCall2.Main", scope: null, file: !6, line: 16, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !21 = !DILocation(line: 18, column: 11, scope: !20) // CHECK:STDOUT: !22 = !DILocation(line: 18, column: 3, scope: !20) // CHECK:STDOUT: !23 = !DILocation(line: 16, column: 1, scope: !20) -// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "Call3", linkageName: "_CCall3.Main", scope: null, file: !6, line: 22, type: !15, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "Call3", linkageName: "_CCall3.Main", scope: null, file: !6, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !5) // CHECK:STDOUT: !25 = !DILocation(line: 24, column: 11, scope: !24) // CHECK:STDOUT: !26 = !DILocation(line: 24, column: 3, scope: !24) // CHECK:STDOUT: !27 = !DILocation(line: 22, column: 1, scope: !24) diff --git a/toolchain/lower/testdata/interop/cpp/virtual_base.carbon b/toolchain/lower/testdata/interop/cpp/virtual_base.carbon index c98db911d71a..71eb3bed3f48 100644 --- a/toolchain/lower/testdata/interop/cpp/virtual_base.carbon +++ b/toolchain/lower/testdata/interop/cpp/virtual_base.carbon @@ -108,53 +108,53 @@ fn AccessD(d: Cpp.D) -> i32 { // CHECK:STDOUT: @_ZTI1D = linkonce_odr dso_local constant { ptr, ptr, i32, i32, ptr, i64, ptr, i64 } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2), ptr @_ZTS1D, i32 2, i32 2, ptr @_ZTI1B, i64 2, ptr @_ZTI1C, i64 4098 }, comdat, align 8 // CHECK:STDOUT: @_ZTS1D = linkonce_odr dso_local constant [3 x i8] c"1D\00", comdat, align 1 // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define void @_CMake.Main() #0 !dbg !11 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %_.var = alloca [40 x i8], align 1, !dbg !14 +// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !14 +// CHECK:STDOUT: call void @_ZN1DC1Ev.carbon_thunk(ptr %_.var), !dbg !15 +// CHECK:STDOUT: ret void, !dbg !16 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: alwaysinline mustprogress uwtable -// CHECK:STDOUT: define dso_local void @_ZN1DC1Ev.carbon_thunk(ptr noundef %return) #0 { +// CHECK:STDOUT: define internal void @_ZN1DC1Ev.carbon_thunk(ptr noundef %return) #1 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %return.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !11 -// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %return, ptr %return.addr, align 8, !tbaa !17 +// CHECK:STDOUT: %0 = load ptr, ptr %return.addr, align 8, !tbaa !17 // CHECK:STDOUT: call void @_ZN1DC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CAccessD.Main(ptr %d) #0 !dbg !20 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc16_11.1.d = getelementptr inbounds nuw [40 x i8], ptr %d, i32 0, i32 28, !dbg !27 +// CHECK:STDOUT: %.loc16_11.2 = load i32, ptr %.loc16_11.1.d, align 4, !dbg !27 +// CHECK:STDOUT: ret i32 %.loc16_11.2, !dbg !28 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #2 +// CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: inlinehint mustprogress uwtable -// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1DC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %this) unnamed_addr #1 comdat align 2 { +// CHECK:STDOUT: define linkonce_odr dso_local void @_ZN1DC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %this) unnamed_addr #3 comdat align 2 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %this.addr = alloca ptr, align 8 -// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !11 +// CHECK:STDOUT: store ptr %this, ptr %this.addr, align 8, !tbaa !17 // CHECK:STDOUT: %this1 = load ptr, ptr %this.addr, align 8 // CHECK:STDOUT: %0 = getelementptr inbounds i8, ptr %this1, i64 32 // CHECK:STDOUT: call void @_ZN1AC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %0) // CHECK:STDOUT: call void @_ZN1BC2Ev(ptr noundef nonnull align 8 dereferenceable(12) %this1, ptr noundef getelementptr inbounds nuw (i8, ptr @_ZTT1D, i64 8)) // CHECK:STDOUT: %1 = getelementptr inbounds i8, ptr %this1, i64 16 // CHECK:STDOUT: call void @_ZN1CC2Ev(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef getelementptr inbounds nuw (i8, ptr @_ZTT1D, i64 16)) -// CHECK:STDOUT: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr], [3 x ptr] }, ptr @_ZTV1D, i32 0, i32 0, i32 3), ptr %this1, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr], [3 x ptr] }, ptr @_ZTV1D, i32 0, i32 0, i32 3), ptr %this1, align 8, !tbaa !29 // CHECK:STDOUT: %add.ptr = getelementptr inbounds i8, ptr %this1, i64 16 -// CHECK:STDOUT: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr], [3 x ptr] }, ptr @_ZTV1D, i32 0, i32 1, i32 3), ptr %add.ptr, align 8, !tbaa !14 +// CHECK:STDOUT: store ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr], [3 x ptr] }, ptr @_ZTV1D, i32 0, i32 1, i32 3), ptr %add.ptr, align 8, !tbaa !29 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CMake.Main() #2 !dbg !16 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %_.var = alloca [40 x i8], align 1, !dbg !19 -// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %_.var), !dbg !19 -// CHECK:STDOUT: call void @_ZN1DC1Ev.carbon_thunk(ptr %_.var), !dbg !20 -// CHECK:STDOUT: ret void, !dbg !21 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CAccessD.Main(ptr %d) #2 !dbg !22 { -// CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc16_11.1.d = getelementptr inbounds nuw [40 x i8], ptr %d, i32 0, i32 28, !dbg !29 -// CHECK:STDOUT: %.loc16_11.2 = load i32, ptr %.loc16_11.1.d, align 4, !dbg !29 -// CHECK:STDOUT: ret i32 %.loc16_11.2, !dbg !30 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) -// CHECK:STDOUT: declare void @llvm.lifetime.start.p0(ptr captures(none)) #3 -// CHECK:STDOUT: // CHECK:STDOUT: declare void @_ZN1AC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 // CHECK:STDOUT: // CHECK:STDOUT: declare void @_ZN1BC2Ev(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef) unnamed_addr #4 @@ -168,10 +168,10 @@ fn AccessD(d: Cpp.D) -> i32 { // CHECK:STDOUT: uselistorder ptr getelementptr inbounds inrange(-24, 0) ({ [3 x ptr], [3 x ptr] }, ptr @_ZTV1D, i32 0, i32 1, i32 3), { 1, 0 } // CHECK:STDOUT: uselistorder ptr @_ZTI1D, { 1, 0 } // CHECK:STDOUT: -// CHECK:STDOUT: attributes #0 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #1 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } -// CHECK:STDOUT: attributes #2 = { nounwind } -// CHECK:STDOUT: attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #0 = { nounwind } +// CHECK:STDOUT: attributes #1 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +// CHECK:STDOUT: attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } +// CHECK:STDOUT: attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } // CHECK:STDOUT: // CHECK:STDOUT: !llvm.module.flags = !{!0, !1, !2, !3, !4} @@ -189,23 +189,23 @@ fn AccessD(d: Cpp.D) -> i32 { // CHECK:STDOUT: !8 = !{!"int", !9, i64 0} // CHECK:STDOUT: !9 = !{!"omnipotent char", !10, i64 0} // CHECK:STDOUT: !10 = !{!"Simple C++ TBAA"} -// CHECK:STDOUT: !11 = !{!12, !12, i64 0} -// CHECK:STDOUT: !12 = !{!"p1 _ZTS1D", !13, i64 0} -// CHECK:STDOUT: !13 = !{!"any pointer", !9, i64 0} -// CHECK:STDOUT: !14 = !{!15, !15, i64 0} -// CHECK:STDOUT: !15 = !{!"vtable pointer", !10, i64 0} -// CHECK:STDOUT: !16 = distinct !DISubprogram(name: "Make", linkageName: "_CMake.Main", scope: null, file: !6, line: 6, type: !17, spFlags: DISPFlagDefinition, unit: !5) -// CHECK:STDOUT: !17 = !DISubroutineType(types: !18) -// CHECK:STDOUT: !18 = !{null} -// CHECK:STDOUT: !19 = !DILocation(line: 11, column: 3, scope: !16) -// CHECK:STDOUT: !20 = !DILocation(line: 11, column: 18, scope: !16) -// CHECK:STDOUT: !21 = !DILocation(line: 6, column: 1, scope: !16) -// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "AccessD", linkageName: "_CAccessD.Main", scope: null, file: !6, line: 14, type: !23, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !27) -// CHECK:STDOUT: !23 = !DISubroutineType(types: !24) -// CHECK:STDOUT: !24 = !{!25, !26} -// CHECK:STDOUT: !25 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -// CHECK:STDOUT: !26 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) -// CHECK:STDOUT: !27 = !{!28} -// CHECK:STDOUT: !28 = !DILocalVariable(arg: 1, scope: !22, type: !26) -// CHECK:STDOUT: !29 = !DILocation(line: 16, column: 10, scope: !22) -// CHECK:STDOUT: !30 = !DILocation(line: 16, column: 3, scope: !22) +// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Make", linkageName: "_CMake.Main", scope: null, file: !6, line: 6, type: !12, spFlags: DISPFlagDefinition, unit: !5) +// CHECK:STDOUT: !12 = !DISubroutineType(types: !13) +// CHECK:STDOUT: !13 = !{null} +// CHECK:STDOUT: !14 = !DILocation(line: 11, column: 3, scope: !11) +// CHECK:STDOUT: !15 = !DILocation(line: 11, column: 18, scope: !11) +// CHECK:STDOUT: !16 = !DILocation(line: 6, column: 1, scope: !11) +// CHECK:STDOUT: !17 = !{!18, !18, i64 0} +// CHECK:STDOUT: !18 = !{!"p1 _ZTS1D", !19, i64 0} +// CHECK:STDOUT: !19 = !{!"any pointer", !9, i64 0} +// CHECK:STDOUT: !20 = distinct !DISubprogram(name: "AccessD", linkageName: "_CAccessD.Main", scope: null, file: !6, line: 14, type: !21, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !25) +// CHECK:STDOUT: !21 = !DISubroutineType(types: !22) +// CHECK:STDOUT: !22 = !{!23, !24} +// CHECK:STDOUT: !23 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +// CHECK:STDOUT: !24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) +// CHECK:STDOUT: !25 = !{!26} +// CHECK:STDOUT: !26 = !DILocalVariable(arg: 1, scope: !20, type: !24) +// CHECK:STDOUT: !27 = !DILocation(line: 16, column: 10, scope: !20) +// CHECK:STDOUT: !28 = !DILocation(line: 16, column: 3, scope: !20) +// CHECK:STDOUT: !29 = !{!30, !30, i64 0} +// CHECK:STDOUT: !30 = !{!"vtable pointer", !10, i64 0}