Skip to content

Commit 0a9d752

Browse files
committed
Add test case and adjust tests.
1 parent ce0a3e9 commit 0a9d752

File tree

12 files changed

+423
-22
lines changed

12 files changed

+423
-22
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--experimental-via-ir --optimize --asm
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// SPDX-License-Identifier: GPL-3.0
2+
pragma solidity >0.0.0;
3+
4+
contract C {
5+
constructor(uint x) {
6+
// In earlier versions of the compiler, the resulting assembly pushed the constant
7+
// 0xFFFFFFFFFFFFFFFF42 directly in the subassembly of D, while it was optimized to
8+
// ``sub(shl(0x48, 0x01), 0xbe)`` when C was compiled in isolation.
9+
// Now the assembly is expected to contain two instances of ``sub(shl(0x48, 0x01), 0xbe)``,
10+
// one in the creation code of ``C`` directly, one in a subassembly of ``D``.
11+
// The constant 0xFFFFFFFFFFFFFFFF42 should not occur in the assembly output at all.
12+
if (x == 0xFFFFFFFFFFFFFFFF42)
13+
revert();
14+
}
15+
}
16+
contract D {
17+
function f() public pure returns (bytes memory) {
18+
return type(C).creationCode;
19+
}
20+
}

0 commit comments

Comments
 (0)