mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use proper type in conditional simplifier.
This commit is contained in:
parent
686b62b585
commit
edfd30bcb7
@ -79,9 +79,9 @@ void ConditionalSimplifier::operator()(Block& _block)
|
|||||||
{Identifier{location, condition}},
|
{Identifier{location, condition}},
|
||||||
make_unique<Expression>(Literal{
|
make_unique<Expression>(Literal{
|
||||||
location,
|
location,
|
||||||
LiteralKind::Number,
|
LiteralKind::Boolean,
|
||||||
"0"_yulstring,
|
"false"_yulstring,
|
||||||
{}
|
m_dialect.boolType
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
let y:bool := false
|
||||||
|
for {} true { } {
|
||||||
|
if y { break }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// dialect: yul
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
// ----
|
||||||
|
// {
|
||||||
|
// let y:bool := false
|
||||||
|
// for { } true { }
|
||||||
|
// {
|
||||||
|
// if y { break }
|
||||||
|
// y := false
|
||||||
|
// }
|
||||||
|
// }
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
let y:i32 := 0:i32
|
||||||
|
for {} true { } {
|
||||||
|
if y { break }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// dialect: ewasm
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
// ----
|
||||||
|
// {
|
||||||
|
// let y:i32 := 0:i32
|
||||||
|
// for { } true { }
|
||||||
|
// {
|
||||||
|
// if y { break }
|
||||||
|
// y := false
|
||||||
|
// }
|
||||||
|
// }
|
||||||
@ -12,6 +12,6 @@
|
|||||||
// for { } and(y, 8) { pop(y) }
|
// for { } and(y, 8) { pop(y) }
|
||||||
// {
|
// {
|
||||||
// if y { break }
|
// if y { break }
|
||||||
// y := 0
|
// y := false
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -12,6 +12,6 @@
|
|||||||
// for { } and(y, 8) { pop(y) }
|
// for { } and(y, 8) { pop(y) }
|
||||||
// {
|
// {
|
||||||
// if y { continue }
|
// if y { continue }
|
||||||
// y := 0
|
// y := false
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -14,9 +14,9 @@
|
|||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// let y := mload(0)
|
// let y := mload(0)
|
||||||
// if x { revert(0, 0) }
|
// if x { revert(0, 0) }
|
||||||
// x := 0
|
// x := false
|
||||||
// if y { revert(0, 0) }
|
// if y { revert(0, 0) }
|
||||||
// y := 0
|
// y := false
|
||||||
// for { } and(x, y) { }
|
// for { } and(x, y) { }
|
||||||
// { x := 2 }
|
// { x := 2 }
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
// for { } x { sstore(1, x) }
|
// for { } x { sstore(1, x) }
|
||||||
// {
|
// {
|
||||||
// if x { continue }
|
// if x { continue }
|
||||||
// x := 0
|
// x := false
|
||||||
// sstore(0, x)
|
// sstore(0, x)
|
||||||
// }
|
// }
|
||||||
// sstore(0, x)
|
// sstore(0, x)
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
// sstore(7, 8)
|
// sstore(7, 8)
|
||||||
// break
|
// break
|
||||||
// }
|
// }
|
||||||
// x := 0
|
// x := false
|
||||||
// sstore(10, x)
|
// sstore(10, x)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -13,6 +13,6 @@
|
|||||||
// sstore(0, x)
|
// sstore(0, x)
|
||||||
// revert(0, 0)
|
// revert(0, 0)
|
||||||
// }
|
// }
|
||||||
// x := 0
|
// x := false
|
||||||
// sstore(1, x)
|
// sstore(1, x)
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
// }
|
// }
|
||||||
// {
|
// {
|
||||||
// if y { continue }
|
// if y { continue }
|
||||||
// sstore(1, 0)
|
// sstore(1, false)
|
||||||
// }
|
// }
|
||||||
// if y { revert(0, 0) }
|
// if y { revert(0, 0) }
|
||||||
// }
|
// }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user