Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sway-ir/tests/cse/cse3.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ script {
v6v1 = const u64 0
br while(v6v1, v5v1)

while(mut v3v1: u64, mut v4v1: u64):
while(v3v1: u64, v4v1: u64):
- v8v1 = cmp lt v3v1 v4v1
+ v8v1 = cmp lt v3v1 v5v1
cbr v8v1, while_body(), end_while()
Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/dce/dce_cast_ptr.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ script {
entry(mut arg: u64):
br block0(arg)

block0(mut v12v1: __ptr u64):
block0(v12v1: __ptr u64):
v14v1 = load v12v1
ret u64 v14v1
}
Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/dce/dce_dead_arg1.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ script {
- br block0(v4v1)
+ br block0()

- block0(mut v1v1: bool):
- block0(v1v1: bool):
+ block0():
v6v1 = const bool false
- v7v1 = cmp eq v1v1 v6v1
Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/dce/dce_int_to_ptr.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ script {
v20v1 = ptr_to_int v19v1 to u64
br block2(v20v1)

block2(mut v1v1: u64):
block2(v1v1: u64):
v22v1 = int_to_ptr v1v1 to __ptr u64
v23v1 = const u64 42
store v23v1 to v22v1
Expand Down
4 changes: 2 additions & 2 deletions sway-ir/tests/demote_arg/demote_arg03.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ script {
+ store v21v1 to v31v1
+ br block2(v31v1)

- block2(mut v14v1: b256):
- block2(v14v1: b256):
- ret b256 v14v1
+ block2(mut v27v1: __ptr b256):
+ block2(v27v1: __ptr b256):
+ v28v1 = load v27v1
+ ret b256 v28v1
}
Expand Down
12 changes: 6 additions & 6 deletions sway-ir/tests/demote_arg/demote_arg04.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,26 @@ script {
- cbr v16v1, block1(v9v1, v17v1, v11v1), block2(v13v1, v17v1, v15v1)
+ cbr v16v1, block1(v30v1, v17v1, v32v1), block2(v38v1, v17v1, v40v1)

- block1(mut v1v1: b256, mut v2v1: bool, mut v3v1: b256):
- block1(v1v1: b256, v2v1: bool, v3v1: b256):
- br block3(v3v1)
+ block1(mut v26v1: __ptr b256, mut v2v1: bool, mut v28v1: __ptr b256):
+ block1(v26v1: __ptr b256, v2v1: bool, v28v1: __ptr b256):
+ v27v1 = load v26v1
+ v29v1 = load v28v1
+ v44v1 = get_local __ptr b256, __tmp_block_arg3
+ store v29v1 to v44v1
+ br block3(v44v1)

- block2(mut v4v1: b256, mut v5v1: bool, mut v6v1: b256):
- block2(v4v1: b256, v5v1: bool, v6v1: b256):
- br block3(v6v1)
+ block2(mut v34v1: __ptr b256, mut v5v1: bool, mut v36v1: __ptr b256):
+ block2(v34v1: __ptr b256, v5v1: bool, v36v1: __ptr b256):
+ v35v1 = load v34v1
+ v37v1 = load v36v1
+ v46v1 = get_local __ptr b256, __tmp_block_arg3
+ store v37v1 to v46v1
+ br block3(v46v1)

- block3(mut v7v1: b256):
+ block3(mut v42v1: __ptr b256):
- block3(v7v1: b256):
+ block3(v42v1: __ptr b256):
+ v43v1 = load v42v1
v21v1 = get_local __ptr b256, tmp
- store v7v1 to v21v1
Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/demote_ret/demote_ret01.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ script {
+ v49v1 = load v47v1
+ br block5(v49v1)

block5(mut v10v1: b256):
block5(v10v1: b256):
- ret b256 v10v1
+ store v10v1 to __ret_value
+ v28v1 = const unit ()
Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/fn_dedup/debug/debug-dce.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ script {
v8v1 = call foo_3(v6v1, v7v1), !8
br block1(v8v1), !5

block1(mut v1v1: bool):
block1(v1v1: bool):
ret bool v1v1
}

Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/fn_dedup/debug/debug-nodce.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ script {
v8v1 = call foo_3(v6v1, v7v1), !8
br block1(v8v1), !5

block1(mut v1v1: bool):
block1(v1v1: bool):
ret bool v1v1
}

Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/fn_dedup/release/release-dce.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ script {
v8v1 = call foo_3(v6v1, v7v1), !8
br block1(v8v1), !5

block1(mut v1v1: bool):
block1(v1v1: bool):
ret bool v1v1
}

Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/inline/bigger.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ script {
v10v1 = const u64 1
br block2(v10v1)

block2(mut v2v1: u64):
block2(v2v1: u64):
ret u64 v2v1
}

Expand Down
4 changes: 2 additions & 2 deletions sway-ir/tests/inline/by_block_and_instr_count.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ script {
v2v1 = const bool true
br block(v2v1)

block(mut v1v1: bool):
block(v1v1: bool):
v4v1 = const bool false
v5v1 = cmp eq v1v1 v4v1
v6v1 = cmp eq v4v1 v5v1
Expand All @@ -21,7 +21,7 @@ script {
v9v1 = const bool true
br block(v9v1)

block(mut v8v1: bool):
block(v8v1: bool):
v11v1 = const bool false
v12v1 = cmp eq v8v1 v11v1
v13v1 = cmp eq v11v1 v12v1
Expand Down
2 changes: 1 addition & 1 deletion sway-ir/tests/inline/by_block_count.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ script {
v4v1 = const bool true
br block(v4v1)

block(mut v3v1: bool):
block(v3v1: bool):
ret bool v3v1
}

Expand Down
4 changes: 2 additions & 2 deletions sway-ir/tests/inline/by_instr_count.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ script {
v4v1 = const u64 22
br block(v4v1)

block(mut v3v1: u64):
block(v3v1: u64):
ret u64 v3v1
}

Expand Down Expand Up @@ -59,7 +59,7 @@ script {
v32v1 = cmp eq v30v1 v31v1
br block(v32v1)

block(mut v23v1: bool):
block(v23v1: bool):
ret bool v23v1
}

Expand Down
6 changes: 3 additions & 3 deletions sway-ir/tests/inline/fiddly.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ script {
v6v1 = const bool true
br block2(v6v1)

block2(mut v2v1: bool):
block2(v2v1: bool):
ret bool v2v1
}

Expand All @@ -41,7 +41,7 @@ script {
+ block01(mut v18v1: bool):
+ cbr v18v1, block1(v18v1), block0(v18v1)
+
block0(mut v9v1: bool):
block0(v9v1: bool):
v14v1 = const bool false
- v15v1 = call not(v14v1)
- br block1(v15v1)
Expand All @@ -59,7 +59,7 @@ script {
+ block2(mut v23v1: bool):
+ br block1(v23v1)
+
block1(mut v10v1: bool):
block1(v10v1: bool):
ret bool v10v1
}
}
10 changes: 5 additions & 5 deletions sway-ir/tests/mem2reg/is_prime.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ script {
v78v1 = const unit ()
br block2(v78v1)

block2(mut v71v1: ()):
block2(v71v1: ()):
v80v1 = const unit ()
ret () v80v1
}
Expand Down Expand Up @@ -129,7 +129,7 @@ script {
v100v1 = call eq_5(n, v99v1), !64
br block1(v100v1), !62

block1(mut v93v1: bool):
block1(v93v1: bool):
cbr v93v1, block2(), block3(), !62

block2():
Expand Down Expand Up @@ -190,8 +190,8 @@ script {
- br block6(v133v1)
+ br block6(v133v1, v163v1, v166v1)

- block6(mut v94v1: ()):
+ block6(mut v94v1: (), mut v164v1: u64, mut v165v1: bool):
- block6(v94v1: ()):
+ block6(v94v1: (), mut v164v1: u64, mut v165v1: bool):
v135v1 = get_local __ptr u64, i, !81
v136v1 = get_local __ptr u64, i, !82
- v137v1 = load v136v1, !82
Expand All @@ -202,7 +202,7 @@ script {
+ v139v1 = call add_7(v164v1, v138v1), !84
+ br while(v139v1, v165v1)

block7(mut v95v1: bool):
block7(v95v1: bool):
ret bool v95v1
}

Expand Down
8 changes: 4 additions & 4 deletions sway-ir/tests/mem2reg/while_loops.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ script {
- br block5(v63v1)
+ br block5(v63v1, v55v1, v61v1)

- block5(mut v1v1: ()):
- block5(v1v1: ()):
- br while0()
+ block5(mut v1v1: (), mut v154v1: u64, mut v156v1: u64):
+ block5(v1v1: (), mut v154v1: u64, mut v156v1: u64):
+ br while0(v154v1, v156v1)

block6():
Expand All @@ -123,7 +123,7 @@ script {
+ v69v1 = call eq_5(v157v1, v68v1), !42
br block7(v69v1), !29

block7(mut v2v1: bool):
block7(v2v1: bool):
v71v1 = call assert_2(v2v1), !15
v72v1 = get_local __ptr u64, counter_4, !43
- v73v1 = const u64 0, !44
Expand Down Expand Up @@ -250,7 +250,7 @@ script {
v139v1 = const unit ()
br block2(v139v1)

block2(mut v132v1: ()):
block2(v132v1: ()):
v141v1 = const unit ()
ret () v141v1
}
Expand Down
4 changes: 2 additions & 2 deletions sway-ir/tests/serialize/metadata.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ script {
v3v1 = const bool true, !2
cbr v3v1, block1(v3v1), block0(v3v1), !3

block0(mut v1v1: bool):
block0(v1v1: bool):
v5v1 = call f(), !4
br block1(v5v1), !3

block1(mut v2v1: bool):
block1(v2v1: bool):
ret bool v2v1
}

Expand Down
12 changes: 6 additions & 6 deletions sway-ir/tests/simplify_cfg/dead_blocks.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ script {
store v7v1 to v6v1
- br block1(v7v1)
-
- block0(mut v1v1: u64):
- block0(v1v1: u64):
- v10v1 = const u64 22
- store v10v1 to v6v1
- br block1(v10v1)
-
- block1(mut v2v1: u64):
- block1(v2v1: u64):
v13v1 = const u64 33
ret u64 v13v1
}
Expand All @@ -35,7 +35,7 @@ script {
v19v1 = const u64 333
br block1(v19v1)

block1(mut v16v1: u64):
block1(v16v1: u64):
ret bool b
}

Expand All @@ -51,7 +51,7 @@ script {
v27v1 = const u64 333
br block2(v27v1)

block2(mut v23v1: u64):
block2(v23v1: u64):
ret bool b
}

Expand All @@ -65,10 +65,10 @@ script {
- br block1(v35v1)
+ br block2(v35v1)

- block1(mut v31v1: u64):
- block1(v31v1: u64):
- br block2(v31v1)
-
block2(mut v32v1: u64):
block2(v32v1: u64):
ret bool b
}
}
6 changes: 3 additions & 3 deletions sway-ir/tests/simplify_cfg/merge_all_blocks.ir.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ script {
v6v1 = cmp eq v4v1 v5v1
- br block0(v6v1)
-
- block0(mut v1v1: bool):
- block0(v1v1: bool):
v8v1 = const u64 22
v9v1 = cmp eq v8v1 v5v1
- br block1(v9v1)
-
- block1(mut v2v1: bool):
- block1(v2v1: bool):
v11v1 = const u64 33
v12v1 = cmp eq v11v1 v5v1
- br block2(v12v1)
-
- block2(mut v3v1: bool):
- block2(v3v1: bool):
- ret bool v3v1
+ ret bool v12v1
}
Expand Down
16 changes: 4 additions & 12 deletions sway-lib-std/src/array_conversions/b256.sw
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ impl b256 {
/// }
/// ```
pub fn to_le_bytes(self) -> [u8; 32] {
let (a, b, c, d): (u64, u64, u64, u64) = asm(r1: self) {
r1: (u64, u64, u64, u64)
};
let (a, b, c, d): (u64, u64, u64, u64) = __transmute::<b256, (u64, u64, u64, u64)>(self);
let a = a.to_le_bytes();
let b = b.to_le_bytes();
let c = c.to_le_bytes();
Expand Down Expand Up @@ -85,9 +83,7 @@ impl b256 {

let result = (d, c, b, a);

asm(r1: result) {
r1: b256
}
__transmute::<(u64, u64, u64, u64), b256>(result)
}

/// Converts the `b256` to a sequence of big-endian bytes.
Expand All @@ -111,9 +107,7 @@ impl b256 {
/// }
/// ```
pub fn to_be_bytes(self) -> [u8; 32] {
let (a, b, c, d): (u64, u64, u64, u64) = asm(r1: self) {
r1: (u64, u64, u64, u64)
};
let (a, b, c, d): (u64, u64, u64, u64) = __transmute::<b256, (u64, u64, u64, u64)>(self);
let a = a.to_be_bytes();
let b = b.to_be_bytes();
let c = c.to_be_bytes();
Expand Down Expand Up @@ -168,8 +162,6 @@ impl b256 {

let result = (a, b, c, d);

asm(r1: result) {
r1: b256
}
__transmute::<(u64, u64, u64, u64), b256>(result)
}
}
Loading
Loading