solidity/test/cmdlineTests/optimizer_user_yul/input.sol

39 lines
519 B
Solidity
Raw Normal View History

2020-05-13 01:52:11 +00:00
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
contract C
{
2020-06-23 12:14:24 +00:00
constructor() payable
{
int a;
// Can't be optimized due to external reference "a"
assembly
{
let x,y,z
sstore(0, 1)
for { } sload(4) { } {
z := exp(x, y)
}
a := 2
}
// Can be optimized due to no external references
assembly
{
let x,y,z
sstore(2, 3)
for { } sload(5) { } {
// Expected to be optimized out for yulOptimizer, but not for
// old optimizer
z := exp(x, y)
}
}
}
}