microsoft / knossos-ksc

Compiler with automatic differentiation
Other
45 stars 10 forks source link

Don't duplicate ddt in `sufrevpass$add`. #833

Open awf opened 3 years ago

awf commented 3 years ago

Don't duplicate ddt in sufrevpass$add.

rewriteSUFRevPass P_ts_add _ (Tuple [ddr, Tuple []])
  -- FIXME: This is bad because it duplicates the expression ddr.  CSE
  -- will probably resolve this problem, but we shouldn't create it in
  -- the first place.

It's OK to just introduce a classic let, because sufrevpass does not need to be SUF.

Originally posted by @awf in https://github.com/microsoft/knossos-ksc/pull/766#r641018892