From 09ce59069fa21b62bfb44ae0fbcf8ef3747433ab Mon Sep 17 00:00:00 2001 From: Timothy Hoffman <4001421+tim-hoffman@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:59:47 -0500 Subject: [PATCH] [VAN-1372] enable simplification pass on function bodies (#122) --- circom/tests/calls/call_arg_arraymulti.circom | 152 +++++----- .../call_arg_arraymulti_arraymulti.circom | 271 +++++++++--------- circuit_passes/src/passes/simplification.rs | 2 +- 3 files changed, 207 insertions(+), 218 deletions(-) diff --git a/circom/tests/calls/call_arg_arraymulti.circom b/circom/tests/calls/call_arg_arraymulti.circom index 5658e05b3..40bed300a 100644 --- a/circom/tests/calls/call_arg_arraymulti.circom +++ b/circom/tests/calls/call_arg_arraymulti.circom @@ -2,6 +2,7 @@ pragma circom 2.1.0; // REQUIRES: circom // RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck %s --enable-var-scope +// %0 (i.e. arena) = [ a[0][0], a[0][1], a[1][0], a[1][1], a[2][0], a[2][1], agg, i, j ] function sum(a) { var agg = 0; for (var i = 0; i < 3; i++) { @@ -21,7 +22,8 @@ template CallArgTest() { component main = CallArgTest(); -//CHECK-LABEL: define{{.*}} void @..generated..loop.body.{{[0-9]+}}([0 x i256]* %lvars, [0 x i256]* %signals, i256* %var_0){{.*}} { +//CHECK-LABEL: define{{.*}} void @..generated..loop.body.{{[0-9]+}} +//CHECK-SAME: ([0 x i256]* %lvars, [0 x i256]* %signals, i256* %[[V0:var_[0-9]+]]){{.*}} { //CHECK-NEXT: ..generated..loop.body.[[$F_ID_1:[0-9]+]]: //CHECK-NEXT: br label %store1 //CHECK-EMPTY: @@ -29,7 +31,7 @@ component main = CallArgTest(); //CHECK-NEXT: %[[T01:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 6 //CHECK-NEXT: %[[T02:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 6 //CHECK-NEXT: %[[T03:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T02]], align 4 -//CHECK-NEXT: %[[T04:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %var_0, i32 0 +//CHECK-NEXT: %[[T04:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[V0]], i32 0 //CHECK-NEXT: %[[T05:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T04]], align 4 //CHECK-NEXT: %[[T06:[0-9a-zA-Z_.]+]] = call i256 @fr_add(i256 %[[T03]], i256 %[[T05]]) //CHECK-NEXT: store i256 %[[T06]], i256* %[[T01]], align 4 @@ -47,8 +49,9 @@ component main = CallArgTest(); //CHECK-NEXT: ret void //CHECK-NEXT: } -//CHECK-LABEL: define{{.*}} i256 @sum_0(i256* %0){{.*}} { -//CHECK-NEXT: sum_0: +//CHECK-LABEL: define{{.*}} i256 @sum_{{[0-9]+}} +//CHECK-SAME: (i256* %[[T00:[0-9a-zA-Z_.]+]]){{.*}} { +//CHECK-NEXT: [[$FUN_NAME:sum_[0-9]+]]: //CHECK-NEXT: br label %store1 //CHECK-EMPTY: //CHECK-NEXT: store1: @@ -62,51 +65,42 @@ component main = CallArgTest(); //CHECK-NEXT: br label %unrolled_loop3 //CHECK-EMPTY: //CHECK-NEXT: unrolled_loop3: -//CHECK-NEXT: %3 = getelementptr i256, i256* %0, i32 8 -//CHECK-NEXT: store i256 0, i256* %3, align 4 -//CHECK-NEXT: %4 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %5 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %6 = getelementptr [0 x i256], [0 x i256]* %5, i32 0, i256 0 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %4, [0 x i256]* null, i256* %6) -//CHECK-NEXT: %7 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %8 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %9 = getelementptr [0 x i256], [0 x i256]* %8, i32 0, i256 1 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %7, [0 x i256]* null, i256* %9) -//CHECK-NEXT: %10 = getelementptr i256, i256* %0, i32 7 -//CHECK-NEXT: %11 = getelementptr i256, i256* %0, i32 7 -//CHECK-NEXT: %12 = load i256, i256* %11, align 4 -//CHECK-NEXT: %call.fr_add = call i256 @fr_add(i256 %12, i256 1) -//CHECK-NEXT: store i256 %call.fr_add, i256* %10, align 4 -//CHECK-NEXT: %13 = getelementptr i256, i256* %0, i32 8 -//CHECK-NEXT: store i256 0, i256* %13, align 4 -//CHECK-NEXT: %14 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %15 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %16 = getelementptr [0 x i256], [0 x i256]* %15, i32 0, i256 2 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %14, [0 x i256]* null, i256* %16) -//CHECK-NEXT: %17 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %18 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %19 = getelementptr [0 x i256], [0 x i256]* %18, i32 0, i256 3 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %17, [0 x i256]* null, i256* %19) -//CHECK-NEXT: %20 = getelementptr i256, i256* %0, i32 7 -//CHECK-NEXT: %21 = getelementptr i256, i256* %0, i32 7 -//CHECK-NEXT: %22 = load i256, i256* %21, align 4 -//CHECK-NEXT: %call.fr_add10 = call i256 @fr_add(i256 %22, i256 1) -//CHECK-NEXT: store i256 %call.fr_add10, i256* %20, align 4 -//CHECK-NEXT: %23 = getelementptr i256, i256* %0, i32 8 -//CHECK-NEXT: store i256 0, i256* %23, align 4 -//CHECK-NEXT: %24 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %25 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %26 = getelementptr [0 x i256], [0 x i256]* %25, i32 0, i256 4 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %24, [0 x i256]* null, i256* %26) -//CHECK-NEXT: %27 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %28 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %29 = getelementptr [0 x i256], [0 x i256]* %28, i32 0, i256 5 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %27, [0 x i256]* null, i256* %29) -//CHECK-NEXT: %30 = getelementptr i256, i256* %0, i32 7 -//CHECK-NEXT: %31 = getelementptr i256, i256* %0, i32 7 -//CHECK-NEXT: %32 = load i256, i256* %31, align 4 -//CHECK-NEXT: %call.fr_add17 = call i256 @fr_add(i256 %32, i256 1) -//CHECK-NEXT: store i256 %call.fr_add17, i256* %30, align 4 +//CHECK-NEXT: %[[T03:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 8 +//CHECK-NEXT: store i256 0, i256* %[[T03]], align 4 +//CHECK-NEXT: %[[T04:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T05:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T06:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T05]], i32 0, i256 0 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T04]], [0 x i256]* null, i256* %[[T06]]) +//CHECK-NEXT: %[[T07:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T08:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T09:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T08]], i32 0, i256 1 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T07]], [0 x i256]* null, i256* %[[T09]]) +//CHECK-NEXT: %[[T10:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 7 +//CHECK-NEXT: store i256 1, i256* %[[T10]], align 4 +//CHECK-NEXT: %[[T11:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 8 +//CHECK-NEXT: store i256 0, i256* %[[T11]], align 4 +//CHECK-NEXT: %[[T12:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T13:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T14:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T13]], i32 0, i256 2 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T12]], [0 x i256]* null, i256* %[[T14]]) +//CHECK-NEXT: %[[T15:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T16:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T17:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T16]], i32 0, i256 3 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T15]], [0 x i256]* null, i256* %[[T17]]) +//CHECK-NEXT: %[[T18:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 7 +//CHECK-NEXT: store i256 2, i256* %[[T18]], align 4 +//CHECK-NEXT: %[[T19:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 8 +//CHECK-NEXT: store i256 0, i256* %[[T19]], align 4 +//CHECK-NEXT: %[[T20:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T21:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T22:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T21]], i32 0, i256 4 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T20]], [0 x i256]* null, i256* %[[T22]]) +//CHECK-NEXT: %[[T23:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T24:[0-9a-zA-Z_.]+]] = bitcast i256* %0 to [0 x i256]* +//CHECK-NEXT: %[[T25:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T24]], i32 0, i256 5 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T23]], [0 x i256]* null, i256* %[[T25]]) +//CHECK-NEXT: %[[T26:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 7 +//CHECK-NEXT: store i256 3, i256* %[[T26]], align 4 //CHECK-NEXT: br label %return4 //CHECK-EMPTY: //CHECK-NEXT: return4: @@ -122,35 +116,35 @@ component main = CallArgTest(); //CHECK-NEXT: br label %call1 //CHECK-EMPTY: //CHECK-NEXT: call1: -//CHECK-NEXT: %sum_0_arena = alloca [9 x i256], align 8 -//CHECK-NEXT: %[[SRC_PTR:[0-9a-zA-Z_.]+]] = getelementptr [9 x i256], [9 x i256]* %sum_0_arena, i32 0, i32 0 +//CHECK-NEXT: %[[$FUN_NAME]]_arena = alloca [9 x i256], align 8 +//CHECK-NEXT: %[[SRC_PTR:[0-9a-zA-Z_.]+]] = getelementptr [9 x i256], [9 x i256]* %[[$FUN_NAME]]_arena, i32 0, i32 0 //CHECK-NEXT: %[[DST_PTR:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %0, i32 0, i32 1 -//CHECK-NEXT: %copy_src_0 = getelementptr i256, i256* %[[DST_PTR]], i32 0 -//CHECK-NEXT: %copy_dst_0 = getelementptr i256, i256* %[[SRC_PTR]], i32 0 -//CHECK-NEXT: %copy_val_0 = load i256, i256* %copy_src_0, align 4 -//CHECK-NEXT: store i256 %copy_val_0, i256* %copy_dst_0, align 4 -//CHECK-NEXT: %copy_src_1 = getelementptr i256, i256* %[[DST_PTR]], i32 1 -//CHECK-NEXT: %copy_dst_1 = getelementptr i256, i256* %[[SRC_PTR]], i32 1 -//CHECK-NEXT: %copy_val_1 = load i256, i256* %copy_src_1, align 4 -//CHECK-NEXT: store i256 %copy_val_1, i256* %copy_dst_1, align 4 -//CHECK-NEXT: %copy_src_2 = getelementptr i256, i256* %[[DST_PTR]], i32 2 -//CHECK-NEXT: %copy_dst_2 = getelementptr i256, i256* %[[SRC_PTR]], i32 2 -//CHECK-NEXT: %copy_val_2 = load i256, i256* %copy_src_2, align 4 -//CHECK-NEXT: store i256 %copy_val_2, i256* %copy_dst_2, align 4 -//CHECK-NEXT: %copy_src_3 = getelementptr i256, i256* %[[DST_PTR]], i32 3 -//CHECK-NEXT: %copy_dst_3 = getelementptr i256, i256* %[[SRC_PTR]], i32 3 -//CHECK-NEXT: %copy_val_3 = load i256, i256* %copy_src_3, align 4 -//CHECK-NEXT: store i256 %copy_val_3, i256* %copy_dst_3, align 4 -//CHECK-NEXT: %copy_src_4 = getelementptr i256, i256* %[[DST_PTR]], i32 4 -//CHECK-NEXT: %copy_dst_4 = getelementptr i256, i256* %[[SRC_PTR]], i32 4 -//CHECK-NEXT: %copy_val_4 = load i256, i256* %copy_src_4, align 4 -//CHECK-NEXT: store i256 %copy_val_4, i256* %copy_dst_4, align 4 -//CHECK-NEXT: %copy_src_5 = getelementptr i256, i256* %[[DST_PTR]], i32 5 -//CHECK-NEXT: %copy_dst_5 = getelementptr i256, i256* %[[SRC_PTR]], i32 5 -//CHECK-NEXT: %copy_val_5 = load i256, i256* %copy_src_5, align 4 -//CHECK-NEXT: store i256 %copy_val_5, i256* %copy_dst_5, align 4 -//CHECK-NEXT: %3 = bitcast [9 x i256]* %sum_0_arena to i256* -//CHECK-NEXT: %call.sum_0 = call i256 @sum_0(i256* %3) -//CHECK-NEXT: %4 = getelementptr [0 x i256], [0 x i256]* %0, i32 0, i32 0 -//CHECK-NEXT: store i256 %call.sum_0, i256* %4, align 4 +//CHECK-NEXT: %[[CPY_SRC_0:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR]], i32 0 +//CHECK-NEXT: %[[CPY_DST_0:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR]], i32 0 +//CHECK-NEXT: %[[CPY_VAL_0:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_0]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_0]], i256* %[[CPY_DST_0]], align 4 +//CHECK-NEXT: %[[CPY_SRC_1:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR]], i32 1 +//CHECK-NEXT: %[[CPY_DST_1:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR]], i32 1 +//CHECK-NEXT: %[[CPY_VAL_1:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_1]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_1]], i256* %[[CPY_DST_1]], align 4 +//CHECK-NEXT: %[[CPY_SRC_2:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR]], i32 2 +//CHECK-NEXT: %[[CPY_DST_2:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR]], i32 2 +//CHECK-NEXT: %[[CPY_VAL_2:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_2]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_2]], i256* %[[CPY_DST_2]], align 4 +//CHECK-NEXT: %[[CPY_SRC_3:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR]], i32 3 +//CHECK-NEXT: %[[CPY_DST_3:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR]], i32 3 +//CHECK-NEXT: %[[CPY_VAL_3:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_3]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_3]], i256* %[[CPY_DST_3]], align 4 +//CHECK-NEXT: %[[CPY_SRC_4:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR]], i32 4 +//CHECK-NEXT: %[[CPY_DST_4:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR]], i32 4 +//CHECK-NEXT: %[[CPY_VAL_4:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_4]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_4]], i256* %[[CPY_DST_4]], align 4 +//CHECK-NEXT: %[[CPY_SRC_5:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR]], i32 5 +//CHECK-NEXT: %[[CPY_DST_5:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR]], i32 5 +//CHECK-NEXT: %[[CPY_VAL_5:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_5]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_5]], i256* %[[CPY_DST_5]], align 4 +//CHECK-NEXT: %[[T03:[0-9a-zA-Z_.]+]] = bitcast [9 x i256]* %[[$FUN_NAME]]_arena to i256* +//CHECK-NEXT: %[[T05:[0-9a-zA-Z_.]+]] = call i256 @[[$FUN_NAME]](i256* %[[T03]]) +//CHECK-NEXT: %[[T04:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %0, i32 0, i32 0 +//CHECK-NEXT: store i256 %[[T05]], i256* %[[T04]], align 4 //CHECK-NEXT: br label %prologue diff --git a/circom/tests/calls/call_arg_arraymulti_arraymulti.circom b/circom/tests/calls/call_arg_arraymulti_arraymulti.circom index e3e2abca5..e56538e55 100644 --- a/circom/tests/calls/call_arg_arraymulti_arraymulti.circom +++ b/circom/tests/calls/call_arg_arraymulti_arraymulti.circom @@ -2,6 +2,7 @@ pragma circom 2.1.0; // REQUIRES: circom // RUN: rm -rf %t && mkdir %t && %circom --llvm -o %t %s | sed -n 's/.*Written successfully:.* \(.*\)/\1/p' | xargs cat | FileCheck %s --enable-var-scope +// %[[T00]] (i.e. arena) = [ a[0][0], a[0][1], a[1][0], a[1][1], a[2][0], a[2][1], b[0][0], b[0][1], b[1][0], b[1][1], b[2][0], b[2][1], agg, i, j ] function sum(a, b) { var agg = 0; for (var i = 0; i < 3; i++) { @@ -22,177 +23,171 @@ template CallArgTest() { component main = CallArgTest(); -//CHECK-LABEL: define{{.*}} void @..generated..loop.body.{{[0-9]+}}([0 x i256]* %lvars, [0 x i256]* %signals, i256* %var_0, i256* %var_1){{.*}} { +//CHECK-LABEL: define{{.*}} void @..generated..loop.body.{{[0-9]+}} +//CHECK-SAME: ([0 x i256]* %lvars, [0 x i256]* %signals, i256* %[[V0:var_[0-9]+]], i256* %[[V1:var_[0-9]+]]){{.*}} { //CHECK-NEXT: ..generated..loop.body.[[$F_ID_1:[0-9]+]]: //CHECK-NEXT: br label %store1 //CHECK-EMPTY: //CHECK-NEXT: store1: -//CHECK-NEXT: %0 = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 12 -//CHECK-NEXT: %1 = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 12 -//CHECK-NEXT: %2 = load i256, i256* %1, align 4 -//CHECK-NEXT: %3 = getelementptr i256, i256* %var_0, i32 0 -//CHECK-NEXT: %4 = load i256, i256* %3, align 4 -//CHECK-NEXT: %5 = getelementptr i256, i256* %var_1, i32 0 -//CHECK-NEXT: %6 = load i256, i256* %5, align 4 -//CHECK-NEXT: %call.fr_sub = call i256 @fr_sub(i256 %4, i256 %6) -//CHECK-NEXT: %call.fr_add = call i256 @fr_add(i256 %2, i256 %call.fr_sub) -//CHECK-NEXT: store i256 %call.fr_add, i256* %0, align 4 +//CHECK-NEXT: %[[T00:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 12 +//CHECK-NEXT: %[[T01:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 12 +//CHECK-NEXT: %[[T02:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T01]], align 4 +//CHECK-NEXT: %[[T03:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[V0]], i32 0 +//CHECK-NEXT: %[[T04:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T03]], align 4 +//CHECK-NEXT: %[[T05:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[V1]], i32 0 +//CHECK-NEXT: %[[T06:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T05]], align 4 +//CHECK-NEXT: %[[T11:[0-9a-zA-Z_.]+]] = call i256 @fr_sub(i256 %[[T04]], i256 %[[T06]]) +//CHECK-NEXT: %[[T12:[0-9a-zA-Z_.]+]] = call i256 @fr_add(i256 %[[T02]], i256 %[[T11]]) +//CHECK-NEXT: store i256 %[[T12]], i256* %[[T00]], align 4 //CHECK-NEXT: br label %store2 //CHECK-EMPTY: //CHECK-NEXT: store2: -//CHECK-NEXT: %7 = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 14 -//CHECK-NEXT: %8 = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 14 -//CHECK-NEXT: %9 = load i256, i256* %8, align 4 -//CHECK-NEXT: %call.fr_add1 = call i256 @fr_add(i256 %9, i256 1) -//CHECK-NEXT: store i256 %call.fr_add1, i256* %7, align 4 +//CHECK-NEXT: %[[T07:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 14 +//CHECK-NEXT: %[[T08:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %lvars, i32 0, i32 14 +//CHECK-NEXT: %[[T09:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T08]], align 4 +//CHECK-NEXT: %[[T13:[0-9a-zA-Z_.]+]] = call i256 @fr_add(i256 %[[T09]], i256 1) +//CHECK-NEXT: store i256 %[[T13]], i256* %[[T07]], align 4 //CHECK-NEXT: br label %return3 //CHECK-EMPTY: //CHECK-NEXT: return3: //CHECK-NEXT: ret void //CHECK-NEXT: } // -//CHECK-LABEL: define{{.*}} i256 @sum_0(i256* %0){{.*}} { -//CHECK-NEXT: sum_0: +//CHECK-LABEL: define{{.*}} i256 @sum_{{[0-9]+}} +//CHECK-SAME: (i256* %[[T00:[0-9a-zA-Z_.]+]]){{.*}} { +//CHECK-NEXT: [[$FUN_NAME:sum_[0-9]+]]: //CHECK-NEXT: br label %store1 //CHECK-EMPTY: //CHECK-NEXT: store1: -//CHECK-NEXT: %[[T01:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 12 +//CHECK-NEXT: %[[T01:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 12 //CHECK-NEXT: store i256 0, i256* %[[T01]], align 4 //CHECK-NEXT: br label %store2 //CHECK-EMPTY: //CHECK-NEXT: store2: -//CHECK-NEXT: %[[T02:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 13 +//CHECK-NEXT: %[[T02:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 13 //CHECK-NEXT: store i256 0, i256* %[[T02]], align 4 //CHECK-NEXT: br label %unrolled_loop3 //CHECK-EMPTY: //CHECK-NEXT: unrolled_loop3: -//CHECK-NEXT: %3 = getelementptr i256, i256* %0, i32 14 -//CHECK-NEXT: store i256 0, i256* %3, align 4 -//CHECK-NEXT: %4 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %5 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %6 = getelementptr [0 x i256], [0 x i256]* %5, i32 0, i256 0 -//CHECK-NEXT: %7 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %8 = getelementptr [0 x i256], [0 x i256]* %7, i32 0, i256 6 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %4, [0 x i256]* null, i256* %6, i256* %8) -//CHECK-NEXT: %9 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %10 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %11 = getelementptr [0 x i256], [0 x i256]* %10, i32 0, i256 1 -//CHECK-NEXT: %12 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %13 = getelementptr [0 x i256], [0 x i256]* %12, i32 0, i256 7 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %9, [0 x i256]* null, i256* %11, i256* %13) -//CHECK-NEXT: %14 = getelementptr i256, i256* %0, i32 13 -//CHECK-NEXT: %15 = getelementptr i256, i256* %0, i32 13 -//CHECK-NEXT: %16 = load i256, i256* %15, align 4 -//CHECK-NEXT: %call.fr_add = call i256 @fr_add(i256 %16, i256 1) -//CHECK-NEXT: store i256 %call.fr_add, i256* %14, align 4 -//CHECK-NEXT: %17 = getelementptr i256, i256* %0, i32 14 -//CHECK-NEXT: store i256 0, i256* %17, align 4 -//CHECK-NEXT: %18 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %19 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %20 = getelementptr [0 x i256], [0 x i256]* %19, i32 0, i256 2 -//CHECK-NEXT: %21 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %22 = getelementptr [0 x i256], [0 x i256]* %21, i32 0, i256 8 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %18, [0 x i256]* null, i256* %20, i256* %22) -//CHECK-NEXT: %23 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %24 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %25 = getelementptr [0 x i256], [0 x i256]* %24, i32 0, i256 3 -//CHECK-NEXT: %26 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %27 = getelementptr [0 x i256], [0 x i256]* %26, i32 0, i256 9 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %23, [0 x i256]* null, i256* %25, i256* %27) -//CHECK-NEXT: %28 = getelementptr i256, i256* %0, i32 13 -//CHECK-NEXT: %29 = getelementptr i256, i256* %0, i32 13 -//CHECK-NEXT: %30 = load i256, i256* %29, align 4 -//CHECK-NEXT: %call.fr_add14 = call i256 @fr_add(i256 %30, i256 1) -//CHECK-NEXT: store i256 %call.fr_add14, i256* %28, align 4 -//CHECK-NEXT: %31 = getelementptr i256, i256* %0, i32 14 -//CHECK-NEXT: store i256 0, i256* %31, align 4 -//CHECK-NEXT: %32 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %33 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %34 = getelementptr [0 x i256], [0 x i256]* %33, i32 0, i256 4 -//CHECK-NEXT: %35 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %36 = getelementptr [0 x i256], [0 x i256]* %35, i32 0, i256 10 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %32, [0 x i256]* null, i256* %34, i256* %36) -//CHECK-NEXT: %37 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %38 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %39 = getelementptr [0 x i256], [0 x i256]* %38, i32 0, i256 5 -//CHECK-NEXT: %40 = bitcast i256* %0 to [0 x i256]* -//CHECK-NEXT: %41 = getelementptr [0 x i256], [0 x i256]* %40, i32 0, i256 11 -//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %37, [0 x i256]* null, i256* %39, i256* %41) -//CHECK-NEXT: %42 = getelementptr i256, i256* %0, i32 13 -//CHECK-NEXT: %43 = getelementptr i256, i256* %0, i32 13 -//CHECK-NEXT: %44 = load i256, i256* %43, align 4 -//CHECK-NEXT: %call.fr_add23 = call i256 @fr_add(i256 %44, i256 1) -//CHECK-NEXT: store i256 %call.fr_add23, i256* %42, align 4 +//CHECK-NEXT: %[[T03:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 14 +//CHECK-NEXT: store i256 0, i256* %[[T03]], align 4 +//CHECK-NEXT: %[[T04:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T05:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T06:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T05]], i32 0, i256 0 +//CHECK-NEXT: %[[T07:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T08:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T07]], i32 0, i256 6 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T04]], [0 x i256]* null, i256* %[[T06]], i256* %[[T08]]) +//CHECK-NEXT: %[[T09:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T10:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T11:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T10]], i32 0, i256 1 +//CHECK-NEXT: %[[T12:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T13:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T12]], i32 0, i256 7 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T09]], [0 x i256]* null, i256* %[[T11]], i256* %[[T13]]) +//CHECK-NEXT: %[[T14:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 13 +//CHECK-NEXT: store i256 1, i256* %[[T14]], align 4 +//CHECK-NEXT: %[[T15:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 14 +//CHECK-NEXT: store i256 0, i256* %[[T15]], align 4 +//CHECK-NEXT: %[[T16:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T17:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T18:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T17]], i32 0, i256 2 +//CHECK-NEXT: %[[T19:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T20:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T19]], i32 0, i256 8 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T16]], [0 x i256]* null, i256* %[[T18]], i256* %[[T20]]) +//CHECK-NEXT: %[[T21:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T22:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T23:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T22]], i32 0, i256 3 +//CHECK-NEXT: %[[T24:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T25:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T24]], i32 0, i256 9 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T21]], [0 x i256]* null, i256* %[[T23]], i256* %[[T25]]) +//CHECK-NEXT: %[[T26:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 13 +//CHECK-NEXT: store i256 2, i256* %[[T26]], align 4 +//CHECK-NEXT: %[[T27:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 14 +//CHECK-NEXT: store i256 0, i256* %[[T27]], align 4 +//CHECK-NEXT: %[[T28:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T29:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T30:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T29]], i32 0, i256 4 +//CHECK-NEXT: %[[T31:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T32:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T31]], i32 0, i256 10 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T28]], [0 x i256]* null, i256* %[[T30]], i256* %[[T32]]) +//CHECK-NEXT: %[[T33:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T34:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T35:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T34]], i32 0, i256 5 +//CHECK-NEXT: %[[T36:[0-9a-zA-Z_.]+]] = bitcast i256* %[[T00]] to [0 x i256]* +//CHECK-NEXT: %[[T37:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T36]], i32 0, i256 11 +//CHECK-NEXT: call void @..generated..loop.body.[[$F_ID_1]]([0 x i256]* %[[T33]], [0 x i256]* null, i256* %[[T35]], i256* %[[T37]]) +//CHECK-NEXT: %[[T38:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 13 +//CHECK-NEXT: store i256 3, i256* %[[T38]], align 4 //CHECK-NEXT: br label %return4 //CHECK-EMPTY: //CHECK-NEXT: return4: -//CHECK-NEXT: %[[T29:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %0, i32 12 -//CHECK-NEXT: %[[T30:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T29]], align 4 -//CHECK-NEXT: ret i256 %[[T30]] +//CHECK-NEXT: %[[T39:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[T00]], i32 12 +//CHECK-NEXT: %[[T40:[0-9a-zA-Z_.]+]] = load i256, i256* %[[T39]], align 4 +//CHECK-NEXT: ret i256 %[[T40]] //CHECK-NEXT: } // -//CHECK-LABEL: define{{.*}} void @CallArgTest_0_run([0 x i256]* %0){{.*}} { +//CHECK-LABEL: define{{.*}} void @CallArgTest_{{[0-9]+}}_run +//CHECK-SAME: ([0 x i256]* %[[T00:[0-9a-zA-Z_.]+]]){{.*}} { //CHECK-NEXT: prelude: //CHECK-NEXT: %lvars = alloca [0 x i256], align 8 //CHECK-NEXT: %subcmps = alloca [0 x { [0 x i256]*, i32 }], align 8 //CHECK-NEXT: br label %call1 //CHECK-EMPTY: //CHECK-NEXT: call1: -//CHECK-NEXT: %sum_0_arena = alloca [15 x i256], align 8 -//CHECK-NEXT: %[[DST_PTR:[0-9a-zA-Z_.]+]] = getelementptr [15 x i256], [15 x i256]* %sum_0_arena, i32 0, i32 0 -//CHECK-NEXT: %[[SRC_PTR:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %0, i32 0, i32 1 -//CHECK-NEXT: %copy_src_0 = getelementptr i256, i256* %[[SRC_PTR]], i32 0 -//CHECK-NEXT: %copy_dst_0 = getelementptr i256, i256* %[[DST_PTR]], i32 0 -//CHECK-NEXT: %copy_val_0 = load i256, i256* %copy_src_0, align 4 -//CHECK-NEXT: store i256 %copy_val_0, i256* %copy_dst_0, align 4 -//CHECK-NEXT: %copy_src_1 = getelementptr i256, i256* %[[SRC_PTR]], i32 1 -//CHECK-NEXT: %copy_dst_1 = getelementptr i256, i256* %[[DST_PTR]], i32 1 -//CHECK-NEXT: %copy_val_1 = load i256, i256* %copy_src_1, align 4 -//CHECK-NEXT: store i256 %copy_val_1, i256* %copy_dst_1, align 4 -//CHECK-NEXT: %copy_src_2 = getelementptr i256, i256* %[[SRC_PTR]], i32 2 -//CHECK-NEXT: %copy_dst_2 = getelementptr i256, i256* %[[DST_PTR]], i32 2 -//CHECK-NEXT: %copy_val_2 = load i256, i256* %copy_src_2, align 4 -//CHECK-NEXT: store i256 %copy_val_2, i256* %copy_dst_2, align 4 -//CHECK-NEXT: %copy_src_3 = getelementptr i256, i256* %[[SRC_PTR]], i32 3 -//CHECK-NEXT: %copy_dst_3 = getelementptr i256, i256* %[[DST_PTR]], i32 3 -//CHECK-NEXT: %copy_val_3 = load i256, i256* %copy_src_3, align 4 -//CHECK-NEXT: store i256 %copy_val_3, i256* %copy_dst_3, align 4 -//CHECK-NEXT: %copy_src_4 = getelementptr i256, i256* %[[SRC_PTR]], i32 4 -//CHECK-NEXT: %copy_dst_4 = getelementptr i256, i256* %[[DST_PTR]], i32 4 -//CHECK-NEXT: %copy_val_4 = load i256, i256* %copy_src_4, align 4 -//CHECK-NEXT: store i256 %copy_val_4, i256* %copy_dst_4, align 4 -//CHECK-NEXT: %copy_src_5 = getelementptr i256, i256* %[[SRC_PTR]], i32 5 -//CHECK-NEXT: %copy_dst_5 = getelementptr i256, i256* %[[DST_PTR]], i32 5 -//CHECK-NEXT: %copy_val_5 = load i256, i256* %copy_src_5, align 4 -//CHECK-NEXT: store i256 %copy_val_5, i256* %copy_dst_5, align 4 -//CHECK-NEXT: %3 = getelementptr [15 x i256], [15 x i256]* %sum_0_arena, i32 0, i32 6 -//CHECK-NEXT: %4 = getelementptr [0 x i256], [0 x i256]* %0, i32 0, i32 7 -//CHECK-NEXT: %copy_src_01 = getelementptr i256, i256* %4, i32 0 -//CHECK-NEXT: %copy_dst_02 = getelementptr i256, i256* %3, i32 0 -//CHECK-NEXT: %copy_val_03 = load i256, i256* %copy_src_01, align 4 -//CHECK-NEXT: store i256 %copy_val_03, i256* %copy_dst_02, align 4 -//CHECK-NEXT: %copy_src_14 = getelementptr i256, i256* %4, i32 1 -//CHECK-NEXT: %copy_dst_15 = getelementptr i256, i256* %3, i32 1 -//CHECK-NEXT: %copy_val_16 = load i256, i256* %copy_src_14, align 4 -//CHECK-NEXT: store i256 %copy_val_16, i256* %copy_dst_15, align 4 -//CHECK-NEXT: %copy_src_27 = getelementptr i256, i256* %4, i32 2 -//CHECK-NEXT: %copy_dst_28 = getelementptr i256, i256* %3, i32 2 -//CHECK-NEXT: %copy_val_29 = load i256, i256* %copy_src_27, align 4 -//CHECK-NEXT: store i256 %copy_val_29, i256* %copy_dst_28, align 4 -//CHECK-NEXT: %copy_src_310 = getelementptr i256, i256* %4, i32 3 -//CHECK-NEXT: %copy_dst_311 = getelementptr i256, i256* %3, i32 3 -//CHECK-NEXT: %copy_val_312 = load i256, i256* %copy_src_310, align 4 -//CHECK-NEXT: store i256 %copy_val_312, i256* %copy_dst_311, align 4 -//CHECK-NEXT: %copy_src_413 = getelementptr i256, i256* %4, i32 4 -//CHECK-NEXT: %copy_dst_414 = getelementptr i256, i256* %3, i32 4 -//CHECK-NEXT: %copy_val_415 = load i256, i256* %copy_src_413, align 4 -//CHECK-NEXT: store i256 %copy_val_415, i256* %copy_dst_414, align 4 -//CHECK-NEXT: %copy_src_516 = getelementptr i256, i256* %4, i32 5 -//CHECK-NEXT: %copy_dst_517 = getelementptr i256, i256* %3, i32 5 -//CHECK-NEXT: %copy_val_518 = load i256, i256* %copy_src_516, align 4 -//CHECK-NEXT: store i256 %copy_val_518, i256* %copy_dst_517, align 4 -//CHECK-NEXT: %5 = bitcast [15 x i256]* %sum_0_arena to i256* -//CHECK-NEXT: %call.sum_0 = call i256 @sum_0(i256* %5) -//CHECK-NEXT: %6 = getelementptr [0 x i256], [0 x i256]* %0, i32 0, i32 0 -//CHECK-NEXT: store i256 %call.sum_0, i256* %6, align 4 +//CHECK-NEXT: %[[$FUN_NAME]]_arena = alloca [15 x i256], align 8 +//CHECK-NEXT: %[[DST_PTR_A:[0-9a-zA-Z_.]+]] = getelementptr [15 x i256], [15 x i256]* %[[$FUN_NAME]]_arena, i32 0, i32 0 +//CHECK-NEXT: %[[SRC_PTR_A:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T00]], i32 0, i32 1 +//CHECK-NEXT: %[[CPY_SRC_A0:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_A]], i32 0 +//CHECK-NEXT: %[[CPY_DST_A0:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_A]], i32 0 +//CHECK-NEXT: %[[CPY_VAL_A0:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_A0]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_A0]], i256* %[[CPY_DST_A0]], align 4 +//CHECK-NEXT: %[[CPY_SRC_A1:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_A]], i32 1 +//CHECK-NEXT: %[[CPY_DST_A1:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_A]], i32 1 +//CHECK-NEXT: %[[CPY_VAL_A1:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_A1]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_A1]], i256* %[[CPY_DST_A1]], align 4 +//CHECK-NEXT: %[[CPY_SRC_A2:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_A]], i32 2 +//CHECK-NEXT: %[[CPY_DST_A2:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_A]], i32 2 +//CHECK-NEXT: %[[CPY_VAL_A2:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_A2]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_A2]], i256* %[[CPY_DST_A2]], align 4 +//CHECK-NEXT: %[[CPY_SRC_A3:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_A]], i32 3 +//CHECK-NEXT: %[[CPY_DST_A3:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_A]], i32 3 +//CHECK-NEXT: %[[CPY_VAL_A3:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_A3]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_A3]], i256* %[[CPY_DST_A3]], align 4 +//CHECK-NEXT: %[[CPY_SRC_A4:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_A]], i32 4 +//CHECK-NEXT: %[[CPY_DST_A4:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_A]], i32 4 +//CHECK-NEXT: %[[CPY_VAL_A4:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_A4]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_A4]], i256* %[[CPY_DST_A4]], align 4 +//CHECK-NEXT: %[[CPY_SRC_A5:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_A]], i32 5 +//CHECK-NEXT: %[[CPY_DST_A5:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_A]], i32 5 +//CHECK-NEXT: %[[CPY_VAL_A5:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_A5]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_A5]], i256* %[[CPY_DST_A5]], align 4 +//CHECK-NEXT: %[[DST_PTR_B:[0-9a-zA-Z_.]+]] = getelementptr [15 x i256], [15 x i256]* %[[$FUN_NAME]]_arena, i32 0, i32 6 +//CHECK-NEXT: %[[SRC_PTR_B:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T00]], i32 0, i32 7 +//CHECK-NEXT: %[[CPY_SRC_B0:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_B]], i32 0 +//CHECK-NEXT: %[[CPY_DST_B0:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_B]], i32 0 +//CHECK-NEXT: %[[CPY_VAL_B0:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_B0]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_B0]], i256* %[[CPY_DST_B0]], align 4 +//CHECK-NEXT: %[[CPY_SRC_B1:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_B]], i32 1 +//CHECK-NEXT: %[[CPY_DST_B1:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_B]], i32 1 +//CHECK-NEXT: %[[CPY_VAL_B1:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_B1]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_B1]], i256* %[[CPY_DST_B1]], align 4 +//CHECK-NEXT: %[[CPY_SRC_B2:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_B]], i32 2 +//CHECK-NEXT: %[[CPY_DST_B2:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_B]], i32 2 +//CHECK-NEXT: %[[CPY_VAL_B2:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_B2]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_B2]], i256* %[[CPY_DST_B2]], align 4 +//CHECK-NEXT: %[[CPY_SRC_B3:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_B]], i32 3 +//CHECK-NEXT: %[[CPY_DST_B3:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_B]], i32 3 +//CHECK-NEXT: %[[CPY_VAL_B3:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_B3]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_B3]], i256* %[[CPY_DST_B3]], align 4 +//CHECK-NEXT: %[[CPY_SRC_B4:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_B]], i32 4 +//CHECK-NEXT: %[[CPY_DST_B4:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_B]], i32 4 +//CHECK-NEXT: %[[CPY_VAL_B4:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_B4]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_B4]], i256* %[[CPY_DST_B4]], align 4 +//CHECK-NEXT: %[[CPY_SRC_B5:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[SRC_PTR_B]], i32 5 +//CHECK-NEXT: %[[CPY_DST_B5:[0-9a-zA-Z_.]+]] = getelementptr i256, i256* %[[DST_PTR_B]], i32 5 +//CHECK-NEXT: %[[CPY_VAL_B5:[0-9a-zA-Z_.]+]] = load i256, i256* %[[CPY_SRC_B5]], align 4 +//CHECK-NEXT: store i256 %[[CPY_VAL_B5]], i256* %[[CPY_DST_B5]], align 4 +//CHECK-NEXT: %[[T05:[0-9a-zA-Z_.]+]] = bitcast [15 x i256]* %[[$FUN_NAME]]_arena to i256* +//CHECK-NEXT: %[[T07:[0-9a-zA-Z_.]+]] = call i256 @[[$FUN_NAME]](i256* %[[T05]]) +//CHECK-NEXT: %[[T06:[0-9a-zA-Z_.]+]] = getelementptr [0 x i256], [0 x i256]* %[[T00]], i32 0, i32 0 +//CHECK-NEXT: store i256 %[[T07]], i256* %[[T06]], align 4 //CHECK-NEXT: br label %prologue diff --git a/circuit_passes/src/passes/simplification.rs b/circuit_passes/src/passes/simplification.rs index 7070623df..dd38fbc65 100644 --- a/circuit_passes/src/passes/simplification.rs +++ b/circuit_passes/src/passes/simplification.rs @@ -158,7 +158,7 @@ impl Observer> for SimplificationPass<'_> { } fn ignore_function_calls(&self) -> bool { - true + false } fn ignore_subcmp_calls(&self) -> bool {