Skip to content

Tinker with the "cbv-primops"

Matthew Craven requested to merge clyring/ghc:cbv-primops into master

Implements #21781. See also discussion at #21207.

Since !8840 (closed) we always run the tag-invariant-rewrite pass so there is no need to fuss with a separate wrapper.

This patch adds a cbv-primops mechanism which abstracts over some of what our two argument-evaluating primops (dataToTag# and seq#) have in common, and simplifies their handling in code generation. Unfortunately, the two do not use quite the same mechanism, because rewriting seq# x s to case x of x' { __DEFAULT -> seq# x' s } would cause us to generate worse code when seq# appears in tail position, so this patch instead rewrites seq# x s to x. See the new Note [cbv-primops] and Note [Rewriting SeqOp].

Edited by Matthew Craven

Merge request reports