Note [CSE for join points?]
We must not be naive about join points in CSE: join j = e in if b then jump j else 1 + e The expression (1 + jump j) is not good (see Note [Invariants on join points] in GHC.Core). This seems to come up quite seldom, but it happens (first seen compiling ppHtml in Haddock.Backends.Xhtml). We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. (#13219)
References 1
- Invariants on join points GHC.Core
Referenced by 1
- GHC.Core.Opt.CSE call site