mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Remove special case for returning value expressions by copy (#6052)
When returning a value from a function whose return type has a by-copy initializing representation, perform initialization like we do when the return type has an in-place initializing representation. This makes our SemIR representation more uniform, as the return expression will now always be an initializing expression rather than a value expression, but more importantly it means that attempts to return a non-copyable type by value now fail, even if the type has a by-copy initializing representation. This catches a bunch of places where we were returning a value of an unconstrained template parameter `T:! type`, which we were incorrectly allowing because we didn't notice it was not copyable. Unfortunately this then requires quite a few test updates. Like #6034, this exposes a lowering issue where lowering crashes when attempting to lower a specific copy operation for certain types; a couple more tests are temporarily disabled here. An upcoming PR dependent on this one will fix the issue and re-enable those tests.
This commit is contained in:
+166
-168
@@ -10,20 +10,23 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/generic/call_basic.carbon
|
||||
|
||||
class C {}
|
||||
class C {
|
||||
impl as Core.Copy {
|
||||
fn Op[self: Self]() -> Self { return {}; }
|
||||
}
|
||||
}
|
||||
|
||||
fn F[T:! type](x: T) {
|
||||
}
|
||||
|
||||
fn H[T:! type](x: T) -> T {
|
||||
fn H[T:! Core.Copy](x: T) -> T {
|
||||
return x;
|
||||
}
|
||||
|
||||
// Simple stress test for single depth of calls with change in types.
|
||||
// Check definitions are emitted for each specific.
|
||||
fn G[T:! type](x: T) -> T {
|
||||
fn G[T:! Core.Copy](x: T) -> T {
|
||||
H(x);
|
||||
H(T);
|
||||
H(i32);
|
||||
H(G(x));
|
||||
|
||||
@@ -37,7 +40,8 @@ fn G[T:! type](x: T) -> T {
|
||||
var ptr_i8 : i8*;
|
||||
H(ptr_i8);
|
||||
var c: C;
|
||||
H(c);
|
||||
// TODO: This causes a crash.
|
||||
// H(c);
|
||||
|
||||
return x;
|
||||
}
|
||||
@@ -59,67 +63,74 @@ fn M() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: %type = type {}
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define void @_CM.Main() !dbg !4 {
|
||||
// CHECK:STDOUT: @C.val.loc15_44 = internal constant {} zeroinitializer
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define void @"_COp.C.Main:Copy.Core"(ptr sret({}) %return, ptr %self) !dbg !4 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7
|
||||
// CHECK:STDOUT: %m.var = alloca i32, align 4, !dbg !8
|
||||
// CHECK:STDOUT: %p.var = alloca double, align 8, !dbg !9
|
||||
// CHECK:STDOUT: %q.var = alloca double, align 8, !dbg !10
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !7
|
||||
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !7
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %m.var), !dbg !8
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %p.var), !dbg !9
|
||||
// CHECK:STDOUT: store double 1.000000e+00, ptr %p.var, align 8, !dbg !9
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %q.var), !dbg !10
|
||||
// CHECK:STDOUT: %.loc51 = load i32, ptr %n.var, align 4, !dbg !11
|
||||
// CHECK:STDOUT: call void @_CF.Main.b88d1103f417c6d4(i32 %.loc51), !dbg !12
|
||||
// CHECK:STDOUT: %.loc52 = load i32, ptr %n.var, align 4, !dbg !13
|
||||
// CHECK:STDOUT: %G.call.loc52 = call i32 @_CG.Main.b88d1103f417c6d4(i32 %.loc52), !dbg !14
|
||||
// CHECK:STDOUT: store i32 %G.call.loc52, ptr %m.var, align 4, !dbg !15
|
||||
// CHECK:STDOUT: %.loc53 = load double, ptr %p.var, align 8, !dbg !16
|
||||
// CHECK:STDOUT: call void @_CF.Main.d4b5665541d5d7a8(double %.loc53), !dbg !17
|
||||
// CHECK:STDOUT: %.loc54 = load double, ptr %p.var, align 8, !dbg !18
|
||||
// CHECK:STDOUT: %G.call.loc54 = call double @_CG.Main.d4b5665541d5d7a8(double %.loc54), !dbg !19
|
||||
// CHECK:STDOUT: store double %G.call.loc54, ptr %q.var, align 8, !dbg !20
|
||||
// CHECK:STDOUT: ret void, !dbg !21
|
||||
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %return, ptr align 1 @C.val.loc15_44, i64 0, i1 false), !dbg !7
|
||||
// CHECK:STDOUT: ret void, !dbg !7
|
||||
// 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)) #0
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) !dbg !22 {
|
||||
// CHECK:STDOUT: define void @_CM.Main() !dbg !8 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !9
|
||||
// CHECK:STDOUT: %m.var = alloca i32, align 4, !dbg !10
|
||||
// CHECK:STDOUT: %p.var = alloca double, align 8, !dbg !11
|
||||
// CHECK:STDOUT: %q.var = alloca double, align 8, !dbg !12
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %n.var), !dbg !9
|
||||
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !9
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %m.var), !dbg !10
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %p.var), !dbg !11
|
||||
// CHECK:STDOUT: store double 1.000000e+00, ptr %p.var, align 8, !dbg !11
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %q.var), !dbg !12
|
||||
// CHECK:STDOUT: %.loc55 = load i32, ptr %n.var, align 4, !dbg !13
|
||||
// CHECK:STDOUT: call void @_CF.Main.b88d1103f417c6d4(i32 %.loc55), !dbg !14
|
||||
// CHECK:STDOUT: %.loc56_9 = load i32, ptr %n.var, align 4, !dbg !15
|
||||
// CHECK:STDOUT: %G.call.loc56 = call i32 @_CG.Main.b7c8e4dff2adcdaa(i32 %.loc56_9), !dbg !16
|
||||
// CHECK:STDOUT: store i32 %G.call.loc56, ptr %m.var, align 4, !dbg !17
|
||||
// CHECK:STDOUT: %.loc57 = load double, ptr %p.var, align 8, !dbg !18
|
||||
// CHECK:STDOUT: call void @_CF.Main.d4b5665541d5d7a8(double %.loc57), !dbg !19
|
||||
// CHECK:STDOUT: %.loc58_9 = load double, ptr %p.var, align 8, !dbg !20
|
||||
// CHECK:STDOUT: %G.call.loc58 = call double @_CG.Main.274514a8254d0859(double %.loc58_9), !dbg !21
|
||||
// CHECK:STDOUT: store double %G.call.loc58, ptr %q.var, align 8, !dbg !22
|
||||
// CHECK:STDOUT: ret void, !dbg !23
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.b88d1103f417c6d4(i32 %x) !dbg !24 {
|
||||
// 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) #0
|
||||
// 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)) #1
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr void @_CF.Main.b88d1103f417c6d4(i32 %x) !dbg !24 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %var_f64.var = alloca double, align 8, !dbg !25
|
||||
// CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !26
|
||||
// CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !27
|
||||
// CHECK:STDOUT: %ptr_i8.var = alloca ptr, align 8, !dbg !28
|
||||
// CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !29
|
||||
// CHECK:STDOUT: %.loc40_6.1.temp = alloca {}, align 8, !dbg !30
|
||||
// CHECK:STDOUT: %H.call.loc25 = call i32 @_CH.Main.b88d1103f417c6d4(i32 %x), !dbg !31
|
||||
// CHECK:STDOUT: %H.call.loc26 = call %type @_CH.Main.5754c7a55c7cbe4a(%type zeroinitializer), !dbg !32
|
||||
// CHECK:STDOUT: %H.call.loc27 = call %type @_CH.Main.5754c7a55c7cbe4a(%type zeroinitializer), !dbg !33
|
||||
// CHECK:STDOUT: %G.call = call i32 @_CG.Main.b88d1103f417c6d4(i32 %x), !dbg !34
|
||||
// CHECK:STDOUT: %H.call.loc28 = call i32 @_CH.Main.b88d1103f417c6d4(i32 %G.call), !dbg !35
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %var_f64.var), !dbg !25
|
||||
// CHECK:STDOUT: %.loc32 = load double, ptr %var_f64.var, align 8, !dbg !36
|
||||
// CHECK:STDOUT: %H.call.loc32 = call double @_CH.Main.d4b5665541d5d7a8(double %.loc32), !dbg !37
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_i32.var), !dbg !26
|
||||
// CHECK:STDOUT: %.loc34 = load ptr, ptr %ptr_i32.var, align 8, !dbg !38
|
||||
// CHECK:STDOUT: %H.call.loc34 = call ptr @_CH.Main.e8193710fd35b608(ptr %.loc34), !dbg !39
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_f64.var), !dbg !27
|
||||
// CHECK:STDOUT: %.loc36 = load ptr, ptr %ptr_f64.var, align 8, !dbg !40
|
||||
// CHECK:STDOUT: %H.call.loc36 = call ptr @_CH.Main.e8193710fd35b608(ptr %.loc36), !dbg !41
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_i8.var), !dbg !28
|
||||
// CHECK:STDOUT: %.loc38 = load ptr, ptr %ptr_i8.var, align 8, !dbg !42
|
||||
// CHECK:STDOUT: %H.call.loc38 = call ptr @_CH.Main.e8193710fd35b608(ptr %.loc38), !dbg !43
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !29
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc40_6.1.temp), !dbg !30
|
||||
// CHECK:STDOUT: call void @_CH.Main.15b1f98bd9cc0c5b(ptr %.loc40_6.1.temp, ptr %c.var), !dbg !30
|
||||
// CHECK:STDOUT: ret void, !dbg !25
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr i32 @_CG.Main.b7c8e4dff2adcdaa(i32 %x) !dbg !26 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %var_f64.var = alloca double, align 8, !dbg !27
|
||||
// CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !28
|
||||
// CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !29
|
||||
// CHECK:STDOUT: %ptr_i8.var = alloca ptr, align 8, !dbg !30
|
||||
// CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !31
|
||||
// CHECK:STDOUT: %H.call.loc29 = call i32 @_CH.Main.b7c8e4dff2adcdaa(i32 %x), !dbg !32
|
||||
// CHECK:STDOUT: %H.call.loc30 = call %type @_CH.Main.08871b6f43862d33(%type zeroinitializer), !dbg !33
|
||||
// CHECK:STDOUT: %G.call = call i32 @_CG.Main.b7c8e4dff2adcdaa(i32 %x), !dbg !34
|
||||
// CHECK:STDOUT: %H.call.loc31 = call i32 @_CH.Main.b7c8e4dff2adcdaa(i32 %G.call), !dbg !35
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %var_f64.var), !dbg !27
|
||||
// CHECK:STDOUT: %.loc35_5 = load double, ptr %var_f64.var, align 8, !dbg !36
|
||||
// CHECK:STDOUT: %H.call.loc35 = call double @_CH.Main.274514a8254d0859(double %.loc35_5), !dbg !37
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_i32.var), !dbg !28
|
||||
// CHECK:STDOUT: %.loc37_5 = load ptr, ptr %ptr_i32.var, align 8, !dbg !38
|
||||
// CHECK:STDOUT: %H.call.loc37 = call ptr @_CH.Main.19c352736f719291(ptr %.loc37_5), !dbg !39
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_f64.var), !dbg !29
|
||||
// CHECK:STDOUT: %.loc39_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !40
|
||||
// CHECK:STDOUT: %H.call.loc39 = call ptr @_CH.Main.19c352736f719291(ptr %.loc39_5), !dbg !41
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_i8.var), !dbg !30
|
||||
// CHECK:STDOUT: %.loc41_5 = load ptr, ptr %ptr_i8.var, align 8, !dbg !42
|
||||
// CHECK:STDOUT: %H.call.loc41 = call ptr @_CH.Main.19c352736f719291(ptr %.loc41_5), !dbg !43
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !31
|
||||
// CHECK:STDOUT: ret i32 %x, !dbg !44
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -128,71 +139,62 @@ fn M() {
|
||||
// CHECK:STDOUT: ret void, !dbg !46
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr double @_CG.Main.d4b5665541d5d7a8(double %x) !dbg !47 {
|
||||
// CHECK:STDOUT: define linkonce_odr double @_CG.Main.274514a8254d0859(double %x) !dbg !47 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %var_f64.var = alloca double, align 8, !dbg !48
|
||||
// CHECK:STDOUT: %ptr_i32.var = alloca ptr, align 8, !dbg !49
|
||||
// CHECK:STDOUT: %ptr_f64.var = alloca ptr, align 8, !dbg !50
|
||||
// CHECK:STDOUT: %ptr_i8.var = alloca ptr, align 8, !dbg !51
|
||||
// CHECK:STDOUT: %c.var = alloca {}, align 8, !dbg !52
|
||||
// CHECK:STDOUT: %.loc40_6.1.temp = alloca {}, align 8, !dbg !53
|
||||
// CHECK:STDOUT: %H.call.loc25 = call double @_CH.Main.d4b5665541d5d7a8(double %x), !dbg !54
|
||||
// CHECK:STDOUT: %H.call.loc26 = call %type @_CH.Main.5754c7a55c7cbe4a(%type zeroinitializer), !dbg !55
|
||||
// CHECK:STDOUT: %H.call.loc27 = call %type @_CH.Main.5754c7a55c7cbe4a(%type zeroinitializer), !dbg !56
|
||||
// CHECK:STDOUT: %G.call = call double @_CG.Main.d4b5665541d5d7a8(double %x), !dbg !57
|
||||
// CHECK:STDOUT: %H.call.loc28 = call double @_CH.Main.d4b5665541d5d7a8(double %G.call), !dbg !58
|
||||
// CHECK:STDOUT: %H.call.loc29 = call double @_CH.Main.274514a8254d0859(double %x), !dbg !53
|
||||
// CHECK:STDOUT: %H.call.loc30 = call %type @_CH.Main.08871b6f43862d33(%type zeroinitializer), !dbg !54
|
||||
// CHECK:STDOUT: %G.call = call double @_CG.Main.274514a8254d0859(double %x), !dbg !55
|
||||
// CHECK:STDOUT: %H.call.loc31 = call double @_CH.Main.274514a8254d0859(double %G.call), !dbg !56
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %var_f64.var), !dbg !48
|
||||
// CHECK:STDOUT: %.loc32 = load double, ptr %var_f64.var, align 8, !dbg !59
|
||||
// CHECK:STDOUT: %H.call.loc32 = call double @_CH.Main.d4b5665541d5d7a8(double %.loc32), !dbg !60
|
||||
// CHECK:STDOUT: %.loc35_5 = load double, ptr %var_f64.var, align 8, !dbg !57
|
||||
// CHECK:STDOUT: %H.call.loc35 = call double @_CH.Main.274514a8254d0859(double %.loc35_5), !dbg !58
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_i32.var), !dbg !49
|
||||
// CHECK:STDOUT: %.loc34 = load ptr, ptr %ptr_i32.var, align 8, !dbg !61
|
||||
// CHECK:STDOUT: %H.call.loc34 = call ptr @_CH.Main.e8193710fd35b608(ptr %.loc34), !dbg !62
|
||||
// CHECK:STDOUT: %.loc37_5 = load ptr, ptr %ptr_i32.var, align 8, !dbg !59
|
||||
// CHECK:STDOUT: %H.call.loc37 = call ptr @_CH.Main.19c352736f719291(ptr %.loc37_5), !dbg !60
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_f64.var), !dbg !50
|
||||
// CHECK:STDOUT: %.loc36 = load ptr, ptr %ptr_f64.var, align 8, !dbg !63
|
||||
// CHECK:STDOUT: %H.call.loc36 = call ptr @_CH.Main.e8193710fd35b608(ptr %.loc36), !dbg !64
|
||||
// CHECK:STDOUT: %.loc39_5 = load ptr, ptr %ptr_f64.var, align 8, !dbg !61
|
||||
// CHECK:STDOUT: %H.call.loc39 = call ptr @_CH.Main.19c352736f719291(ptr %.loc39_5), !dbg !62
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %ptr_i8.var), !dbg !51
|
||||
// CHECK:STDOUT: %.loc38 = load ptr, ptr %ptr_i8.var, align 8, !dbg !65
|
||||
// CHECK:STDOUT: %H.call.loc38 = call ptr @_CH.Main.e8193710fd35b608(ptr %.loc38), !dbg !66
|
||||
// CHECK:STDOUT: %.loc41_5 = load ptr, ptr %ptr_i8.var, align 8, !dbg !63
|
||||
// CHECK:STDOUT: %H.call.loc41 = call ptr @_CH.Main.19c352736f719291(ptr %.loc41_5), !dbg !64
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %c.var), !dbg !52
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc40_6.1.temp), !dbg !53
|
||||
// CHECK:STDOUT: call void @_CH.Main.15b1f98bd9cc0c5b(ptr %.loc40_6.1.temp, ptr %c.var), !dbg !53
|
||||
// CHECK:STDOUT: ret double %x, !dbg !67
|
||||
// CHECK:STDOUT: ret double %x, !dbg !65
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr i32 @_CH.Main.b88d1103f417c6d4(i32 %x) !dbg !68 {
|
||||
// CHECK:STDOUT: define linkonce_odr i32 @_CH.Main.b7c8e4dff2adcdaa(i32 %x) !dbg !66 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: ret i32 %x, !dbg !69
|
||||
// CHECK:STDOUT: ret i32 %x, !dbg !67
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr %type @_CH.Main.5754c7a55c7cbe4a(%type %x) !dbg !70 {
|
||||
// CHECK:STDOUT: define linkonce_odr %type @_CH.Main.08871b6f43862d33(%type %x) !dbg !68 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: ret %type %x, !dbg !71
|
||||
// CHECK:STDOUT: ret %type %x, !dbg !69
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr double @_CH.Main.d4b5665541d5d7a8(double %x) !dbg !72 {
|
||||
// CHECK:STDOUT: define linkonce_odr double @_CH.Main.274514a8254d0859(double %x) !dbg !70 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: ret double %x, !dbg !73
|
||||
// CHECK:STDOUT: ret double %x, !dbg !71
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr ptr @_CH.Main.e8193710fd35b608(ptr %x) !dbg !74 {
|
||||
// CHECK:STDOUT: define linkonce_odr ptr @_CH.Main.19c352736f719291(ptr %x) !dbg !72 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: ret ptr %x, !dbg !75
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define linkonce_odr void @_CH.Main.15b1f98bd9cc0c5b(ptr sret({}) %return, ptr %x) !dbg !76 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: ret void, !dbg !77
|
||||
// CHECK:STDOUT: ret ptr %x, !dbg !73
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; uselistorder directives
|
||||
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 14, 13, 12 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.b88d1103f417c6d4, { 1, 0 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.5754c7a55c7cbe4a, { 3, 2, 1, 0 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.d4b5665541d5d7a8, { 3, 2, 1, 0 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.e8193710fd35b608, { 5, 2, 0, 4, 3, 1 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.15b1f98bd9cc0c5b, { 1, 0 }
|
||||
// CHECK:STDOUT: uselistorder ptr @llvm.lifetime.start.p0, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 12, 11, 10 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.b7c8e4dff2adcdaa, { 1, 0 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.08871b6f43862d33, { 1, 0 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.274514a8254d0859, { 3, 2, 1, 0 }
|
||||
// CHECK:STDOUT: uselistorder ptr @_CH.Main.19c352736f719291, { 5, 2, 0, 4, 3, 1 }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
||||
// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
|
||||
// CHECK:STDOUT: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !llvm.module.flags = !{!0, !1}
|
||||
// CHECK:STDOUT: !llvm.dbg.cu = !{!2}
|
||||
@@ -201,77 +203,73 @@ fn M() {
|
||||
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
|
||||
// CHECK:STDOUT: !3 = !DIFile(filename: "call_basic.carbon", directory: "")
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "M", linkageName: "_CM.Main", scope: null, file: !3, line: 45, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Op", linkageName: "_COp.C.Main:Copy.Core", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 46, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 47, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 48, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 49, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 51, column: 5, scope: !4)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 51, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 52, column: 9, scope: !4)
|
||||
// CHECK:STDOUT: !14 = !DILocation(line: 52, column: 7, scope: !4)
|
||||
// CHECK:STDOUT: !15 = !DILocation(line: 52, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !16 = !DILocation(line: 53, column: 5, scope: !4)
|
||||
// CHECK:STDOUT: !17 = !DILocation(line: 53, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !18 = !DILocation(line: 54, column: 9, scope: !4)
|
||||
// CHECK:STDOUT: !19 = !DILocation(line: 54, column: 7, scope: !4)
|
||||
// CHECK:STDOUT: !20 = !DILocation(line: 54, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !21 = !DILocation(line: 45, column: 1, scope: !4)
|
||||
// CHECK:STDOUT: !22 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main.b88d1103f417c6d4", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !23 = !DILocation(line: 15, column: 1, scope: !22)
|
||||
// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.b88d1103f417c6d4", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !25 = !DILocation(line: 31, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !26 = !DILocation(line: 33, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !27 = !DILocation(line: 35, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !28 = !DILocation(line: 37, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !29 = !DILocation(line: 39, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !30 = !DILocation(line: 40, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !31 = !DILocation(line: 25, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !32 = !DILocation(line: 26, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !33 = !DILocation(line: 27, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !34 = !DILocation(line: 28, column: 5, scope: !24)
|
||||
// CHECK:STDOUT: !35 = !DILocation(line: 28, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !36 = !DILocation(line: 32, column: 5, scope: !24)
|
||||
// CHECK:STDOUT: !37 = !DILocation(line: 32, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !38 = !DILocation(line: 34, column: 5, scope: !24)
|
||||
// CHECK:STDOUT: !39 = !DILocation(line: 34, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !40 = !DILocation(line: 36, column: 5, scope: !24)
|
||||
// CHECK:STDOUT: !41 = !DILocation(line: 36, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !42 = !DILocation(line: 38, column: 5, scope: !24)
|
||||
// CHECK:STDOUT: !43 = !DILocation(line: 38, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !44 = !DILocation(line: 42, column: 3, scope: !24)
|
||||
// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main.d4b5665541d5d7a8", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !46 = !DILocation(line: 15, column: 1, scope: !45)
|
||||
// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.d4b5665541d5d7a8", scope: null, file: !3, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !48 = !DILocation(line: 31, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !49 = !DILocation(line: 33, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !50 = !DILocation(line: 35, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !51 = !DILocation(line: 37, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !52 = !DILocation(line: 39, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !53 = !DILocation(line: 40, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !54 = !DILocation(line: 25, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !55 = !DILocation(line: 26, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !56 = !DILocation(line: 27, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !57 = !DILocation(line: 28, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !58 = !DILocation(line: 28, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !59 = !DILocation(line: 32, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !60 = !DILocation(line: 32, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !61 = !DILocation(line: 34, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !62 = !DILocation(line: 34, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !63 = !DILocation(line: 36, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !64 = !DILocation(line: 36, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !65 = !DILocation(line: 38, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !66 = !DILocation(line: 38, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !67 = !DILocation(line: 42, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !68 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.b88d1103f417c6d4", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !69 = !DILocation(line: 19, column: 3, scope: !68)
|
||||
// CHECK:STDOUT: !70 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.5754c7a55c7cbe4a", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !71 = !DILocation(line: 19, column: 3, scope: !70)
|
||||
// CHECK:STDOUT: !72 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.d4b5665541d5d7a8", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !73 = !DILocation(line: 19, column: 3, scope: !72)
|
||||
// CHECK:STDOUT: !74 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.e8193710fd35b608", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !75 = !DILocation(line: 19, column: 3, scope: !74)
|
||||
// CHECK:STDOUT: !76 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.15b1f98bd9cc0c5b", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !77 = !DILocation(line: 19, column: 3, scope: !76)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 15, column: 35, scope: !4)
|
||||
// CHECK:STDOUT: !8 = distinct !DISubprogram(name: "M", linkageName: "_CM.Main", scope: null, file: !3, line: 49, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 50, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 51, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 52, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 53, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 55, column: 5, scope: !8)
|
||||
// CHECK:STDOUT: !14 = !DILocation(line: 55, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !15 = !DILocation(line: 56, column: 9, scope: !8)
|
||||
// CHECK:STDOUT: !16 = !DILocation(line: 56, column: 7, scope: !8)
|
||||
// CHECK:STDOUT: !17 = !DILocation(line: 56, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !18 = !DILocation(line: 57, column: 5, scope: !8)
|
||||
// CHECK:STDOUT: !19 = !DILocation(line: 57, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !20 = !DILocation(line: 58, column: 9, scope: !8)
|
||||
// CHECK:STDOUT: !21 = !DILocation(line: 58, column: 7, scope: !8)
|
||||
// CHECK:STDOUT: !22 = !DILocation(line: 58, column: 3, scope: !8)
|
||||
// CHECK:STDOUT: !23 = !DILocation(line: 49, column: 1, scope: !8)
|
||||
// CHECK:STDOUT: !24 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main.b88d1103f417c6d4", scope: null, file: !3, line: 19, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !25 = !DILocation(line: 19, column: 1, scope: !24)
|
||||
// CHECK:STDOUT: !26 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.b7c8e4dff2adcdaa", scope: null, file: !3, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !27 = !DILocation(line: 34, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !28 = !DILocation(line: 36, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !29 = !DILocation(line: 38, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !30 = !DILocation(line: 40, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !31 = !DILocation(line: 42, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !32 = !DILocation(line: 29, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !33 = !DILocation(line: 30, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !34 = !DILocation(line: 31, column: 5, scope: !26)
|
||||
// CHECK:STDOUT: !35 = !DILocation(line: 31, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !36 = !DILocation(line: 35, column: 5, scope: !26)
|
||||
// CHECK:STDOUT: !37 = !DILocation(line: 35, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !38 = !DILocation(line: 37, column: 5, scope: !26)
|
||||
// CHECK:STDOUT: !39 = !DILocation(line: 37, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !40 = !DILocation(line: 39, column: 5, scope: !26)
|
||||
// CHECK:STDOUT: !41 = !DILocation(line: 39, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !42 = !DILocation(line: 41, column: 5, scope: !26)
|
||||
// CHECK:STDOUT: !43 = !DILocation(line: 41, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !44 = !DILocation(line: 46, column: 3, scope: !26)
|
||||
// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main.d4b5665541d5d7a8", scope: null, file: !3, line: 19, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !46 = !DILocation(line: 19, column: 1, scope: !45)
|
||||
// CHECK:STDOUT: !47 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main.274514a8254d0859", scope: null, file: !3, line: 28, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !48 = !DILocation(line: 34, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !49 = !DILocation(line: 36, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !50 = !DILocation(line: 38, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !51 = !DILocation(line: 40, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !52 = !DILocation(line: 42, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !53 = !DILocation(line: 29, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !54 = !DILocation(line: 30, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !55 = !DILocation(line: 31, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !56 = !DILocation(line: 31, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !57 = !DILocation(line: 35, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !58 = !DILocation(line: 35, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !59 = !DILocation(line: 37, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !60 = !DILocation(line: 37, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !61 = !DILocation(line: 39, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !62 = !DILocation(line: 39, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !63 = !DILocation(line: 41, column: 5, scope: !47)
|
||||
// CHECK:STDOUT: !64 = !DILocation(line: 41, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !65 = !DILocation(line: 46, column: 3, scope: !47)
|
||||
// CHECK:STDOUT: !66 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.b7c8e4dff2adcdaa", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !67 = !DILocation(line: 23, column: 3, scope: !66)
|
||||
// CHECK:STDOUT: !68 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.08871b6f43862d33", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !69 = !DILocation(line: 23, column: 3, scope: !68)
|
||||
// CHECK:STDOUT: !70 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.274514a8254d0859", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !71 = !DILocation(line: 23, column: 3, scope: !70)
|
||||
// CHECK:STDOUT: !72 = distinct !DISubprogram(name: "H", linkageName: "_CH.Main.19c352736f719291", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !73 = !DILocation(line: 23, column: 3, scope: !72)
|
||||
|
||||
Reference in New Issue
Block a user