From dbbb11d7b92e8e57f81f2684487b50bf56c517c5 Mon Sep 17 00:00:00 2001 From: Tim Hoffman Date: Thu, 11 Jul 2024 23:48:42 -0500 Subject: [PATCH] replace remaining "arena" locals with regex variable --- circom/tests/loops/call_inside_loop.circom | 39 ++++++++++++---------- circom/tests/subcmps/subcmps2.circom | 12 +++---- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/circom/tests/loops/call_inside_loop.circom b/circom/tests/loops/call_inside_loop.circom index 87bacb183..b9269b640 100644 --- a/circom/tests/loops/call_inside_loop.circom +++ b/circom/tests/loops/call_inside_loop.circom @@ -50,8 +50,8 @@ component main = CallInLoop(2, 3); //CHECK-NEXT: br label %call1 //CHECK-EMPTY: //CHECK-NEXT: call1: -//CHECK-NEXT: %fun_0_arena = alloca [15 x i256], align 8 -//CHECK-NEXT: %[[T000:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 0 +//CHECK-NEXT: %[[CALL_ARENA:[0-9a-zA-Z_\.]+]] = alloca [15 x i256], align 8 +//CHECK-NEXT: %[[T000:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 0 //CHECK-NEXT: %[[T001:[0-9a-zA-Z_\.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 2 //CHECK-NEXT: %[[COPY_SRC_0:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %[[T001]], i32 0 //CHECK-NEXT: %[[COPY_DST_0:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %[[T000]], i32 0 @@ -61,32 +61,32 @@ component main = CallInLoop(2, 3); //CHECK-NEXT: %[[COPY_DST_1:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %[[T000]], i32 1 //CHECK-NEXT: %[[COPY_VAL_1:[0-9a-zA-Z_\.]+]] = load i256, i256* %[[COPY_SRC_1]], align 4 //CHECK-NEXT: store i256 %[[COPY_VAL_1]], i256* %[[COPY_DST_1]], align 4 -//CHECK-NEXT: %[[T002:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 2 +//CHECK-NEXT: %[[T002:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 2 //CHECK-NEXT: store i256 2, i256* %[[T002]], align 4 -//CHECK-NEXT: %[[T003:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 3 +//CHECK-NEXT: %[[T003:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 3 //CHECK-NEXT: store i256 3, i256* %[[T003]], align 4 -//CHECK-NEXT: %[[T004:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 4 +//CHECK-NEXT: %[[T004:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 4 //CHECK-NEXT: store i256 3, i256* %[[T004]], align 4 -//CHECK-NEXT: %[[T005:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 5 +//CHECK-NEXT: %[[T005:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 5 //CHECK-NEXT: store i256 3, i256* %[[T005]], align 4 -//CHECK-NEXT: %[[T006:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 6 +//CHECK-NEXT: %[[T006:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 6 //CHECK-NEXT: store i256 3, i256* %[[T006]], align 4 -//CHECK-NEXT: %[[T007:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 7 +//CHECK-NEXT: %[[T007:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 7 //CHECK-NEXT: store i256 3, i256* %[[T007]], align 4 -//CHECK-NEXT: %[[T008:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %fun_0_arena, i32 0, i32 8 +//CHECK-NEXT: %[[T008:[0-9a-zA-Z_\.]+]] = getelementptr [15 x i256], [15 x i256]* %[[CALL_ARENA]], i32 0, i32 8 //CHECK-NEXT: store i256 3, i256* %[[T008]], align 4 -//CHECK-NEXT: %[[T009:[0-9a-zA-Z_\.]+]] = bitcast [15 x i256]* %fun_0_arena to i256* -//CHECK-NEXT: %call.fun_0 = call i256 @fun_0(i256* %[[T009]]) +//CHECK-NEXT: %[[T009:[0-9a-zA-Z_\.]+]] = bitcast [15 x i256]* %[[CALL_ARENA]] to i256* +//CHECK-NEXT: %[[T999:[0-9a-zA-Z_\.]+]] = call i256 @fun_0(i256* %[[T009]]) //CHECK-NEXT: %[[T010:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %var_0, i32 0 -//CHECK-NEXT: store i256 %call.fun_0, i256* %[[T010]], align 4 +//CHECK-NEXT: store i256 %[[T999]], i256* %[[T010]], align 4 //CHECK-NEXT: br label %store2 //CHECK-EMPTY: //CHECK-NEXT: store2: //CHECK-NEXT: %[[T013:[0-9a-zA-Z_\.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 6 //CHECK-NEXT: %[[T011:[0-9a-zA-Z_\.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 6 //CHECK-NEXT: %[[T012:[0-9a-zA-Z_\.]+]] = load i256, i256* %[[T011]], align 4 -//CHECK-NEXT: %call.fr_add = call i256 @fr_add(i256 %[[T012]], i256 1) -//CHECK-NEXT: store i256 %call.fr_add, i256* %[[T013]], align 4 +//CHECK-NEXT: %[[T998:[0-9a-zA-Z_\.]+]] = call i256 @fr_add(i256 %[[T012]], i256 1) +//CHECK-NEXT: store i256 %[[T998]], i256* %[[T013]], align 4 //CHECK-NEXT: br label %return3 //CHECK-EMPTY: //CHECK-NEXT: return3: @@ -102,22 +102,25 @@ component main = CallInLoop(2, 3); //CHECK-NEXT: %[[T002:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %var_0, i32 0 //CHECK-NEXT: %[[T000:[0-9a-zA-Z_\.]+]] = getelementptr [0 x i256], [0 x i256]* %signals, i32 0, i32 1 //CHECK-NEXT: %[[T001:[0-9a-zA-Z_\.]+]] = load i256, i256* %[[T000]], align 4 -//CHECK-NEXT: %call.fr_add = call i256 @fr_add(i256 3, i256 %[[T001]]) -//CHECK-NEXT: store i256 %call.fr_add, i256* %[[T002]], align 4 +//CHECK-NEXT: %[[T997:[0-9a-zA-Z_\.]+]] = call i256 @fr_add(i256 3, i256 %[[T001]]) +//CHECK-NEXT: store i256 %[[T997]], i256* %[[T002]], align 4 //CHECK-NEXT: br label %store2 //CHECK-EMPTY: //CHECK-NEXT: store2: //CHECK-NEXT: %[[T005:[0-9a-zA-Z_\.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 4 //CHECK-NEXT: %[[T003:[0-9a-zA-Z_\.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 4 //CHECK-NEXT: %[[T004:[0-9a-zA-Z_\.]+]] = load i256, i256* %[[T003]], align 4 -//CHECK-NEXT: %call.fr_add1 = call i256 @fr_add(i256 %[[T004]], i256 1) -//CHECK-NEXT: store i256 %call.fr_add1, i256* %[[T005]], align 4 +//CHECK-NEXT: %[[T996:[0-9a-zA-Z_\.]+]] = call i256 @fr_add(i256 %[[T004]], i256 1) +//CHECK-NEXT: store i256 %[[T996]], i256* %[[T005]], align 4 //CHECK-NEXT: br label %return3 //CHECK-EMPTY: //CHECK-NEXT: return3: //CHECK-NEXT: ret void //CHECK-NEXT: } // +//CHECK-LABEL: define{{.*}} i256 @fun_ +//CHECK-SAME: [[$F_ID_0:[0-9a-zA-Z_\.]+]](i256* %0){{.*}} { +// //CHECK-LABEL: define{{.*}} void @CallInLoop_{{[0-9]+}}_run //CHECK-SAME: ([0 x i256]* %[[ARG:[0-9a-zA-Z_\.]+]]){{.*}} { //CHECK-NEXT: prelude: diff --git a/circom/tests/subcmps/subcmps2.circom b/circom/tests/subcmps/subcmps2.circom index 26f50e7da..a7a16458f 100644 --- a/circom/tests/subcmps/subcmps2.circom +++ b/circom/tests/subcmps/subcmps2.circom @@ -67,12 +67,12 @@ component main = Caller(); //CHECK-NEXT: br label %call1 //CHECK-EMPTY: //CHECK-NEXT: call1: -//CHECK-NEXT: %nop_0_arena = alloca [1 x i256], align 8 -//CHECK-NEXT: %[[T000:[0-9a-zA-Z_\.]+]] = getelementptr [1 x i256], [1 x i256]* %nop_0_arena, i32 0, i32 0 +//CHECK-NEXT: %[[CALL_ARENA:[0-9a-zA-Z_\.]+]] = alloca [1 x i256], align 8 +//CHECK-NEXT: %[[T000:[0-9a-zA-Z_\.]+]] = getelementptr [1 x i256], [1 x i256]* %[[CALL_ARENA]], i32 0, i32 0 //CHECK-NEXT: %[[T001:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %sig_[[X2]], i32 0 //CHECK-NEXT: %[[T002:[0-9a-zA-Z_\.]+]] = load i256, i256* %[[T001]], align 4 //CHECK-NEXT: store i256 %[[T002]], i256* %[[T000]], align 4 -//CHECK-NEXT: %[[T003:[0-9a-zA-Z_\.]+]] = bitcast [1 x i256]* %nop_0_arena to i256* +//CHECK-NEXT: %[[T003:[0-9a-zA-Z_\.]+]] = bitcast [1 x i256]* %[[CALL_ARENA]] to i256* //CHECK-NEXT: %call.nop_0 = call i256 @nop_0(i256* %[[T003]]) //CHECK-NEXT: %[[T004:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %subsig_[[X1]], i32 0 //CHECK-NEXT: store i256 %call.nop_0, i256* %[[T004]], align 4 @@ -109,12 +109,12 @@ component main = Caller(); //CHECK-NEXT: br label %call1 //CHECK-EMPTY: //CHECK-NEXT: call1: -//CHECK-NEXT: %nop_0_arena = alloca [1 x i256], align 8 -//CHECK-NEXT: %[[T000:[0-9a-zA-Z_\.]+]] = getelementptr [1 x i256], [1 x i256]* %nop_0_arena, i32 0, i32 0 +//CHECK-NEXT: %[[CALL_ARENA:[0-9a-zA-Z_\.]+]] = alloca [1 x i256], align 8 +//CHECK-NEXT: %[[T000:[0-9a-zA-Z_\.]+]] = getelementptr [1 x i256], [1 x i256]* %[[CALL_ARENA]], i32 0, i32 0 //CHECK-NEXT: %[[T001:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %sig_[[X2]], i32 0 //CHECK-NEXT: %[[T002:[0-9a-zA-Z_\.]+]] = load i256, i256* %[[T001]], align 4 //CHECK-NEXT: store i256 %[[T002]], i256* %[[T000]], align 4 -//CHECK-NEXT: %[[T003:[0-9a-zA-Z_\.]+]] = bitcast [1 x i256]* %nop_0_arena to i256* +//CHECK-NEXT: %[[T003:[0-9a-zA-Z_\.]+]] = bitcast [1 x i256]* %[[CALL_ARENA]] to i256* //CHECK-NEXT: %call.nop_0 = call i256 @nop_0(i256* %[[T003]]) //CHECK-NEXT: %[[T004:[0-9a-zA-Z_\.]+]] = getelementptr i256, i256* %subsig_[[X1]], i32 0 //CHECK-NEXT: store i256 %call.nop_0, i256* %[[T004]], align 4