diff --git a/crates/cairo-lang-lowering/src/reorganize_blocks.rs b/crates/cairo-lang-lowering/src/reorganize_blocks.rs index 0e9df00108d..aa2a9f275ca 100644 --- a/crates/cairo-lang-lowering/src/reorganize_blocks.rs +++ b/crates/cairo-lang-lowering/src/reorganize_blocks.rs @@ -127,13 +127,11 @@ impl Analyzer<'_> for TopSortContext { _info: &mut Self::Info, _statement_location: StatementLocation, target_block_id: BlockId, - remapping: &VarRemapping, + // Note that the remappings of a goto are not considered a usage, Later usages (such as a + // merge) would catch them if used. + _remapping: &VarRemapping, ) { self.incoming_gotos[target_block_id.0] += 1; - - for var_usage in remapping.values() { - self.remappings_ctx.set_used(var_usage.var_id); - } } fn merge_match( diff --git a/crates/cairo-lang-runner/src/profiling_test_data/profiling b/crates/cairo-lang-runner/src/profiling_test_data/profiling index c7c5d732bff..6b82c06fa6a 100644 --- a/crates/cairo-lang-runner/src/profiling_test_data/profiling +++ b/crates/cairo-lang-runner/src/profiling_test_data/profiling @@ -49,29 +49,29 @@ Weight by sierra statement: statement 19: 4 (store_temp([8]) -> ([8])) statement 20: 4 (store_temp([13]) -> ([13])) statement 21: 4 (store_temp([18]) -> ([18])) - statement 101: 4 (u8_overflowing_add([49], [75], [76]) { fallthrough([80], [81]) 151([82], [83]) }) - statement 129: 4 (u8_overflowing_add([71], [97], [98]) { fallthrough([102], [103]) 139([104], [105]) }) - statement 137: 3 (store_temp>([109]) -> ([109])) - statement 50: 2 (enum_match([8]) { fallthrough([41]) 56([42]) 62([43]) 68([44]) }) - statement 78: 2 (enum_match([13]) { fallthrough([63]) 84([64]) 90([65]) 96([66]) }) - statement 106: 2 (enum_match([18]) { fallthrough([85]) 112([86]) 118([87]) 124([88]) }) - statement 22: 1 (enum_match([4]) { fallthrough([19]) 28([20]) 34([21]) 40([22]) }) + statement 89: 4 (u8_overflowing_add([41], [63], [64]) { fallthrough([68], [69]) 135([70], [71]) }) + statement 113: 4 (u8_overflowing_add([59], [81], [82]) { fallthrough([86], [87]) 123([88], [89]) }) + statement 121: 3 (store_temp>([93]) -> ([93])) + statement 46: 2 (enum_match([8]) { fallthrough([37]) 50([38]) 54([39]) 60([40]) }) + statement 70: 2 (enum_match([13]) { fallthrough([55]) 74([56]) 78([57]) 84([58]) }) + statement 94: 2 (enum_match([18]) { fallthrough([73]) 98([74]) 102([75]) 108([76]) }) + statement 22: 1 (enum_match([4]) { fallthrough([19]) 26([20]) 30([21]) 36([22]) }) statement 23: 1 (branch_align() -> ()) - statement 27: 1 (jump() { 32() }) - statement 32: 1 (store_temp([0]) -> ([27])) - statement 33: 1 (jump() { 50() }) - statement 56: 1 (branch_align() -> ()) - statement 60: 1 (store_temp([27]) -> ([49])) - statement 61: 1 (jump() { 78() }) - statement 93: 1 (store_temp([72]) -> ([75])) - statement 94: 1 (store_temp([74]) -> ([76])) - statement 95: 1 (jump() { 101() }) - statement 105: 1 (store_temp([80]) -> ([71])) - statement 127: 1 (store_temp([99]) -> ([97])) - statement 128: 1 (store_temp([101]) -> ([98])) - statement 130: 1 (branch_align() -> ()) - statement 133: 1 (store_temp([102]) -> ([93])) - statement 138: 1 (return([93], [109])) + statement 25: 1 (jump() { 28() }) + statement 28: 1 (store_temp([0]) -> ([23])) + statement 29: 1 (jump() { 46() }) + statement 50: 1 (branch_align() -> ()) + statement 52: 1 (store_temp([23]) -> ([41])) + statement 53: 1 (jump() { 70() }) + statement 81: 1 (store_temp([60]) -> ([63])) + statement 82: 1 (store_temp([62]) -> ([64])) + statement 83: 1 (jump() { 89() }) + statement 93: 1 (store_temp([68]) -> ([59])) + statement 111: 1 (store_temp([83]) -> ([81])) + statement 112: 1 (store_temp([85]) -> ([82])) + statement 114: 1 (branch_align() -> ()) + statement 117: 1 (store_temp([86]) -> ([77])) + statement 122: 1 (return([77], [93])) Weight by concrete libfunc: libfunc store_temp: 16 libfunc u8_overflowing_add: 8 @@ -94,9 +94,10 @@ Weight by user function (inc. generated): Weight by original user function (exc. generated): function test::main: 50 Weight by Cairo function: - function lib.cairo::foo: 31 + function lib.cairo::foo: 30 function integer.cairo::U8Add::add: 11 function lib.cairo::main: 8 + function unknown: 1 Weight by Sierra stack trace: test::main: 50 Weight by Cairo stack trace: diff --git a/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple b/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple index bc7f84cb541..3696bc28cf0 100644 --- a/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple +++ b/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple @@ -526,20 +526,10 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([19]) -> ([23], [24]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([23]) -> () - -drop([24]) -> () +drop>([19]) -> () jump() { label_test::main::5() } -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo + label_test::main::1: branch_align() -> () @@ -547,18 +537,11 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([20]) -> ([25], [26]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([25]) -> () - -drop([26]) -> () +drop>([20]) -> () label_test::main::5: -store_temp([0]) -> ([27]) +store_temp([0]) -> ([23]) Originating location: fn main() { ^*********^ @@ -575,19 +558,19 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([21]) -> ([28], [29], [30]) +struct_deconstruct>([21]) -> ([24], [25], [26]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*******^ In function: lib.cairo::foo -drop([29]) -> () +drop([25]) -> () -store_temp([28]) -> ([31]) +store_temp([24]) -> ([27]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([30]) -> ([32]) +store_temp([26]) -> ([28]) Originating location: match a { ^*******^ @@ -604,26 +587,26 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct([22]) -> ([33], [34], [35]) +struct_deconstruct([22]) -> ([29], [30], [31]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*****************^ In function: lib.cairo::foo -drop([34]) -> () +drop([30]) -> () -store_temp([33]) -> ([31]) +store_temp([29]) -> ([27]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([35]) -> ([32]) +store_temp([31]) -> ([28]) Originating location: match a { ^*******^ In function: lib.cairo::foo label_test::main::7: -u8_overflowing_add([0], [31], [32]) { fallthrough([36], [37]) label_test::main::8([38], [39]) } +u8_overflowing_add([0], [27], [28]) { fallthrough([32], [33]) label_test::main::8([34], [35]) } Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ @@ -633,21 +616,21 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -u8_to_felt252([37]) -> ([40]) +u8_to_felt252([33]) -> ([36]) Originating location: u8_to_felt252(self) ^*****************^ In function: integer.cairo::U8IntoFelt252::into -drop([40]) -> () +drop([36]) -> () -store_temp([36]) -> ([27]) +store_temp([32]) -> ([23]) Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add label_test::main::6: -enum_match([8]) { fallthrough([41]) label_test::main::10([42]) label_test::main::11([43]) label_test::main::12([44]) } +enum_match([8]) { fallthrough([37]) label_test::main::10([38]) label_test::main::11([39]) label_test::main::12([40]) } Originating location: match a { ^*******^ @@ -657,20 +640,10 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([41]) -> ([45], [46]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([45]) -> () - -drop([46]) -> () +drop>([37]) -> () jump() { label_test::main::14() } -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo + label_test::main::10: branch_align() -> () @@ -678,18 +651,11 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([42]) -> ([47], [48]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([47]) -> () - -drop([48]) -> () +drop>([38]) -> () label_test::main::14: -store_temp([27]) -> ([49]) +store_temp([23]) -> ([41]) Originating location: fn main() { ^*********^ @@ -706,19 +672,19 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([43]) -> ([50], [51], [52]) +struct_deconstruct>([39]) -> ([42], [43], [44]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*******^ In function: lib.cairo::foo -drop([51]) -> () +drop([43]) -> () -store_temp([50]) -> ([53]) +store_temp([42]) -> ([45]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([52]) -> ([54]) +store_temp([44]) -> ([46]) Originating location: match a { ^*******^ @@ -735,26 +701,26 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct([44]) -> ([55], [56], [57]) +struct_deconstruct([40]) -> ([47], [48], [49]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*****************^ In function: lib.cairo::foo -drop([56]) -> () +drop([48]) -> () -store_temp([55]) -> ([53]) +store_temp([47]) -> ([45]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([57]) -> ([54]) +store_temp([49]) -> ([46]) Originating location: match a { ^*******^ In function: lib.cairo::foo label_test::main::16: -u8_overflowing_add([27], [53], [54]) { fallthrough([58], [59]) label_test::main::17([60], [61]) } +u8_overflowing_add([23], [45], [46]) { fallthrough([50], [51]) label_test::main::17([52], [53]) } Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ @@ -764,21 +730,21 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -u8_to_felt252([59]) -> ([62]) +u8_to_felt252([51]) -> ([54]) Originating location: u8_to_felt252(self) ^*****************^ In function: integer.cairo::U8IntoFelt252::into -drop([62]) -> () +drop([54]) -> () -store_temp([58]) -> ([49]) +store_temp([50]) -> ([41]) Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add label_test::main::15: -enum_match([13]) { fallthrough([63]) label_test::main::19([64]) label_test::main::20([65]) label_test::main::21([66]) } +enum_match([13]) { fallthrough([55]) label_test::main::19([56]) label_test::main::20([57]) label_test::main::21([58]) } Originating location: match a { ^*******^ @@ -788,20 +754,10 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([63]) -> ([67], [68]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([67]) -> () - -drop([68]) -> () +drop>([55]) -> () jump() { label_test::main::23() } -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo + label_test::main::19: branch_align() -> () @@ -809,18 +765,11 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([64]) -> ([69], [70]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([69]) -> () - -drop([70]) -> () +drop>([56]) -> () label_test::main::23: -store_temp([49]) -> ([71]) +store_temp([41]) -> ([59]) Originating location: fn main() { ^*********^ @@ -837,19 +786,19 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([65]) -> ([72], [73], [74]) +struct_deconstruct>([57]) -> ([60], [61], [62]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*******^ In function: lib.cairo::foo -drop([73]) -> () +drop([61]) -> () -store_temp([72]) -> ([75]) +store_temp([60]) -> ([63]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([74]) -> ([76]) +store_temp([62]) -> ([64]) Originating location: match a { ^*******^ @@ -866,26 +815,26 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct([66]) -> ([77], [78], [79]) +struct_deconstruct([58]) -> ([65], [66], [67]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*****************^ In function: lib.cairo::foo -drop([78]) -> () +drop([66]) -> () -store_temp([77]) -> ([75]) +store_temp([65]) -> ([63]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([79]) -> ([76]) +store_temp([67]) -> ([64]) Originating location: match a { ^*******^ In function: lib.cairo::foo label_test::main::25: -u8_overflowing_add([49], [75], [76]) { fallthrough([80], [81]) label_test::main::26([82], [83]) } +u8_overflowing_add([41], [63], [64]) { fallthrough([68], [69]) label_test::main::26([70], [71]) } Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ @@ -895,21 +844,21 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -u8_to_felt252([81]) -> ([84]) +u8_to_felt252([69]) -> ([72]) Originating location: u8_to_felt252(self) ^*****************^ In function: integer.cairo::U8IntoFelt252::into -drop([84]) -> () +drop([72]) -> () -store_temp([80]) -> ([71]) +store_temp([68]) -> ([59]) Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add label_test::main::24: -enum_match([18]) { fallthrough([85]) label_test::main::28([86]) label_test::main::29([87]) label_test::main::30([88]) } +enum_match([18]) { fallthrough([73]) label_test::main::28([74]) label_test::main::29([75]) label_test::main::30([76]) } Originating location: match a { ^*******^ @@ -919,20 +868,10 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([85]) -> ([89], [90]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([89]) -> () - -drop([90]) -> () +drop>([73]) -> () jump() { label_test::main::32() } -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo + label_test::main::28: branch_align() -> () @@ -940,18 +879,11 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([86]) -> ([91], [92]) -Originating location: - MyEnum::A((_, x)) | MyEnum::B((x, _)) => x, - ^****^ -In function: lib.cairo::foo -drop([91]) -> () - -drop([92]) -> () +drop>([74]) -> () label_test::main::32: -store_temp([71]) -> ([93]) +store_temp([59]) -> ([77]) Originating location: fn main() { ^*********^ @@ -968,19 +900,19 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct>([87]) -> ([94], [95], [96]) +struct_deconstruct>([75]) -> ([78], [79], [80]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*******^ In function: lib.cairo::foo -drop([95]) -> () +drop([79]) -> () -store_temp([94]) -> ([97]) +store_temp([78]) -> ([81]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([96]) -> ([98]) +store_temp([80]) -> ([82]) Originating location: match a { ^*******^ @@ -997,26 +929,26 @@ Originating location: match a { ^*******^ In function: lib.cairo::foo -struct_deconstruct([88]) -> ([99], [100], [101]) +struct_deconstruct([76]) -> ([83], [84], [85]) Originating location: MyEnum::C((x, _, t)) | MyEnum::D(P { x, y: _, z: t }) => (x + t).into(), ^*****************^ In function: lib.cairo::foo -drop([100]) -> () +drop([84]) -> () -store_temp([99]) -> ([97]) +store_temp([83]) -> ([81]) Originating location: match a { ^*******^ In function: lib.cairo::foo -store_temp([101]) -> ([98]) +store_temp([85]) -> ([82]) Originating location: match a { ^*******^ In function: lib.cairo::foo label_test::main::34: -u8_overflowing_add([71], [97], [98]) { fallthrough([102], [103]) label_test::main::35([104], [105]) } +u8_overflowing_add([59], [81], [82]) { fallthrough([86], [87]) label_test::main::35([88], [89]) } Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ @@ -1026,35 +958,35 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -u8_to_felt252([103]) -> ([106]) +u8_to_felt252([87]) -> ([90]) Originating location: u8_to_felt252(self) ^*****************^ In function: integer.cairo::U8IntoFelt252::into -drop([106]) -> () +drop([90]) -> () -store_temp([102]) -> ([93]) +store_temp([86]) -> ([77]) Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add label_test::main::33: -struct_construct() -> ([107]) +struct_construct() -> ([91]) -struct_construct>([107]) -> ([108]) +struct_construct>([91]) -> ([92]) -enum_init, 0>([108]) -> ([109]) +enum_init, 0>([92]) -> ([93]) Originating location: fn main() { ^ In function: lib.cairo::main -store_temp>([109]) -> ([109]) +store_temp>([93]) -> ([93]) Originating location: fn main() { ^ In function: lib.cairo::main -return([93], [109]) +return([77], [93]) Originating location: fn main() { ^ @@ -1066,45 +998,45 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -drop([105]) -> () +drop([89]) -> () -array_new() -> ([110]) +array_new() -> ([94]) Originating location: array_new() ^*********^ In function: array.cairo::ArrayImpl::new -const_as_immediate>() -> ([111]) +const_as_immediate>() -> ([95]) -store_temp([111]) -> ([111]) +store_temp([95]) -> ([95]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -array_append([110], [111]) -> ([112]) +array_append([94], [95]) -> ([96]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -struct_construct() -> ([113]) +struct_construct() -> ([97]) -struct_construct>>([113], [112]) -> ([114]) +struct_construct>>([97], [96]) -> ([98]) -enum_init, 1>([114]) -> ([115]) +enum_init, 1>([98]) -> ([99]) Originating location: let _ = foo(d); ^****^ In function: lib.cairo::main -store_temp([104]) -> ([104]) +store_temp([88]) -> ([88]) Originating location: let _ = foo(d); ^****^ In function: lib.cairo::main -store_temp>([115]) -> ([115]) +store_temp>([99]) -> ([99]) Originating location: let _ = foo(d); ^****^ In function: lib.cairo::main -return([104], [115]) +return([88], [99]) Originating location: let _ = foo(d); ^****^ @@ -1120,47 +1052,47 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -drop([83]) -> () +drop([71]) -> () drop([18]) -> () -array_new() -> ([116]) +array_new() -> ([100]) Originating location: array_new() ^*********^ In function: array.cairo::ArrayImpl::new -const_as_immediate>() -> ([117]) +const_as_immediate>() -> ([101]) -store_temp([117]) -> ([117]) +store_temp([101]) -> ([101]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -array_append([116], [117]) -> ([118]) +array_append([100], [101]) -> ([102]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -struct_construct() -> ([119]) +struct_construct() -> ([103]) -struct_construct>>([119], [118]) -> ([120]) +struct_construct>>([103], [102]) -> ([104]) -enum_init, 1>([120]) -> ([121]) +enum_init, 1>([104]) -> ([105]) Originating location: let _ = foo(c); ^****^ In function: lib.cairo::main -store_temp([82]) -> ([82]) +store_temp([70]) -> ([70]) Originating location: let _ = foo(c); ^****^ In function: lib.cairo::main -store_temp>([121]) -> ([121]) +store_temp>([105]) -> ([105]) Originating location: let _ = foo(c); ^****^ In function: lib.cairo::main -return([82], [121]) +return([70], [105]) Originating location: let _ = foo(c); ^****^ @@ -1176,49 +1108,49 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -drop([61]) -> () +drop([53]) -> () drop([18]) -> () drop([13]) -> () -array_new() -> ([122]) +array_new() -> ([106]) Originating location: array_new() ^*********^ In function: array.cairo::ArrayImpl::new -const_as_immediate>() -> ([123]) +const_as_immediate>() -> ([107]) -store_temp([123]) -> ([123]) +store_temp([107]) -> ([107]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -array_append([122], [123]) -> ([124]) +array_append([106], [107]) -> ([108]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -struct_construct() -> ([125]) +struct_construct() -> ([109]) -struct_construct>>([125], [124]) -> ([126]) +struct_construct>>([109], [108]) -> ([110]) -enum_init, 1>([126]) -> ([127]) +enum_init, 1>([110]) -> ([111]) Originating location: let _ = foo(b); ^****^ In function: lib.cairo::main -store_temp([60]) -> ([60]) +store_temp([52]) -> ([52]) Originating location: let _ = foo(b); ^****^ In function: lib.cairo::main -store_temp>([127]) -> ([127]) +store_temp>([111]) -> ([111]) Originating location: let _ = foo(b); ^****^ In function: lib.cairo::main -return([60], [127]) +return([52], [111]) Originating location: let _ = foo(b); ^****^ @@ -1234,7 +1166,7 @@ Originating location: u8_overflowing_add(lhs, rhs).expect('u8_add Overflow') ^**************************^ In function: integer.cairo::U8Add::add -drop([39]) -> () +drop([35]) -> () drop([18]) -> () @@ -1242,43 +1174,43 @@ drop([13]) -> () drop([8]) -> () -array_new() -> ([128]) +array_new() -> ([112]) Originating location: array_new() ^*********^ In function: array.cairo::ArrayImpl::new -const_as_immediate>() -> ([129]) +const_as_immediate>() -> ([113]) -store_temp([129]) -> ([129]) +store_temp([113]) -> ([113]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -array_append([128], [129]) -> ([130]) +array_append([112], [113]) -> ([114]) Originating location: array_append(ref self, value) ^***************************^ In function: array.cairo::ArrayImpl::append -struct_construct() -> ([131]) +struct_construct() -> ([115]) -struct_construct>>([131], [130]) -> ([132]) +struct_construct>>([115], [114]) -> ([116]) -enum_init, 1>([132]) -> ([133]) +enum_init, 1>([116]) -> ([117]) Originating location: let _ = foo(a); ^****^ In function: lib.cairo::main -store_temp([38]) -> ([38]) +store_temp([34]) -> ([34]) Originating location: let _ = foo(a); ^****^ In function: lib.cairo::main -store_temp>([133]) -> ([133]) +store_temp>([117]) -> ([117]) Originating location: let _ = foo(a); ^****^ In function: lib.cairo::main -return([38], [133]) +return([34], [117]) Originating location: let _ = foo(a); ^****^ diff --git a/tests/test_data/match_or.sierra b/tests/test_data/match_or.sierra index 299d5f62d5d..8dca5fe05ae 100644 --- a/tests/test_data/match_or.sierra +++ b/tests/test_data/match_or.sierra @@ -37,8 +37,7 @@ libfunc enum_init = enum_init = store_temp; libfunc enum_match = enum_match; libfunc branch_align = branch_align; -libfunc struct_deconstruct> = struct_deconstruct>; -libfunc drop = drop; +libfunc drop> = drop>; libfunc jump = jump; libfunc store_temp = store_temp; libfunc struct_deconstruct> = struct_deconstruct>; @@ -47,6 +46,7 @@ libfunc store_temp = store_temp; libfunc struct_deconstruct = struct_deconstruct; libfunc u8_overflowing_add = u8_overflowing_add; libfunc u8_to_felt252 = u8_to_felt252; +libfunc drop = drop; libfunc struct_construct = struct_construct; libfunc struct_construct> = struct_construct>; libfunc enum_init, 0> = enum_init, 0>; @@ -59,6 +59,7 @@ libfunc struct_construct = struct_construct>> = struct_construct>>; libfunc enum_init, 1> = enum_init, 1>; libfunc drop = drop; +libfunc struct_deconstruct> = struct_deconstruct>; libfunc struct_construct> = struct_construct>; libfunc enum_init, 0> = enum_init, 0>; libfunc store_temp> = store_temp>; @@ -86,223 +87,207 @@ store_temp([4]) -> ([4]); // 18 store_temp([8]) -> ([8]); // 19 store_temp([13]) -> ([13]); // 20 store_temp([18]) -> ([18]); // 21 -enum_match([4]) { fallthrough([19]) 28([20]) 34([21]) 40([22]) }; // 22 +enum_match([4]) { fallthrough([19]) 26([20]) 30([21]) 36([22]) }; // 22 branch_align() -> (); // 23 -struct_deconstruct>([19]) -> ([23], [24]); // 24 -drop([23]) -> (); // 25 -drop([24]) -> (); // 26 -jump() { 32() }; // 27 -branch_align() -> (); // 28 -struct_deconstruct>([20]) -> ([25], [26]); // 29 -drop([25]) -> (); // 30 -drop([26]) -> (); // 31 -store_temp([0]) -> ([27]); // 32 -jump() { 50() }; // 33 -branch_align() -> (); // 34 -struct_deconstruct>([21]) -> ([28], [29], [30]); // 35 -drop([29]) -> (); // 36 -store_temp([28]) -> ([31]); // 37 -store_temp([30]) -> ([32]); // 38 -jump() { 45() }; // 39 -branch_align() -> (); // 40 -struct_deconstruct([22]) -> ([33], [34], [35]); // 41 -drop([34]) -> (); // 42 -store_temp([33]) -> ([31]); // 43 -store_temp([35]) -> ([32]); // 44 -u8_overflowing_add([0], [31], [32]) { fallthrough([36], [37]) 178([38], [39]) }; // 45 -branch_align() -> (); // 46 -u8_to_felt252([37]) -> ([40]); // 47 -drop([40]) -> (); // 48 -store_temp([36]) -> ([27]); // 49 -enum_match([8]) { fallthrough([41]) 56([42]) 62([43]) 68([44]) }; // 50 -branch_align() -> (); // 51 -struct_deconstruct>([41]) -> ([45], [46]); // 52 -drop([45]) -> (); // 53 -drop([46]) -> (); // 54 -jump() { 60() }; // 55 -branch_align() -> (); // 56 -struct_deconstruct>([42]) -> ([47], [48]); // 57 -drop([47]) -> (); // 58 -drop([48]) -> (); // 59 -store_temp([27]) -> ([49]); // 60 -jump() { 78() }; // 61 -branch_align() -> (); // 62 -struct_deconstruct>([43]) -> ([50], [51], [52]); // 63 -drop([51]) -> (); // 64 -store_temp([50]) -> ([53]); // 65 -store_temp([52]) -> ([54]); // 66 -jump() { 73() }; // 67 -branch_align() -> (); // 68 -struct_deconstruct([44]) -> ([55], [56], [57]); // 69 -drop([56]) -> (); // 70 -store_temp([55]) -> ([53]); // 71 -store_temp([57]) -> ([54]); // 72 -u8_overflowing_add([27], [53], [54]) { fallthrough([58], [59]) 164([60], [61]) }; // 73 +drop>([19]) -> (); // 24 +jump() { 28() }; // 25 +branch_align() -> (); // 26 +drop>([20]) -> (); // 27 +store_temp([0]) -> ([23]); // 28 +jump() { 46() }; // 29 +branch_align() -> (); // 30 +struct_deconstruct>([21]) -> ([24], [25], [26]); // 31 +drop([25]) -> (); // 32 +store_temp([24]) -> ([27]); // 33 +store_temp([26]) -> ([28]); // 34 +jump() { 41() }; // 35 +branch_align() -> (); // 36 +struct_deconstruct([22]) -> ([29], [30], [31]); // 37 +drop([30]) -> (); // 38 +store_temp([29]) -> ([27]); // 39 +store_temp([31]) -> ([28]); // 40 +u8_overflowing_add([0], [27], [28]) { fallthrough([32], [33]) 162([34], [35]) }; // 41 +branch_align() -> (); // 42 +u8_to_felt252([33]) -> ([36]); // 43 +drop([36]) -> (); // 44 +store_temp([32]) -> ([23]); // 45 +enum_match([8]) { fallthrough([37]) 50([38]) 54([39]) 60([40]) }; // 46 +branch_align() -> (); // 47 +drop>([37]) -> (); // 48 +jump() { 52() }; // 49 +branch_align() -> (); // 50 +drop>([38]) -> (); // 51 +store_temp([23]) -> ([41]); // 52 +jump() { 70() }; // 53 +branch_align() -> (); // 54 +struct_deconstruct>([39]) -> ([42], [43], [44]); // 55 +drop([43]) -> (); // 56 +store_temp([42]) -> ([45]); // 57 +store_temp([44]) -> ([46]); // 58 +jump() { 65() }; // 59 +branch_align() -> (); // 60 +struct_deconstruct([40]) -> ([47], [48], [49]); // 61 +drop([48]) -> (); // 62 +store_temp([47]) -> ([45]); // 63 +store_temp([49]) -> ([46]); // 64 +u8_overflowing_add([23], [45], [46]) { fallthrough([50], [51]) 148([52], [53]) }; // 65 +branch_align() -> (); // 66 +u8_to_felt252([51]) -> ([54]); // 67 +drop([54]) -> (); // 68 +store_temp([50]) -> ([41]); // 69 +enum_match([13]) { fallthrough([55]) 74([56]) 78([57]) 84([58]) }; // 70 +branch_align() -> (); // 71 +drop>([55]) -> (); // 72 +jump() { 76() }; // 73 branch_align() -> (); // 74 -u8_to_felt252([59]) -> ([62]); // 75 -drop([62]) -> (); // 76 -store_temp([58]) -> ([49]); // 77 -enum_match([13]) { fallthrough([63]) 84([64]) 90([65]) 96([66]) }; // 78 -branch_align() -> (); // 79 -struct_deconstruct>([63]) -> ([67], [68]); // 80 -drop([67]) -> (); // 81 -drop([68]) -> (); // 82 -jump() { 88() }; // 83 +drop>([56]) -> (); // 75 +store_temp([41]) -> ([59]); // 76 +jump() { 94() }; // 77 +branch_align() -> (); // 78 +struct_deconstruct>([57]) -> ([60], [61], [62]); // 79 +drop([61]) -> (); // 80 +store_temp([60]) -> ([63]); // 81 +store_temp([62]) -> ([64]); // 82 +jump() { 89() }; // 83 branch_align() -> (); // 84 -struct_deconstruct>([64]) -> ([69], [70]); // 85 -drop([69]) -> (); // 86 -drop([70]) -> (); // 87 -store_temp([49]) -> ([71]); // 88 -jump() { 106() }; // 89 +struct_deconstruct([58]) -> ([65], [66], [67]); // 85 +drop([66]) -> (); // 86 +store_temp([65]) -> ([63]); // 87 +store_temp([67]) -> ([64]); // 88 +u8_overflowing_add([41], [63], [64]) { fallthrough([68], [69]) 135([70], [71]) }; // 89 branch_align() -> (); // 90 -struct_deconstruct>([65]) -> ([72], [73], [74]); // 91 -drop([73]) -> (); // 92 -store_temp([72]) -> ([75]); // 93 -store_temp([74]) -> ([76]); // 94 -jump() { 101() }; // 95 -branch_align() -> (); // 96 -struct_deconstruct([66]) -> ([77], [78], [79]); // 97 -drop([78]) -> (); // 98 -store_temp([77]) -> ([75]); // 99 -store_temp([79]) -> ([76]); // 100 -u8_overflowing_add([49], [75], [76]) { fallthrough([80], [81]) 151([82], [83]) }; // 101 +u8_to_felt252([69]) -> ([72]); // 91 +drop([72]) -> (); // 92 +store_temp([68]) -> ([59]); // 93 +enum_match([18]) { fallthrough([73]) 98([74]) 102([75]) 108([76]) }; // 94 +branch_align() -> (); // 95 +drop>([73]) -> (); // 96 +jump() { 100() }; // 97 +branch_align() -> (); // 98 +drop>([74]) -> (); // 99 +store_temp([59]) -> ([77]); // 100 +jump() { 118() }; // 101 branch_align() -> (); // 102 -u8_to_felt252([81]) -> ([84]); // 103 -drop([84]) -> (); // 104 -store_temp([80]) -> ([71]); // 105 -enum_match([18]) { fallthrough([85]) 112([86]) 118([87]) 124([88]) }; // 106 -branch_align() -> (); // 107 -struct_deconstruct>([85]) -> ([89], [90]); // 108 -drop([89]) -> (); // 109 -drop([90]) -> (); // 110 -jump() { 116() }; // 111 -branch_align() -> (); // 112 -struct_deconstruct>([86]) -> ([91], [92]); // 113 -drop([91]) -> (); // 114 -drop([92]) -> (); // 115 -store_temp([71]) -> ([93]); // 116 -jump() { 134() }; // 117 -branch_align() -> (); // 118 -struct_deconstruct>([87]) -> ([94], [95], [96]); // 119 -drop([95]) -> (); // 120 -store_temp([94]) -> ([97]); // 121 -store_temp([96]) -> ([98]); // 122 -jump() { 129() }; // 123 -branch_align() -> (); // 124 -struct_deconstruct([88]) -> ([99], [100], [101]); // 125 -drop([100]) -> (); // 126 -store_temp([99]) -> ([97]); // 127 -store_temp([101]) -> ([98]); // 128 -u8_overflowing_add([71], [97], [98]) { fallthrough([102], [103]) 139([104], [105]) }; // 129 -branch_align() -> (); // 130 -u8_to_felt252([103]) -> ([106]); // 131 -drop([106]) -> (); // 132 -store_temp([102]) -> ([93]); // 133 -struct_construct() -> ([107]); // 134 -struct_construct>([107]) -> ([108]); // 135 -enum_init, 0>([108]) -> ([109]); // 136 -store_temp>([109]) -> ([109]); // 137 -return([93], [109]); // 138 -branch_align() -> (); // 139 -drop([105]) -> (); // 140 -array_new() -> ([110]); // 141 -const_as_immediate>() -> ([111]); // 142 -store_temp([111]) -> ([111]); // 143 -array_append([110], [111]) -> ([112]); // 144 -struct_construct() -> ([113]); // 145 -struct_construct>>([113], [112]) -> ([114]); // 146 -enum_init, 1>([114]) -> ([115]); // 147 -store_temp([104]) -> ([104]); // 148 -store_temp>([115]) -> ([115]); // 149 -return([104], [115]); // 150 -branch_align() -> (); // 151 -drop([83]) -> (); // 152 -drop([18]) -> (); // 153 -array_new() -> ([116]); // 154 -const_as_immediate>() -> ([117]); // 155 -store_temp([117]) -> ([117]); // 156 -array_append([116], [117]) -> ([118]); // 157 -struct_construct() -> ([119]); // 158 -struct_construct>>([119], [118]) -> ([120]); // 159 -enum_init, 1>([120]) -> ([121]); // 160 -store_temp([82]) -> ([82]); // 161 -store_temp>([121]) -> ([121]); // 162 -return([82], [121]); // 163 -branch_align() -> (); // 164 -drop([61]) -> (); // 165 -drop([18]) -> (); // 166 -drop([13]) -> (); // 167 -array_new() -> ([122]); // 168 -const_as_immediate>() -> ([123]); // 169 -store_temp([123]) -> ([123]); // 170 -array_append([122], [123]) -> ([124]); // 171 -struct_construct() -> ([125]); // 172 -struct_construct>>([125], [124]) -> ([126]); // 173 -enum_init, 1>([126]) -> ([127]); // 174 -store_temp([60]) -> ([60]); // 175 -store_temp>([127]) -> ([127]); // 176 -return([60], [127]); // 177 +struct_deconstruct>([75]) -> ([78], [79], [80]); // 103 +drop([79]) -> (); // 104 +store_temp([78]) -> ([81]); // 105 +store_temp([80]) -> ([82]); // 106 +jump() { 113() }; // 107 +branch_align() -> (); // 108 +struct_deconstruct([76]) -> ([83], [84], [85]); // 109 +drop([84]) -> (); // 110 +store_temp([83]) -> ([81]); // 111 +store_temp([85]) -> ([82]); // 112 +u8_overflowing_add([59], [81], [82]) { fallthrough([86], [87]) 123([88], [89]) }; // 113 +branch_align() -> (); // 114 +u8_to_felt252([87]) -> ([90]); // 115 +drop([90]) -> (); // 116 +store_temp([86]) -> ([77]); // 117 +struct_construct() -> ([91]); // 118 +struct_construct>([91]) -> ([92]); // 119 +enum_init, 0>([92]) -> ([93]); // 120 +store_temp>([93]) -> ([93]); // 121 +return([77], [93]); // 122 +branch_align() -> (); // 123 +drop([89]) -> (); // 124 +array_new() -> ([94]); // 125 +const_as_immediate>() -> ([95]); // 126 +store_temp([95]) -> ([95]); // 127 +array_append([94], [95]) -> ([96]); // 128 +struct_construct() -> ([97]); // 129 +struct_construct>>([97], [96]) -> ([98]); // 130 +enum_init, 1>([98]) -> ([99]); // 131 +store_temp([88]) -> ([88]); // 132 +store_temp>([99]) -> ([99]); // 133 +return([88], [99]); // 134 +branch_align() -> (); // 135 +drop([71]) -> (); // 136 +drop([18]) -> (); // 137 +array_new() -> ([100]); // 138 +const_as_immediate>() -> ([101]); // 139 +store_temp([101]) -> ([101]); // 140 +array_append([100], [101]) -> ([102]); // 141 +struct_construct() -> ([103]); // 142 +struct_construct>>([103], [102]) -> ([104]); // 143 +enum_init, 1>([104]) -> ([105]); // 144 +store_temp([70]) -> ([70]); // 145 +store_temp>([105]) -> ([105]); // 146 +return([70], [105]); // 147 +branch_align() -> (); // 148 +drop([53]) -> (); // 149 +drop([18]) -> (); // 150 +drop([13]) -> (); // 151 +array_new() -> ([106]); // 152 +const_as_immediate>() -> ([107]); // 153 +store_temp([107]) -> ([107]); // 154 +array_append([106], [107]) -> ([108]); // 155 +struct_construct() -> ([109]); // 156 +struct_construct>>([109], [108]) -> ([110]); // 157 +enum_init, 1>([110]) -> ([111]); // 158 +store_temp([52]) -> ([52]); // 159 +store_temp>([111]) -> ([111]); // 160 +return([52], [111]); // 161 +branch_align() -> (); // 162 +drop([35]) -> (); // 163 +drop([18]) -> (); // 164 +drop([13]) -> (); // 165 +drop([8]) -> (); // 166 +array_new() -> ([112]); // 167 +const_as_immediate>() -> ([113]); // 168 +store_temp([113]) -> ([113]); // 169 +array_append([112], [113]) -> ([114]); // 170 +struct_construct() -> ([115]); // 171 +struct_construct>>([115], [114]) -> ([116]); // 172 +enum_init, 1>([116]) -> ([117]); // 173 +store_temp([34]) -> ([34]); // 174 +store_temp>([117]) -> ([117]); // 175 +return([34], [117]); // 176 +enum_match([1]) { fallthrough([2]) 183([3]) 190([4]) 196([5]) }; // 177 branch_align() -> (); // 178 -drop([39]) -> (); // 179 -drop([18]) -> (); // 180 -drop([13]) -> (); // 181 -drop([8]) -> (); // 182 -array_new() -> ([128]); // 183 -const_as_immediate>() -> ([129]); // 184 -store_temp([129]) -> ([129]); // 185 -array_append([128], [129]) -> ([130]); // 186 -struct_construct() -> ([131]); // 187 -struct_construct>>([131], [130]) -> ([132]); // 188 -enum_init, 1>([132]) -> ([133]); // 189 -store_temp([38]) -> ([38]); // 190 -store_temp>([133]) -> ([133]); // 191 -return([38], [133]); // 192 -enum_match([1]) { fallthrough([2]) 199([3]) 206([4]) 212([5]) }; // 193 -branch_align() -> (); // 194 -struct_deconstruct>([2]) -> ([6], [7]); // 195 -drop([6]) -> (); // 196 -store_temp([7]) -> ([8]); // 197 -jump() { 203() }; // 198 -branch_align() -> (); // 199 -struct_deconstruct>([3]) -> ([9], [10]); // 200 -drop([10]) -> (); // 201 -store_temp([9]) -> ([8]); // 202 -store_temp([0]) -> ([11]); // 203 -store_temp([8]) -> ([12]); // 204 -jump() { 222() }; // 205 -branch_align() -> (); // 206 -struct_deconstruct>([4]) -> ([13], [14], [15]); // 207 -drop([14]) -> (); // 208 -store_temp([13]) -> ([16]); // 209 -store_temp([15]) -> ([17]); // 210 -jump() { 217() }; // 211 -branch_align() -> (); // 212 -struct_deconstruct([5]) -> ([18], [19], [20]); // 213 -drop([19]) -> (); // 214 -store_temp([18]) -> ([16]); // 215 -store_temp([20]) -> ([17]); // 216 -u8_overflowing_add([0], [16], [17]) { fallthrough([21], [22]) 227([23], [24]) }; // 217 -branch_align() -> (); // 218 -u8_to_felt252([22]) -> ([25]); // 219 -store_temp([21]) -> ([11]); // 220 -store_temp([25]) -> ([12]); // 221 -struct_construct>([12]) -> ([26]); // 222 -enum_init, 0>([26]) -> ([27]); // 223 -store_temp([11]) -> ([11]); // 224 -store_temp>([27]) -> ([27]); // 225 -return([11], [27]); // 226 -branch_align() -> (); // 227 -drop([24]) -> (); // 228 -array_new() -> ([28]); // 229 -const_as_immediate>() -> ([29]); // 230 -store_temp([29]) -> ([29]); // 231 -array_append([28], [29]) -> ([30]); // 232 -struct_construct() -> ([31]); // 233 -struct_construct>>([31], [30]) -> ([32]); // 234 -enum_init, 1>([32]) -> ([33]); // 235 -store_temp([23]) -> ([23]); // 236 -store_temp>([33]) -> ([33]); // 237 -return([23], [33]); // 238 +struct_deconstruct>([2]) -> ([6], [7]); // 179 +drop([6]) -> (); // 180 +store_temp([7]) -> ([8]); // 181 +jump() { 187() }; // 182 +branch_align() -> (); // 183 +struct_deconstruct>([3]) -> ([9], [10]); // 184 +drop([10]) -> (); // 185 +store_temp([9]) -> ([8]); // 186 +store_temp([0]) -> ([11]); // 187 +store_temp([8]) -> ([12]); // 188 +jump() { 206() }; // 189 +branch_align() -> (); // 190 +struct_deconstruct>([4]) -> ([13], [14], [15]); // 191 +drop([14]) -> (); // 192 +store_temp([13]) -> ([16]); // 193 +store_temp([15]) -> ([17]); // 194 +jump() { 201() }; // 195 +branch_align() -> (); // 196 +struct_deconstruct([5]) -> ([18], [19], [20]); // 197 +drop([19]) -> (); // 198 +store_temp([18]) -> ([16]); // 199 +store_temp([20]) -> ([17]); // 200 +u8_overflowing_add([0], [16], [17]) { fallthrough([21], [22]) 211([23], [24]) }; // 201 +branch_align() -> (); // 202 +u8_to_felt252([22]) -> ([25]); // 203 +store_temp([21]) -> ([11]); // 204 +store_temp([25]) -> ([12]); // 205 +struct_construct>([12]) -> ([26]); // 206 +enum_init, 0>([26]) -> ([27]); // 207 +store_temp([11]) -> ([11]); // 208 +store_temp>([27]) -> ([27]); // 209 +return([11], [27]); // 210 +branch_align() -> (); // 211 +drop([24]) -> (); // 212 +array_new() -> ([28]); // 213 +const_as_immediate>() -> ([29]); // 214 +store_temp([29]) -> ([29]); // 215 +array_append([28], [29]) -> ([30]); // 216 +struct_construct() -> ([31]); // 217 +struct_construct>>([31], [30]) -> ([32]); // 218 +enum_init, 1>([32]) -> ([33]); // 219 +store_temp([23]) -> ([23]); // 220 +store_temp>([33]) -> ([33]); // 221 +return([23], [33]); // 222 examples::match_or::main@0([0]: RangeCheck) -> (RangeCheck, core::panics::PanicResult::<((),)>); -examples::match_or::foo@193([0]: RangeCheck, [1]: examples::match_or::MyEnum) -> (RangeCheck, core::panics::PanicResult::<(core::felt252,)>); +examples::match_or::foo@177([0]: RangeCheck, [1]: examples::match_or::MyEnum) -> (RangeCheck, core::panics::PanicResult::<(core::felt252,)>);