Skip to content

Commit

Permalink
replace remaining "arena" locals with regex variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-hoffman committed Jul 12, 2024
1 parent b1adc0b commit dbbb11d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
39 changes: 21 additions & 18 deletions circom/tests/loops/call_inside_loop.circom
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions circom/tests/subcmps/subcmps2.circom
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dbbb11d

Please sign in to comment.