microsoft / knossos-ksc

Compiler with automatic differentiation
Other
45 stars 10 forks source link

Improve CSE assert comment? #420

Open toelli-msft opened 4 years ago

toelli-msft commented 4 years ago

@dcrc2 pointed out that this comment is a bit confusing.

https://github.com/microsoft/knossos-ksc/blob/5e1d2cdefd7271e728a8e936c03f8b3ff8d52ab7/src/ksc/CSE.hs#L127-L129

Should we drop the

-- Special case for (assert (e1 == e2) body)
-- where we want to CSE e2 into e1

and just refer the note? The note explains it better

Note [CSE of assert]
~~~~~~~~~~~~~~~~~~~~
When we encounter (assert (eq e1 e2) body) we would like to use the
information that e1 is equal to e2 to simplify body.  Therefore if e1
and e2 are both variables (say v1 and v2) we tweak the reverse map so
to change entries that used to say v1 to say v2 instead.
simonpj commented 4 years ago

Yes, find just to refer to the note