mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Model var as a pattern operator (#4720)
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
6572da7314
commit
13434f0e8a
+9
-10
@@ -18,7 +18,7 @@ fn F() {
|
||||
// CHECK:STDOUT: ; ModuleID = 'address_of_field.carbon'
|
||||
// CHECK:STDOUT: source_filename = "address_of_field.carbon"
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: @struct.loc14_47 = internal constant { i32, i32 } { i32 1, i32 2 }
|
||||
// CHECK:STDOUT: @struct.loc14_3.2 = internal constant { i32, i32 } { i32 1, i32 2 }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: declare void @_CG.Main(ptr)
|
||||
// CHECK:STDOUT:
|
||||
@@ -28,10 +28,10 @@ fn F() {
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %s.var), !dbg !7
|
||||
// CHECK:STDOUT: %.loc14_46.3.a = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 0, !dbg !8
|
||||
// CHECK:STDOUT: %.loc14_46.6.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !8
|
||||
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc14_47, i64 8, i1 false), !dbg !9
|
||||
// CHECK:STDOUT: %.loc15.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !10
|
||||
// CHECK:STDOUT: call void @_CG.Main(ptr %.loc15.b), !dbg !11
|
||||
// CHECK:STDOUT: ret void, !dbg !12
|
||||
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.loc14_3.2, i64 8, i1 false), !dbg !7
|
||||
// CHECK:STDOUT: %.loc15.b = getelementptr inbounds nuw { i32, i32 }, ptr %s.var, i32 0, i32 1, !dbg !9
|
||||
// CHECK:STDOUT: call void @_CG.Main(ptr %.loc15.b), !dbg !10
|
||||
// CHECK:STDOUT: ret void, !dbg !11
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
@@ -53,9 +53,8 @@ fn F() {
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 7, scope: !4)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 31, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 14, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 6, scope: !4)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 13, column: 1, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 15, column: 6, scope: !4)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 15, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 13, column: 1, scope: !4)
|
||||
|
||||
@@ -20,8 +20,8 @@ fn F() {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !7
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %n.var), !dbg !7
|
||||
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !8
|
||||
// CHECK:STDOUT: ret void, !dbg !9
|
||||
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !7
|
||||
// CHECK:STDOUT: ret void, !dbg !8
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
@@ -39,6 +39,5 @@ fn F() {
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 11, column: 1, scope: !4)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 11, column: 1, scope: !4)
|
||||
|
||||
+6
-7
@@ -30,9 +30,9 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: entry:
|
||||
// CHECK:STDOUT: %n.var = alloca i32, align 4, !dbg !10
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 4, ptr %n.var), !dbg !10
|
||||
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !11
|
||||
// CHECK:STDOUT: %G.call = call i32 @_CG.Main(ptr %n.var), !dbg !12
|
||||
// CHECK:STDOUT: ret i32 %G.call, !dbg !13
|
||||
// CHECK:STDOUT: store i32 0, ptr %n.var, align 4, !dbg !10
|
||||
// CHECK:STDOUT: %G.call = call i32 @_CG.Main(ptr %n.var), !dbg !11
|
||||
// CHECK:STDOUT: ret i32 %G.call, !dbg !12
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
@@ -53,7 +53,6 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 10, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 7, scope: !9)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 16, column: 3, scope: !9)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 17, column: 10, scope: !9)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 17, column: 3, scope: !9)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 3, scope: !9)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 17, column: 10, scope: !9)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 17, column: 3, scope: !9)
|
||||
|
||||
+16
-17
@@ -24,16 +24,16 @@ fn F(p: i32**) -> i32 {
|
||||
// CHECK:STDOUT: %b.var = alloca ptr, align 8, !dbg !7
|
||||
// CHECK:STDOUT: %c.var = alloca ptr, align 8, !dbg !7
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %a.var), !dbg !7
|
||||
// CHECK:STDOUT: store ptr %p, ptr %a.var, align 8, !dbg !8
|
||||
// CHECK:STDOUT: store ptr %p, ptr %a.var, align 8, !dbg !7
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %b.var), !dbg !7
|
||||
// CHECK:STDOUT: %.loc13_17.2 = load ptr, ptr %p, align 8, !dbg !9
|
||||
// CHECK:STDOUT: store ptr %.loc13_17.2, ptr %b.var, align 8, !dbg !10
|
||||
// CHECK:STDOUT: %.loc13_17.2 = load ptr, ptr %p, align 8, !dbg !8
|
||||
// CHECK:STDOUT: store ptr %.loc13_17.2, ptr %b.var, align 8, !dbg !9
|
||||
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(i64 8, ptr %c.var), !dbg !7
|
||||
// CHECK:STDOUT: store ptr %b.var, ptr %c.var, align 8, !dbg !11
|
||||
// CHECK:STDOUT: %.loc15_12 = load ptr, ptr %c.var, align 8, !dbg !12
|
||||
// CHECK:STDOUT: %.loc15_11.2 = load ptr, ptr %.loc15_12, align 8, !dbg !13
|
||||
// CHECK:STDOUT: %.loc15_10.2 = load i32, ptr %.loc15_11.2, align 4, !dbg !14
|
||||
// CHECK:STDOUT: ret i32 %.loc15_10.2, !dbg !15
|
||||
// CHECK:STDOUT: store ptr %b.var, ptr %c.var, align 8, !dbg !10
|
||||
// CHECK:STDOUT: %.loc15_12 = load ptr, ptr %c.var, align 8, !dbg !11
|
||||
// CHECK:STDOUT: %.loc15_11.2 = load ptr, ptr %.loc15_12, align 8, !dbg !12
|
||||
// CHECK:STDOUT: %.loc15_10.2 = load i32, ptr %.loc15_11.2, align 4, !dbg !13
|
||||
// CHECK:STDOUT: ret i32 %.loc15_10.2, !dbg !14
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
@@ -54,12 +54,11 @@ fn F(p: i32**) -> i32 {
|
||||
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 11, type: !5, spFlags: DISPFlagDefinition, unit: !2)
|
||||
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
|
||||
// CHECK:STDOUT: !6 = !{}
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 7, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 12, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 17, scope: !4)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 13, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 14, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 12, scope: !4)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 11, scope: !4)
|
||||
// CHECK:STDOUT: !14 = !DILocation(line: 15, column: 10, scope: !4)
|
||||
// CHECK:STDOUT: !15 = !DILocation(line: 15, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !7 = !DILocation(line: 12, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !8 = !DILocation(line: 13, column: 17, scope: !4)
|
||||
// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !10 = !DILocation(line: 14, column: 3, scope: !4)
|
||||
// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 12, scope: !4)
|
||||
// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 11, scope: !4)
|
||||
// CHECK:STDOUT: !13 = !DILocation(line: 15, column: 10, scope: !4)
|
||||
// CHECK:STDOUT: !14 = !DILocation(line: 15, column: 3, scope: !4)
|
||||
|
||||
Reference in New Issue
Block a user