2019-11-27 09:44:40 +00:00
|
|
|
{
|
|
|
|
// Cost of rematerializating x is 1
|
|
|
|
let x := 0xff
|
|
|
|
// Although x has a low cost and fewer than 6 references,
|
|
|
|
// its references in a loop are not rematerialized
|
|
|
|
for {} lt(x, 0x100) {}
|
|
|
|
{
|
|
|
|
let y := add(x, 1)
|
|
|
|
for {} lt(x, 0x200) {}
|
|
|
|
{
|
|
|
|
let z := mul(x, 2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ----
|
2020-03-17 22:31:56 +00:00
|
|
|
// step: rematerialiser
|
|
|
|
//
|
2019-11-27 09:44:40 +00:00
|
|
|
// {
|
|
|
|
// let x := 0xff
|
2019-11-29 11:04:29 +00:00
|
|
|
// for { } lt(x, 0x100) { }
|
2019-11-27 09:44:40 +00:00
|
|
|
// {
|
2019-11-29 11:04:29 +00:00
|
|
|
// let y := add(x, 1)
|
|
|
|
// for { } lt(x, 0x200) { }
|
|
|
|
// { let z := mul(x, 2) }
|
2019-11-27 09:44:40 +00:00
|
|
|
// }
|
|
|
|
// }
|