google-research / dex-lang

Research language for array processing in the Haskell/ML family
BSD 3-Clause "New" or "Revised" License
1.58k stars 106 forks source link

Flush imp destination passing #1276

Closed axch closed 1 year ago

axch commented 1 year ago

The Imp pass has not done long-range destination passing for some time. Every destination passed to a Block was always interpreted as applying only to the result of the block (i.e., Imp did not have an equivalent to decomposeDest from Lower). Since block results are Atoms, no non-Atom expression ever got a non-Nothing destination passed to it in Imp. Ergo, the only thing all the Maybe Dest arguments were accomplishing was supporting the handful of constructs that can return values in SimpIR but cannot return values in Imp (i.e., case, runWriter, runState) by locally allocating a destination and immediately writing to it. So this PR just deletes all that machinery and codes that locally.