ControlCplusControlV / Scribe

Minimal Yul Transpilation to the Miden VM
GNU General Public License v3.0
51 stars 4 forks source link

Dead Memory #48

Open ControlCplusControlV opened 1 year ago

ControlCplusControlV commented 1 year ago

Dead Memory

If a value is stored in memory, once it's location is never read from again the compiler can consider that memory as "free," and overwrite it

Test Cases

  1. Yul Input

    {
    let x:u32 := 700
    mstore(0x100, x)
    
    let z := mload(0x100)
    let y:u32 := 100
    
    let a := add(z, y)
    mstore(0x200, a)
    }
  2. Assembly Output

    //Should store `a` at memory slot 0x100