Use proper type in conditional simplifier.

This commit is contained in:
chriseth 2020-02-05 13:05:52 +01:00
parent 686b62b585
commit edfd30bcb7
10 changed files with 47 additions and 11 deletions

View File

@ -79,9 +79,9 @@ void ConditionalSimplifier::operator()(Block& _block)
{Identifier{location, condition}},
make_unique<Expression>(Literal{
location,
LiteralKind::Number,
"0"_yulstring,
{}
LiteralKind::Boolean,
"false"_yulstring,
m_dialect.boolType
})
}
);

View File

@ -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
// }
// }

View File

@ -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
// }
// }

View File

@ -12,6 +12,6 @@
// for { } and(y, 8) { pop(y) }
// {
// if y { break }
// y := 0
// y := false
// }
// }

View File

@ -12,6 +12,6 @@
// for { } and(y, 8) { pop(y) }
// {
// if y { continue }
// y := 0
// y := false
// }
// }

View File

@ -14,9 +14,9 @@
// let x := mload(0)
// let y := mload(0)
// if x { revert(0, 0) }
// x := 0
// x := false
// if y { revert(0, 0) }
// y := 0
// y := false
// for { } and(x, y) { }
// { x := 2 }
// }

View File

@ -16,7 +16,7 @@
// for { } x { sstore(1, x) }
// {
// if x { continue }
// x := 0
// x := false
// sstore(0, x)
// }
// sstore(0, x)

View File

@ -26,7 +26,7 @@
// sstore(7, 8)
// break
// }
// x := 0
// x := false
// sstore(10, x)
// }
// }

View File

@ -13,6 +13,6 @@
// sstore(0, x)
// revert(0, 0)
// }
// x := 0
// x := false
// sstore(1, x)
// }

View File

@ -24,7 +24,7 @@
// }
// {
// if y { continue }
// sstore(1, 0)
// sstore(1, false)
// }
// if y { revert(0, 0) }
// }