From 01590ee91b16712ea451e6a3ef825b5b26605945 Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Tue, 25 Jul 2023 13:47:05 -0500 Subject: [PATCH 1/8] add test for `assert` bucket --- circom/tests/debuginfo/assert_bucket.circom | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 circom/tests/debuginfo/assert_bucket.circom diff --git a/circom/tests/debuginfo/assert_bucket.circom b/circom/tests/debuginfo/assert_bucket.circom new file mode 100644 index 000000000..c25db1f94 --- /dev/null +++ b/circom/tests/debuginfo/assert_bucket.circom @@ -0,0 +1,46 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template A(n) { + signal input in; + assert(in > 0); +} + +component main = A(5); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. +// +//CHECK-LABEL: define void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:store[0-9]+]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:assert[0-9]+]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-COUNT-05: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L4:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-NEXT: ret void, !dbg !10 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}assert_bucket.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "A", linkageName: "A_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "A", linkageName: "A_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = !DILocation(line: 7, scope: !8) From 6eecaa612e5ddc69c157456ac6df411010556aa3 Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Tue, 25 Jul 2023 14:44:29 -0500 Subject: [PATCH 2/8] add test for `branch` bucket --- circom/tests/debuginfo/assert_bucket.circom | 6 +- circom/tests/debuginfo/branch_bucket.circom | 71 +++++++++++++++++++++ 2 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 circom/tests/debuginfo/branch_bucket.circom diff --git a/circom/tests/debuginfo/assert_bucket.circom b/circom/tests/debuginfo/assert_bucket.circom index c25db1f94..3f621807e 100644 --- a/circom/tests/debuginfo/assert_bucket.circom +++ b/circom/tests/debuginfo/assert_bucket.circom @@ -15,7 +15,7 @@ component main = A(5); // define a variable. The only alternatives are to lose the extra check given by matching // full lines or to remove the "--match-full-lines" option and surround each check with // {{^}} and {{$}} but it gets messy. -// + //CHECK-LABEL: define void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { //CHECK-NEXT: [[L1:main]]: //CHECK-COUNT-06: {{.*}}, !dbg !7 @@ -26,10 +26,10 @@ component main = A(5); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:store[0-9]+]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:assert[0-9]+]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:assert[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] //CHECK-COUNT-05: {{.*}}, !dbg !10 //CHECK-EMPTY: //CHECK-NEXT: [[L4:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] diff --git a/circom/tests/debuginfo/branch_bucket.circom b/circom/tests/debuginfo/branch_bucket.circom new file mode 100644 index 000000000..6299091a6 --- /dev/null +++ b/circom/tests/debuginfo/branch_bucket.circom @@ -0,0 +1,71 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template B() { + signal input in1; + signal input in2; + signal output out; + + var x; + if (in1 > 0) { + x = in1; + } else { + x = in2; + } + out <-- x; +} + +component main = B(); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define void @B_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define void @B_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:branch[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-COUNT-04: {{.*}}, !dbg !11 +//CHECK-EMPTY: +//CHECK-NEXT: [[L4:if.then[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-COUNT-05: {{.*}}, !dbg !12 +//CHECK-EMPTY: +//CHECK-NEXT: [[L5:if.else[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-COUNT-05: {{.*}}, !dbg !13 +//CHECK-EMPTY: +//CHECK-NEXT: [[L6:if.merge[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L5]], %{{.*}}[[L4]] +//CHECK-COUNT-01: {{.*}}, !dbg !13 +//CHECK-EMPTY: +//CHECK-NEXT: [[L7:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L6]] +//CHECK-COUNT-05: {{.*}}, !dbg !14 +//CHECK-EMPTY: +//CHECK-NEXT: [[L8:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L7]] +//CHECK-NEXT: ret void, !dbg !14 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}branch_bucket.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "B", linkageName: "B_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "B", linkageName: "B_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = !DILocation(line: 10, scope: !8) +//CHECK: !11 = !DILocation(line: 11, scope: !8) +//CHECK: !12 = !DILocation(line: 12, scope: !8) +//CHECK: !13 = !DILocation(line: 14, scope: !8) +//CHECK: !14 = !DILocation(line: 16, scope: !8) From 07ba7c064c02d115a9af4fcd9145168c89017e21 Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Tue, 25 Jul 2023 15:15:34 -0500 Subject: [PATCH 3/8] add test for `call` bucket --- circom/tests/debuginfo/call_bucket.circom | 74 +++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 circom/tests/debuginfo/call_bucket.circom diff --git a/circom/tests/debuginfo/call_bucket.circom b/circom/tests/debuginfo/call_bucket.circom new file mode 100644 index 000000000..5831799a9 --- /dev/null +++ b/circom/tests/debuginfo/call_bucket.circom @@ -0,0 +1,74 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template C() { + signal input in; + signal output out; + out <-- negative(in); +} + +function negative(n){ + if (n < 0) { + return 1; + } else { + return 0; + } +} + +component main = C(); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define i256 @negative_0(i256* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:[[:alnum:]_]+]]: +//CHECK-COUNT-01: {{.*}}, !dbg !7 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:branch[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-04: {{.*}}, !dbg !8 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:if.then[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: ret i256 1, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L4:if.else[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: ret i256 0, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L5:if.merge[0-9]*]]:{{[[:space:]]}}; No predecessors! +//CHECK-NEXT: unreachable, !dbg !10 +//CHECK-NEXT: } + +//CHECK-LABEL: define void @C_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !11 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !12 +//CHECK-NEXT: ret void, !dbg !12 +//CHECK-NEXT: } + +//CHECK-LABEL: define void @C_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !13 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !14 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:call[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-10: {{.*}}, !dbg !15 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: ret void, !dbg !15 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}call_bucket.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "negative", linkageName: "negative_0", scope: null, file: !2, line: 11, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 11, scope: !4) +//CHECK: !8 = !DILocation(line: 12, scope: !4) +//CHECK: !9 = !DILocation(line: 13, scope: !4) +//CHECK: !10 = !DILocation(line: 15, scope: !4) +//CHECK: !11 = distinct !DISubprogram(name: "C", linkageName: "C_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !12 = !DILocation(line: 5, scope: !11) +//CHECK: !13 = distinct !DISubprogram(name: "C", linkageName: "C_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !14 = !DILocation(line: 5, scope: !13) +//CHECK: !15 = !DILocation(line: 8, scope: !13) From 5490c0fd0a2f0264f7fbe95b784b6541bf437bf6 Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Wed, 26 Jul 2023 11:21:28 -0500 Subject: [PATCH 4/8] add test for `create_component` bucket --- .../debuginfo/create_component_bucket.circom | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 circom/tests/debuginfo/create_component_bucket.circom diff --git a/circom/tests/debuginfo/create_component_bucket.circom b/circom/tests/debuginfo/create_component_bucket.circom new file mode 100644 index 000000000..d0e1cda42 --- /dev/null +++ b/circom/tests/debuginfo/create_component_bucket.circom @@ -0,0 +1,75 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template B(n) { + signal input in; +} + +template A(n) { + signal input in; + component x = B(n * n); + x.in <-- in; +} + +component main = A(5); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define void @B_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define void @B_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: ret void, !dbg !9 +//CHECK-NEXT: } + +//CHECK-LABEL: define void @A_1_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !10 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !11 +//CHECK-NEXT: ret void, !dbg !11 +//CHECK-NEXT: } + +//CHECK-LABEL: define void @A_1_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !12 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !13 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-03: {{.*}}, !dbg !13 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:create_cmp[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-COUNT-03: {{.*}}, !dbg !13 +//CHECK-EMPTY: +//CHECK-NEXT: [[L4:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-COUNT-14: {{.*}}, !dbg !14 +//CHECK-EMPTY: +//CHECK-NEXT: [[L5:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L4]] +//CHECK-NEXT: ret void, !dbg !14 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}create_component_bucket.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "B", linkageName: "B_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "B", linkageName: "B_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = distinct !DISubprogram(name: "A", linkageName: "A_1_build", scope: null, file: !2, line: 9, {{.*}}unit: !1{{.*}}) +//CHECK: !11 = !DILocation(line: 9, scope: !10) +//CHECK: !12 = distinct !DISubprogram(name: "A", linkageName: "A_1_run", scope: null, file: !2, line: 9, {{.*}}unit: !1{{.*}}) +//CHECK: !13 = !DILocation(line: 9, scope: !12) +//CHECK: !14 = !DILocation(line: 12, scope: !12) From 148debfe5deef5cb74314ed81161d90c73cfdfe5 Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Thu, 26 Oct 2023 16:19:35 -0500 Subject: [PATCH 5/8] give simpler names to existing tests --- .../debuginfo/{assert_bucket.circom => assert.circom} | 6 +++--- .../debuginfo/{branch_bucket.circom => branch.circom} | 6 +++--- .../{call_bucket.circom => call_and_return.circom} | 8 ++++---- ...component_bucket.circom => create_component.circom} | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) rename circom/tests/debuginfo/{assert_bucket.circom => assert.circom} (88%) rename circom/tests/debuginfo/{branch_bucket.circom => branch.circom} (91%) rename circom/tests/debuginfo/{call_bucket.circom => call_and_return.circom} (89%) rename circom/tests/debuginfo/{create_component_bucket.circom => create_component.circom} (86%) diff --git a/circom/tests/debuginfo/assert_bucket.circom b/circom/tests/debuginfo/assert.circom similarity index 88% rename from circom/tests/debuginfo/assert_bucket.circom rename to circom/tests/debuginfo/assert.circom index 3f621807e..2be949acf 100644 --- a/circom/tests/debuginfo/assert_bucket.circom +++ b/circom/tests/debuginfo/assert.circom @@ -16,13 +16,13 @@ component main = A(5); // full lines or to remove the "--match-full-lines" option and surround each check with // {{^}} and {{$}} but it gets messy. -//CHECK-LABEL: define void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-LABEL: define{{.*}} void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { //CHECK-NEXT: [[L1:main]]: //CHECK-COUNT-06: {{.*}}, !dbg !7 //CHECK-NEXT: ret void, !dbg !7 //CHECK-NEXT: } -//CHECK-LABEL: define void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-LABEL: define{{.*}} void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: @@ -38,7 +38,7 @@ component main = A(5); //CHECK-LABEL: !llvm.dbg.cu = !{!1} //CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) -//CHECK: !2 = !DIFile(filename:{{.*}}assert_bucket.circom{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}assert.circom{{.*}}) //CHECK: !4 = distinct !DISubprogram(name: "A", linkageName: "A_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) //CHECK: !7 = !DILocation(line: 5, scope: !4) //CHECK: !8 = distinct !DISubprogram(name: "A", linkageName: "A_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) diff --git a/circom/tests/debuginfo/branch_bucket.circom b/circom/tests/debuginfo/branch.circom similarity index 91% rename from circom/tests/debuginfo/branch_bucket.circom rename to circom/tests/debuginfo/branch.circom index 6299091a6..89766adfd 100644 --- a/circom/tests/debuginfo/branch_bucket.circom +++ b/circom/tests/debuginfo/branch.circom @@ -25,13 +25,13 @@ component main = B(); // full lines or to remove the "--match-full-lines" option and surround each check with // {{^}} and {{$}} but it gets messy. -//CHECK-LABEL: define void @B_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-LABEL: define{{.*}} void @B_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { //CHECK-NEXT: [[L1:main]]: //CHECK-COUNT-06: {{.*}}, !dbg !7 //CHECK-NEXT: ret void, !dbg !7 //CHECK-NEXT: } -//CHECK-LABEL: define void @B_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-LABEL: define{{.*}} void @B_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: @@ -59,7 +59,7 @@ component main = B(); //CHECK-LABEL: !llvm.dbg.cu = !{!1} //CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) -//CHECK: !2 = !DIFile(filename:{{.*}}branch_bucket.circom{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}branch.circom{{.*}}) //CHECK: !4 = distinct !DISubprogram(name: "B", linkageName: "B_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) //CHECK: !7 = !DILocation(line: 5, scope: !4) //CHECK: !8 = distinct !DISubprogram(name: "B", linkageName: "B_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) diff --git a/circom/tests/debuginfo/call_bucket.circom b/circom/tests/debuginfo/call_and_return.circom similarity index 89% rename from circom/tests/debuginfo/call_bucket.circom rename to circom/tests/debuginfo/call_and_return.circom index 5831799a9..c7e9a7b19 100644 --- a/circom/tests/debuginfo/call_bucket.circom +++ b/circom/tests/debuginfo/call_and_return.circom @@ -25,7 +25,7 @@ component main = C(); // full lines or to remove the "--match-full-lines" option and surround each check with // {{^}} and {{$}} but it gets messy. -//CHECK-LABEL: define i256 @negative_0(i256* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-LABEL: define{{.*}} i256 @negative_0(i256* %{{[[:alnum:]_]+}}) !dbg !4 { //CHECK-NEXT: [[L1:[[:alnum:]_]+]]: //CHECK-COUNT-01: {{.*}}, !dbg !7 //CHECK-EMPTY: @@ -42,13 +42,13 @@ component main = C(); //CHECK-NEXT: unreachable, !dbg !10 //CHECK-NEXT: } -//CHECK-LABEL: define void @C_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !11 { +//CHECK-LABEL: define{{.*}} void @C_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !11 { //CHECK-NEXT: [[L1:main]]: //CHECK-COUNT-06: {{.*}}, !dbg !12 //CHECK-NEXT: ret void, !dbg !12 //CHECK-NEXT: } -//CHECK-LABEL: define void @C_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !13 { +//CHECK-LABEL: define{{.*}} void @C_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !13 { //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !14 //CHECK-EMPTY: @@ -61,7 +61,7 @@ component main = C(); //CHECK-LABEL: !llvm.dbg.cu = !{!1} //CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) -//CHECK: !2 = !DIFile(filename:{{.*}}call_bucket.circom{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}call_and_return.circom{{.*}}) //CHECK: !4 = distinct !DISubprogram(name: "negative", linkageName: "negative_0", scope: null, file: !2, line: 11, {{.*}}unit: !1{{.*}}) //CHECK: !7 = !DILocation(line: 11, scope: !4) //CHECK: !8 = !DILocation(line: 12, scope: !4) diff --git a/circom/tests/debuginfo/create_component_bucket.circom b/circom/tests/debuginfo/create_component.circom similarity index 86% rename from circom/tests/debuginfo/create_component_bucket.circom rename to circom/tests/debuginfo/create_component.circom index d0e1cda42..8c198cdf3 100644 --- a/circom/tests/debuginfo/create_component_bucket.circom +++ b/circom/tests/debuginfo/create_component.circom @@ -21,13 +21,13 @@ component main = A(5); // full lines or to remove the "--match-full-lines" option and surround each check with // {{^}} and {{$}} but it gets messy. -//CHECK-LABEL: define void @B_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-LABEL: define{{.*}} void @B_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { //CHECK-NEXT: [[L1:main]]: //CHECK-COUNT-06: {{.*}}, !dbg !7 //CHECK-NEXT: ret void, !dbg !7 //CHECK-NEXT: } -//CHECK-LABEL: define void @B_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-LABEL: define{{.*}} void @B_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: @@ -38,13 +38,13 @@ component main = A(5); //CHECK-NEXT: ret void, !dbg !9 //CHECK-NEXT: } -//CHECK-LABEL: define void @A_1_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !10 { +//CHECK-LABEL: define{{.*}} void @A_1_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !10 { //CHECK-NEXT: [[L1:main]]: //CHECK-COUNT-06: {{.*}}, !dbg !11 //CHECK-NEXT: ret void, !dbg !11 //CHECK-NEXT: } -//CHECK-LABEL: define void @A_1_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !12 { +//CHECK-LABEL: define{{.*}} void @A_1_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !12 { //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !13 //CHECK-EMPTY: @@ -63,7 +63,7 @@ component main = A(5); //CHECK-LABEL: !llvm.dbg.cu = !{!1} //CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) -//CHECK: !2 = !DIFile(filename:{{.*}}create_component_bucket.circom{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}create_component.circom{{.*}}) //CHECK: !4 = distinct !DISubprogram(name: "B", linkageName: "B_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) //CHECK: !7 = !DILocation(line: 5, scope: !4) //CHECK: !8 = distinct !DISubprogram(name: "B", linkageName: "B_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) From 180ca012c1b4dd59d412b2d463dc651b6d65642e Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Thu, 26 Oct 2023 16:31:05 -0500 Subject: [PATCH 6/8] fix issue caused by load and add load test --- circom/tests/debuginfo/load.circom | 70 +++++++++++++++++++ .../load_bucket.rs | 2 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 circom/tests/debuginfo/load.circom diff --git a/circom/tests/debuginfo/load.circom b/circom/tests/debuginfo/load.circom new file mode 100644 index 000000000..fb7887b1e --- /dev/null +++ b/circom/tests/debuginfo/load.circom @@ -0,0 +1,70 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template A(n) { + signal input in[3]; + signal output out; + var idx[3] = [ 2, 1, 0 ]; + + var x + = + in[ + idx[n] + ]; + out + <-- + x; +} + +component main = A(1); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define{{.*}} void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define{{.*}} void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L4:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L5:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L4]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L6:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L5]] +//CHECK-COUNT-05: {{.*}}, !dbg !11 +//CHECK-EMPTY: +//CHECK-NEXT: [[L7:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L6]] +//CHECK-COUNT-05: {{.*}}, !dbg !12 +//CHECK-EMPTY: +//CHECK-NEXT: [[L8:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L7]] +//CHECK-NEXT: ret void, !dbg !12 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}load.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "A", linkageName: "A_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "A", linkageName: "A_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = !DILocation(line: 8, scope: !8) +//CHECK: !11 = !DILocation(line: 10, scope: !8) +//CHECK: !12 = !DILocation(line: 15, scope: !8) diff --git a/compiler/src/intermediate_representation/load_bucket.rs b/compiler/src/intermediate_representation/load_bucket.rs index 564715379..a3a4d1cf0 100644 --- a/compiler/src/intermediate_representation/load_bucket.rs +++ b/compiler/src/intermediate_representation/load_bucket.rs @@ -79,7 +79,7 @@ impl UpdateId for LoadBucket { impl WriteLLVMIR for LoadBucket { fn produce_llvm_ir<'a, 'b>(&self, producer: &'b dyn LLVMIRProducer<'a>) -> Option> { - Self::manage_debug_loc_from_curr(producer, self); + // NOTE: do not change debug location for a load because it is not a top-level source statement // Generate the code of the location and use the last value as the reference let index = self.src.produce_llvm_ir(producer).expect("We need to produce some kind of instruction!").into_int_value(); From 61c391a342ae8a4aaa677044bc9b5f7fd1df7db1 Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Thu, 26 Oct 2023 16:39:15 -0500 Subject: [PATCH 7/8] add tests for remaining cases --- circom/tests/debuginfo/compute.circom | 126 +++++++++++++++++++ circom/tests/debuginfo/constraint.circom | 46 +++++++ circom/tests/debuginfo/log.circom | 42 +++++++ circom/tests/debuginfo/loop_and_block.circom | 61 +++++++++ 4 files changed, 275 insertions(+) create mode 100644 circom/tests/debuginfo/compute.circom create mode 100644 circom/tests/debuginfo/constraint.circom create mode 100644 circom/tests/debuginfo/log.circom create mode 100644 circom/tests/debuginfo/loop_and_block.circom diff --git a/circom/tests/debuginfo/compute.circom b/circom/tests/debuginfo/compute.circom new file mode 100644 index 000000000..be87ad2a8 --- /dev/null +++ b/circom/tests/debuginfo/compute.circom @@ -0,0 +1,126 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template A(n) { + signal input in1; + signal input in2; + signal input in3[2]; + var outs[10]; + + outs[0] = in1 + in2; + outs[1] = in1 >> in2; + outs[2] = in1 < in2; + outs[3] = in1 == in2; + outs[4] = in1 && in2; + outs[5] = in1 & in2; + outs[6] = -in2; + outs[7] = ~in2; + outs[8] = !in2; + outs[9] = in3[n]; +} + +component main = A(1); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define{{.*}} void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define{{.*}} void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L01:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L02:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L01]] +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L03:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L02]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L04:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L03]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L05:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L04]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L06:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L05]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L07:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L06]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L08:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L07]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L09:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L08]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L10:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L09]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L11:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L10]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L12:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L11]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L13:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L12]] +//CHECK-COUNT-08: {{.*}}, !dbg !11 +//CHECK-EMPTY: +//CHECK-NEXT: [[L14:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L13]] +//CHECK-COUNT-08: {{.*}}, !dbg !12 +//CHECK-EMPTY: +//CHECK-NEXT: [[L15:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L14]] +//CHECK-COUNT-09: {{.*}}, !dbg !13 +//CHECK-EMPTY: +//CHECK-NEXT: [[L16:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L15]] +//CHECK-COUNT-09: {{.*}}, !dbg !14 +//CHECK-EMPTY: +//CHECK-NEXT: [[L17:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L16]] +//CHECK-COUNT-11: {{.*}}, !dbg !15 +//CHECK-EMPTY: +//CHECK-NEXT: [[L18:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L17]] +//CHECK-COUNT-08: {{.*}}, !dbg !16 +//CHECK-EMPTY: +//CHECK-NEXT: [[L19:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L18]] +//CHECK-COUNT-06: {{.*}}, !dbg !17 +//CHECK-EMPTY: +//CHECK-NEXT: [[L20:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L19]] +//CHECK-COUNT-06: {{.*}}, !dbg !18 +//CHECK-EMPTY: +//CHECK-NEXT: [[L21:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L20]] +//CHECK-COUNT-08: {{.*}}, !dbg !19 +//CHECK-EMPTY: +//CHECK-NEXT: [[L22:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L21]] +//CHECK-COUNT-05: {{.*}}, !dbg !20 +//CHECK-EMPTY: +//CHECK-NEXT: [[L23:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L22]] +//CHECK-NEXT: ret void, !dbg !20 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}compute.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "A", linkageName: "A_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "A", linkageName: "A_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = !DILocation(line: 9, scope: !8) +//CHECK: !11 = !DILocation(line: 11, scope: !8) +//CHECK: !12 = !DILocation(line: 12, scope: !8) +//CHECK: !13 = !DILocation(line: 13, scope: !8) +//CHECK: !14 = !DILocation(line: 14, scope: !8) +//CHECK: !15 = !DILocation(line: 15, scope: !8) +//CHECK: !16 = !DILocation(line: 16, scope: !8) +//CHECK: !17 = !DILocation(line: 17, scope: !8) +//CHECK: !18 = !DILocation(line: 18, scope: !8) +//CHECK: !19 = !DILocation(line: 19, scope: !8) +//CHECK: !20 = !DILocation(line: 20, scope: !8) diff --git a/circom/tests/debuginfo/constraint.circom b/circom/tests/debuginfo/constraint.circom new file mode 100644 index 000000000..5c36e2aa7 --- /dev/null +++ b/circom/tests/debuginfo/constraint.circom @@ -0,0 +1,46 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template A() { + signal input in; + signal output out; + out <== in; +} + +component main = A(); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define{{.*}} void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define{{.*}} void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-05: {{.*}}, !dbg !10 +//CHECK-NEXT: {{.*}}, !dbg !10, !constraint !11 +//CHECK-COUNT-02: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: ret void, !dbg !10 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}constraint.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "A", linkageName: "A_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "A", linkageName: "A_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = !DILocation(line: 8, scope: !8) diff --git a/circom/tests/debuginfo/log.circom b/circom/tests/debuginfo/log.circom new file mode 100644 index 000000000..c8a60874c --- /dev/null +++ b/circom/tests/debuginfo/log.circom @@ -0,0 +1,42 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template A() { + log(1658); +} + +component main = A(); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define{{.*}} void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-05: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define{{.*}} void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L1:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L2:log[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-COUNT-01: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: ret void, !dbg !10 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}log.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "A", linkageName: "A_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "A", linkageName: "A_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = !DILocation(line: 6, scope: !8) diff --git a/circom/tests/debuginfo/loop_and_block.circom b/circom/tests/debuginfo/loop_and_block.circom new file mode 100644 index 000000000..8f4afcfec --- /dev/null +++ b/circom/tests/debuginfo/loop_and_block.circom @@ -0,0 +1,61 @@ +pragma circom 2.0.0; +// REQUIRES: circom +// RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck --match-full-lines --enable-var-scope %s + +template A(n) { + signal input inp[n]; + signal output out[n]; + + for ( var i = 0; i < n; i++ ) { + out[i] <-- inp[i]; + } +} + +component main = A(3); + +//Variables are not used for the debug info numbering because a CHECK-LABEL directive +// cannot contain any variable uses or definitions and the "--match-full-lines" option +// is used so those lines cannot be split into two directives with a CHECK-SAME to +// define a variable. The only alternatives are to lose the extra check given by matching +// full lines or to remove the "--match-full-lines" option and surround each check with +// {{^}} and {{$}} but it gets messy. + +//CHECK-LABEL: define{{.*}} void @A_0_build({ [0 x i256]*, i32 }* %{{[[:alnum:]_]+}}) !dbg !4 { +//CHECK-NEXT: [[L1:main]]: +//CHECK-COUNT-06: {{.*}}, !dbg !7 +//CHECK-NEXT: ret void, !dbg !7 +//CHECK-NEXT: } + +//CHECK-LABEL: define{{.*}} void @A_0_run([0 x i256]* %{{[[:alnum:]_]+}}) !dbg !8 { +//CHECK-NEXT: [[L01:prelude]]: +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L02:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L01]] +//CHECK-COUNT-03: {{.*}}, !dbg !9 +//CHECK-EMPTY: +//CHECK-NEXT: [[L03:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L02]] +//CHECK-COUNT-03: {{.*}}, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L04:unrolled_loop[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L03]] +//CHECK-COUNT-04: {{.*}}, !dbg !11 +//CHECK-COUNT-02: {{.*}}, !dbg !10 +//CHECK-COUNT-04: {{.*}}, !dbg !11 +//CHECK-COUNT-02: {{.*}}, !dbg !10 +//CHECK-COUNT-04: {{.*}}, !dbg !11 +//CHECK-COUNT-02: {{.*}}, !dbg !10 +//CHECK-NEXT: br label %prologue, !dbg !10 +//CHECK-EMPTY: +//CHECK-NEXT: [[L05:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L04]] +//CHECK-NEXT: ret void, !dbg !10 +//CHECK-NEXT: } + +//CHECK-LABEL: !llvm.dbg.cu = !{!1} +//CHECK: !1 = distinct !DICompileUnit({{.*}}file: !2{{.*}}) +//CHECK: !2 = !DIFile(filename:{{.*}}loop_and_block.circom{{.*}}) +//CHECK: !4 = distinct !DISubprogram(name: "A", linkageName: "A_0_build", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !7 = !DILocation(line: 5, scope: !4) +//CHECK: !8 = distinct !DISubprogram(name: "A", linkageName: "A_0_run", scope: null, file: !2, line: 5, {{.*}}unit: !1{{.*}}) +//CHECK: !9 = !DILocation(line: 5, scope: !8) +//CHECK: !10 = !DILocation(line: 9, scope: !8) +//CHECK: !11 = !DILocation(line: 10, scope: !8) + From b17bfe5d9f9f51eef22952bc800db0787aa4ceef Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Thu, 26 Oct 2023 16:43:01 -0500 Subject: [PATCH 8/8] simplify pattern matches --- circom/tests/debuginfo/assert.circom | 6 +-- circom/tests/debuginfo/branch.circom | 14 +++--- circom/tests/debuginfo/call_and_return.circom | 10 ++--- circom/tests/debuginfo/compute.circom | 44 +++++++++---------- circom/tests/debuginfo/constraint.circom | 4 +- .../tests/debuginfo/create_component.circom | 12 ++--- circom/tests/debuginfo/load.circom | 14 +++--- circom/tests/debuginfo/log.circom | 4 +- circom/tests/debuginfo/loop_and_block.circom | 8 ++-- 9 files changed, 58 insertions(+), 58 deletions(-) diff --git a/circom/tests/debuginfo/assert.circom b/circom/tests/debuginfo/assert.circom index 2be949acf..f2a79736c 100644 --- a/circom/tests/debuginfo/assert.circom +++ b/circom/tests/debuginfo/assert.circom @@ -26,13 +26,13 @@ component main = A(5); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:assert[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:assert[0-9]*]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-COUNT-05: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L4:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-NEXT: [[L4:prologue]]:{{[[:space:]]}}; preds = %[[L3]] //CHECK-NEXT: ret void, !dbg !10 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/branch.circom b/circom/tests/debuginfo/branch.circom index 89766adfd..5df9f2bf3 100644 --- a/circom/tests/debuginfo/branch.circom +++ b/circom/tests/debuginfo/branch.circom @@ -35,25 +35,25 @@ component main = B(); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:branch[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:branch[0-9]*]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-COUNT-04: {{.*}}, !dbg !11 //CHECK-EMPTY: -//CHECK-NEXT: [[L4:if.then[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-NEXT: [[L4:if.then[0-9]*]]:{{[[:space:]]}}; preds = %[[L3]] //CHECK-COUNT-05: {{.*}}, !dbg !12 //CHECK-EMPTY: -//CHECK-NEXT: [[L5:if.else[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-NEXT: [[L5:if.else[0-9]*]]:{{[[:space:]]}}; preds = %[[L3]] //CHECK-COUNT-05: {{.*}}, !dbg !13 //CHECK-EMPTY: -//CHECK-NEXT: [[L6:if.merge[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L5]], %{{.*}}[[L4]] +//CHECK-NEXT: [[L6:if.merge[0-9]*]]:{{[[:space:]]}}; preds = %[[L5]], %[[L4]] //CHECK-COUNT-01: {{.*}}, !dbg !13 //CHECK-EMPTY: -//CHECK-NEXT: [[L7:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L6]] +//CHECK-NEXT: [[L7:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L6]] //CHECK-COUNT-05: {{.*}}, !dbg !14 //CHECK-EMPTY: -//CHECK-NEXT: [[L8:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L7]] +//CHECK-NEXT: [[L8:prologue]]:{{[[:space:]]}}; preds = %[[L7]] //CHECK-NEXT: ret void, !dbg !14 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/call_and_return.circom b/circom/tests/debuginfo/call_and_return.circom index c7e9a7b19..f9d98f1d8 100644 --- a/circom/tests/debuginfo/call_and_return.circom +++ b/circom/tests/debuginfo/call_and_return.circom @@ -29,13 +29,13 @@ component main = C(); //CHECK-NEXT: [[L1:[[:alnum:]_]+]]: //CHECK-COUNT-01: {{.*}}, !dbg !7 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:branch[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:branch[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-04: {{.*}}, !dbg !8 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:if.then[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:if.then[0-9]*]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-NEXT: ret i256 1, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L4:if.else[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L4:if.else[0-9]*]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-NEXT: ret i256 0, !dbg !10 //CHECK-EMPTY: //CHECK-NEXT: [[L5:if.merge[0-9]*]]:{{[[:space:]]}}; No predecessors! @@ -52,10 +52,10 @@ component main = C(); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !14 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:call[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:call[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-10: {{.*}}, !dbg !15 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-NEXT: ret void, !dbg !15 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/compute.circom b/circom/tests/debuginfo/compute.circom index be87ad2a8..b79c5512c 100644 --- a/circom/tests/debuginfo/compute.circom +++ b/circom/tests/debuginfo/compute.circom @@ -39,70 +39,70 @@ component main = A(1); //CHECK-NEXT: [[L01:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L02:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L01]] +//CHECK-NEXT: [[L02:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L01]] //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L03:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L02]] +//CHECK-NEXT: [[L03:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L02]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L04:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L03]] +//CHECK-NEXT: [[L04:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L03]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L05:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L04]] +//CHECK-NEXT: [[L05:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L04]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L06:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L05]] +//CHECK-NEXT: [[L06:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L05]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L07:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L06]] +//CHECK-NEXT: [[L07:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L06]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L08:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L07]] +//CHECK-NEXT: [[L08:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L07]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L09:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L08]] +//CHECK-NEXT: [[L09:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L08]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L10:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L09]] +//CHECK-NEXT: [[L10:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L09]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L11:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L10]] +//CHECK-NEXT: [[L11:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L10]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L12:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L11]] +//CHECK-NEXT: [[L12:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L11]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L13:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L12]] +//CHECK-NEXT: [[L13:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L12]] //CHECK-COUNT-08: {{.*}}, !dbg !11 //CHECK-EMPTY: -//CHECK-NEXT: [[L14:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L13]] +//CHECK-NEXT: [[L14:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L13]] //CHECK-COUNT-08: {{.*}}, !dbg !12 //CHECK-EMPTY: -//CHECK-NEXT: [[L15:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L14]] +//CHECK-NEXT: [[L15:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L14]] //CHECK-COUNT-09: {{.*}}, !dbg !13 //CHECK-EMPTY: -//CHECK-NEXT: [[L16:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L15]] +//CHECK-NEXT: [[L16:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L15]] //CHECK-COUNT-09: {{.*}}, !dbg !14 //CHECK-EMPTY: -//CHECK-NEXT: [[L17:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L16]] +//CHECK-NEXT: [[L17:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L16]] //CHECK-COUNT-11: {{.*}}, !dbg !15 //CHECK-EMPTY: -//CHECK-NEXT: [[L18:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L17]] +//CHECK-NEXT: [[L18:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L17]] //CHECK-COUNT-08: {{.*}}, !dbg !16 //CHECK-EMPTY: -//CHECK-NEXT: [[L19:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L18]] +//CHECK-NEXT: [[L19:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L18]] //CHECK-COUNT-06: {{.*}}, !dbg !17 //CHECK-EMPTY: -//CHECK-NEXT: [[L20:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L19]] +//CHECK-NEXT: [[L20:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L19]] //CHECK-COUNT-06: {{.*}}, !dbg !18 //CHECK-EMPTY: -//CHECK-NEXT: [[L21:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L20]] +//CHECK-NEXT: [[L21:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L20]] //CHECK-COUNT-08: {{.*}}, !dbg !19 //CHECK-EMPTY: -//CHECK-NEXT: [[L22:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L21]] +//CHECK-NEXT: [[L22:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L21]] //CHECK-COUNT-05: {{.*}}, !dbg !20 //CHECK-EMPTY: -//CHECK-NEXT: [[L23:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L22]] +//CHECK-NEXT: [[L23:prologue]]:{{[[:space:]]}}; preds = %[[L22]] //CHECK-NEXT: ret void, !dbg !20 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/constraint.circom b/circom/tests/debuginfo/constraint.circom index 5c36e2aa7..d0088c823 100644 --- a/circom/tests/debuginfo/constraint.circom +++ b/circom/tests/debuginfo/constraint.circom @@ -27,12 +27,12 @@ component main = A(); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-05: {{.*}}, !dbg !10 //CHECK-NEXT: {{.*}}, !dbg !10, !constraint !11 //CHECK-COUNT-02: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-NEXT: ret void, !dbg !10 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/create_component.circom b/circom/tests/debuginfo/create_component.circom index 8c198cdf3..a8e036903 100644 --- a/circom/tests/debuginfo/create_component.circom +++ b/circom/tests/debuginfo/create_component.circom @@ -31,10 +31,10 @@ component main = A(5); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-NEXT: ret void, !dbg !9 //CHECK-NEXT: } @@ -48,16 +48,16 @@ component main = A(5); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !13 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-03: {{.*}}, !dbg !13 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:create_cmp[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:create_cmp[0-9]*]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-COUNT-03: {{.*}}, !dbg !13 //CHECK-EMPTY: -//CHECK-NEXT: [[L4:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-NEXT: [[L4:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L3]] //CHECK-COUNT-14: {{.*}}, !dbg !14 //CHECK-EMPTY: -//CHECK-NEXT: [[L5:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L4]] +//CHECK-NEXT: [[L5:prologue]]:{{[[:space:]]}}; preds = %[[L4]] //CHECK-NEXT: ret void, !dbg !14 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/load.circom b/circom/tests/debuginfo/load.circom index fb7887b1e..9bfad5f34 100644 --- a/circom/tests/debuginfo/load.circom +++ b/circom/tests/debuginfo/load.circom @@ -36,25 +36,25 @@ component main = A(1); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L4:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L3]] +//CHECK-NEXT: [[L4:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L3]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L5:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L4]] +//CHECK-NEXT: [[L5:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L4]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L6:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L5]] +//CHECK-NEXT: [[L6:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L5]] //CHECK-COUNT-05: {{.*}}, !dbg !11 //CHECK-EMPTY: -//CHECK-NEXT: [[L7:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L6]] +//CHECK-NEXT: [[L7:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L6]] //CHECK-COUNT-05: {{.*}}, !dbg !12 //CHECK-EMPTY: -//CHECK-NEXT: [[L8:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L7]] +//CHECK-NEXT: [[L8:prologue]]:{{[[:space:]]}}; preds = %[[L7]] //CHECK-NEXT: ret void, !dbg !12 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/log.circom b/circom/tests/debuginfo/log.circom index c8a60874c..cc94e9901 100644 --- a/circom/tests/debuginfo/log.circom +++ b/circom/tests/debuginfo/log.circom @@ -25,10 +25,10 @@ component main = A(); //CHECK-NEXT: [[L1:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L2:log[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L1]] +//CHECK-NEXT: [[L2:log[0-9]*]]:{{[[:space:]]}}; preds = %[[L1]] //CHECK-COUNT-01: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L2]] +//CHECK-NEXT: [[L3:prologue]]:{{[[:space:]]}}; preds = %[[L2]] //CHECK-NEXT: ret void, !dbg !10 //CHECK-NEXT: } diff --git a/circom/tests/debuginfo/loop_and_block.circom b/circom/tests/debuginfo/loop_and_block.circom index 8f4afcfec..05b47e68b 100644 --- a/circom/tests/debuginfo/loop_and_block.circom +++ b/circom/tests/debuginfo/loop_and_block.circom @@ -30,13 +30,13 @@ component main = A(3); //CHECK-NEXT: [[L01:prelude]]: //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L02:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L01]] +//CHECK-NEXT: [[L02:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L01]] //CHECK-COUNT-03: {{.*}}, !dbg !9 //CHECK-EMPTY: -//CHECK-NEXT: [[L03:store[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L02]] +//CHECK-NEXT: [[L03:store[0-9]*]]:{{[[:space:]]}}; preds = %[[L02]] //CHECK-COUNT-03: {{.*}}, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L04:unrolled_loop[0-9]*]]:{{[[:space:]]}}; preds = %{{.*}}[[L03]] +//CHECK-NEXT: [[L04:unrolled_loop[0-9]*]]:{{[[:space:]]}}; preds = %[[L03]] //CHECK-COUNT-04: {{.*}}, !dbg !11 //CHECK-COUNT-02: {{.*}}, !dbg !10 //CHECK-COUNT-04: {{.*}}, !dbg !11 @@ -45,7 +45,7 @@ component main = A(3); //CHECK-COUNT-02: {{.*}}, !dbg !10 //CHECK-NEXT: br label %prologue, !dbg !10 //CHECK-EMPTY: -//CHECK-NEXT: [[L05:prologue]]:{{[[:space:]]}}; preds = %{{.*}}[[L04]] +//CHECK-NEXT: [[L05:prologue]]:{{[[:space:]]}}; preds = %[[L04]] //CHECK-NEXT: ret void, !dbg !10 //CHECK-NEXT: }