IR: /*=====================================================* * WARNING * * Solidity to Yul compilation is still EXPERIMENTAL * * It can result in LOSS OF FUNDS or worse * * !USE AT YOUR OWN RISK! * *=====================================================*/ /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2" { code { /// @src 0:265:278 "contract C {}" mstore(64, memoryguard(128)) if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } constructor_C_2() let _1 := allocate_unbounded() codecopy(_1, dataoffset("C_2_deployed"), datasize("C_2_deployed")) return(_1, datasize("C_2_deployed")) function allocate_unbounded() -> memPtr { memPtr := mload(64) } function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { revert(0, 0) } /// @src 0:265:278 "contract C {}" function constructor_C_2() { /// @src 0:265:278 "contract C {}" } /// @src 0:265:278 "contract C {}" } /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2_deployed" { code { /// @src 0:265:278 "contract C {}" mstore(64, memoryguard(128)) revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() function shift_right_224_unsigned(value) -> newValue { newValue := shr(224, value) } function allocate_unbounded() -> memPtr { memPtr := mload(64) } function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { revert(0, 0) } } data ".metadata" hex"" } } Optimized IR: /*=====================================================* * WARNING * * Solidity to Yul compilation is still EXPERIMENTAL * * It can result in LOSS OF FUNDS or worse * * !USE AT YOUR OWN RISK! * *=====================================================*/ /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2" { code { { /// @src 0:265:278 "contract C {}" let _1 := memoryguard(0x80) mstore(64, _1) if callvalue() { revert(0, 0) } let _2 := datasize("C_2_deployed") codecopy(_1, dataoffset("C_2_deployed"), _2) return(_1, _2) } } /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2_deployed" { code { { /// @src 0:265:278 "contract C {}" mstore(64, memoryguard(0x80)) revert(0, 0) } } data ".metadata" hex"" } } IR: /*=====================================================* * WARNING * * Solidity to Yul compilation is still EXPERIMENTAL * * It can result in LOSS OF FUNDS or worse * * !USE AT YOUR OWN RISK! * *=====================================================*/ /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "D_27" { code { /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." mstore(64, memoryguard(128)) if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } constructor_D_27() let _1 := allocate_unbounded() codecopy(_1, dataoffset("D_27_deployed"), datasize("D_27_deployed")) return(_1, datasize("D_27_deployed")) function allocate_unbounded() -> memPtr { memPtr := mload(64) } function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { revert(0, 0) } /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." function constructor_D_27() { /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." } /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." } /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "D_27_deployed" { code { /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." mstore(64, memoryguard(128)) if iszero(lt(calldatasize(), 4)) { let selector := shift_right_224_unsigned(calldataload(0)) switch selector case 0x26121ff0 { // f() if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } abi_decode_tuple_(4, calldatasize()) let ret_0 := fun_f_26() let memPos := allocate_unbounded() let memEnd := abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack(memPos , ret_0) return(memPos, sub(memEnd, memPos)) } default {} } revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() function shift_right_224_unsigned(value) -> newValue { newValue := shr(224, value) } function allocate_unbounded() -> memPtr { memPtr := mload(64) } function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { revert(0, 0) } function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { revert(0, 0) } function abi_decode_tuple_(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } function array_length_t_string_memory_ptr(value) -> length { length := mload(value) } function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos { mstore(pos, length) updated_pos := add(pos, 0x20) } function copy_memory_to_memory(src, dst, length) { let i := 0 for { } lt(i, length) { i := add(i, 32) } { mstore(add(dst, i), mload(add(src, i))) } if gt(i, length) { // clear end mstore(add(dst, length), 0) } } function round_up_to_mul_of_32(value) -> result { result := and(add(value, 31), not(31)) } function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end { let length := array_length_t_string_memory_ptr(value) pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) copy_memory_to_memory(add(value, 0x20), pos, length) end := add(pos, round_up_to_mul_of_32(length)) } function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack(headStart , value0) -> tail { tail := add(headStart, 32) mstore(add(headStart, 0), sub(tail, headStart)) tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail) } function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { revert(0, 0) } function zero_value_for_split_t_string_memory_ptr() -> ret { ret := 96 } function panic_error_0x41() { mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856) mstore(4, 0x41) revert(0, 0x24) } function abi_encode_tuple__to__fromStack(headStart ) -> tail { tail := add(headStart, 0) } function revert_forward_1() { let pos := allocate_unbounded() returndatacopy(pos, 0, returndatasize()) revert(pos, returndatasize()) } function finalize_allocation(memPtr, size) { let newFreePtr := add(memPtr, round_up_to_mul_of_32(size)) // protect against overflow if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() } mstore(64, newFreePtr) } function allocate_memory(size) -> memPtr { memPtr := allocate_unbounded() finalize_allocation(memPtr, size) } function array_allocation_size_t_string_memory_ptr(length) -> size { // Make sure we can allocate memory without overflow if gt(length, 0xffffffffffffffff) { panic_error_0x41() } size := round_up_to_mul_of_32(length) // add length slot size := add(size, 0x20) } function allocate_memory_array_t_string_memory_ptr(length) -> memPtr { let allocSize := array_allocation_size_t_string_memory_ptr(length) memPtr := allocate_memory(allocSize) mstore(memPtr, length) } function store_literal_in_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50(memPtr) { mstore(add(memPtr, 0), "/*") } function copy_literal_to_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50() -> memPtr { memPtr := allocate_memory_array_t_string_memory_ptr(2) store_literal_in_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50(add(memPtr, 32)) } function convert_t_stringliteral_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50_to_t_string_memory_ptr() -> converted { converted := copy_literal_to_memory_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50() } function store_literal_in_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b(memPtr) { mstore(add(memPtr, 0), 0x2f2a2a204073726320303a39363a313635202022636f6e74726163742044207b) mstore(add(memPtr, 32), 0x2e2e2e22202a2f00000000000000000000000000000000000000000000000000) } function copy_literal_to_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b() -> memPtr { memPtr := allocate_memory_array_t_string_memory_ptr(39) store_literal_in_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b(add(memPtr, 32)) } function convert_t_stringliteral_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b_to_t_string_memory_ptr() -> converted { converted := copy_literal_to_memory_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b() } /// @ast-id 26 /// @src 0:336:597 "function f() /* @use-src 0:\"input.sol\", 1:\"#utility.yul\" @ast-id 15 *\/ public returns (string memory) { C c = new /// @src 0:149:156 \"new C()\"..." function fun_f_26() -> var__5_mpos { /// @src 0:423:436 "string memory" let zero_t_string_memory_ptr_1_mpos := zero_value_for_split_t_string_memory_ptr() var__5_mpos := zero_t_string_memory_ptr_1_mpos /// @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..." let _2 := allocate_unbounded() let _3 := add(_2, datasize("C_2")) if or(gt(_3, 0xffffffffffffffff), lt(_3, _2)) { panic_error_0x41() } datacopy(_2, dataoffset("C_2"), datasize("C_2")) _3 := abi_encode_tuple__to__fromStack(_3) let expr_13_address := create(0, _2, sub(_3, _2)) if iszero(expr_13_address) { revert_forward_1() } /// @src 0:440:491 "C c = new /// @src 0:149:156 \"new C()\"..." let var_c_9_address := expr_13_address /// @src 0:493:494 "c" let _4_address := var_c_9_address let expr_15_address := _4_address /// @src 0:504:526 "string memory s = \"/*\"" let var_s_18_mpos := convert_t_stringliteral_c077635d0709aa1fd7cea2045028c270f982d687d1647e48e759eec32ec54a50_to_t_string_memory_ptr() /// @src 0:528:529 "s" let _5_mpos := var_s_18_mpos let expr_21_mpos := _5_mpos /// @src 0:531:581 "return \"/** @src 0:96:165 \\\"contract D {...\\\" *\/\"" var__5_mpos := convert_t_stringliteral_5bde9a896e3f09acac1496d16642fcdd887d2a000bf1ab18bdff3f17b91e320b_to_t_string_memory_ptr() leave } /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." } /*=====================================================* * WARNING * * Solidity to Yul compilation is still EXPERIMENTAL * * It can result in LOSS OF FUNDS or worse * * !USE AT YOUR OWN RISK! * *=====================================================*/ /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2" { code { /// @src 0:265:278 "contract C {}" mstore(64, memoryguard(128)) if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } constructor_C_2() let _1 := allocate_unbounded() codecopy(_1, dataoffset("C_2_deployed"), datasize("C_2_deployed")) return(_1, datasize("C_2_deployed")) function allocate_unbounded() -> memPtr { memPtr := mload(64) } function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { revert(0, 0) } /// @src 0:265:278 "contract C {}" function constructor_C_2() { /// @src 0:265:278 "contract C {}" } /// @src 0:265:278 "contract C {}" } /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2_deployed" { code { /// @src 0:265:278 "contract C {}" mstore(64, memoryguard(128)) revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() function shift_right_224_unsigned(value) -> newValue { newValue := shr(224, value) } function allocate_unbounded() -> memPtr { memPtr := mload(64) } function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { revert(0, 0) } } data ".metadata" hex"" } } data ".metadata" hex"" } } Optimized IR: /*=====================================================* * WARNING * * Solidity to Yul compilation is still EXPERIMENTAL * * It can result in LOSS OF FUNDS or worse * * !USE AT YOUR OWN RISK! * *=====================================================*/ /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "D_27" { code { { /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." let _1 := memoryguard(0x80) mstore(64, _1) if callvalue() { revert(0, 0) } let _2 := datasize("D_27_deployed") codecopy(_1, dataoffset("D_27_deployed"), _2) return(_1, _2) } } /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "D_27_deployed" { code { { /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." let _1 := memoryguard(0x80) mstore(64, _1) if iszero(lt(calldatasize(), 4)) { let _2 := 0 if eq(0x26121ff0, shr(224, calldataload(_2))) { if callvalue() { revert(_2, _2) } if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) } /// @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..." let _3 := datasize("C_2") let _4 := add(_1, _3) if or(gt(_4, 0xffffffffffffffff), lt(_4, _1)) { panic_error_0x41() } datacopy(_1, dataoffset("C_2"), _3) if iszero(create(/** @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." */ _2, /** @src 0:446:491 "new /// @src 0:149:156 \"new C()\"..." */ _1, sub(_4, _1))) { /// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..." let pos := mload(64) returndatacopy(pos, _2, returndatasize()) revert(pos, returndatasize()) } mstore(add(allocate_memory_array_string(), 32), "/*") let memPtr := allocate_memory_array_string_480() mstore(add(memPtr, 32), 0x2f2a2a204073726320303a39363a313635202022636f6e74726163742044207b) mstore(add(memPtr, 64), shl(200, 0x2e2e2e22202a2f)) let memPos := mload(64) return(memPos, sub(abi_encode_string(memPos, memPtr), memPos)) } } revert(0, 0) } function abi_encode_string(headStart, value0) -> tail { let _1 := 32 mstore(headStart, _1) let length := mload(value0) mstore(add(headStart, _1), length) let i := 0 for { } lt(i, length) { i := add(i, _1) } { mstore(add(add(headStart, i), 64), mload(add(add(value0, i), _1))) } if gt(i, length) { mstore(add(add(headStart, length), 64), 0) } tail := add(add(headStart, and(add(length, 31), not(31))), 64) } function panic_error_0x41() { mstore(0, shl(224, 0x4e487b71)) mstore(4, 0x41) revert(0, 0x24) } function allocate_memory_array_string() -> memPtr { let memPtr_1 := mload(64) let newFreePtr := add(memPtr_1, 64) if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr_1)) { panic_error_0x41() } mstore(64, newFreePtr) memPtr := memPtr_1 mstore(memPtr_1, 2) } function allocate_memory_array_string_480() -> memPtr { let memPtr_1 := mload(64) let newFreePtr := add(memPtr_1, 96) if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr_1)) { panic_error_0x41() } mstore(64, newFreePtr) memPtr := memPtr_1 mstore(memPtr_1, 39) } } /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2" { code { { /// @src 0:265:278 "contract C {}" let _1 := memoryguard(0x80) mstore(64, _1) if callvalue() { revert(0, 0) } let _2 := datasize("C_2_deployed") codecopy(_1, dataoffset("C_2_deployed"), _2) return(_1, _2) } } /// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol" object "C_2_deployed" { code { { /// @src 0:265:278 "contract C {}" mstore(64, memoryguard(0x80)) revert(0, 0) } } data ".metadata" hex"" } } data ".metadata" hex"" } }