Skip to content

Missing substitution in the simplifier?

When creating a binding (in the function completeBind), we simplify the unfolding in the binder before making a float (in the case we don't inline anyway). However, it seems that the newly obtained final_bndr is not substituted:

      ; let final_bndr = addLetBndrInfo new_bndr new_arity is_bot new_unfolding
      ; if postInlineUnconditionally env top_lvl final_bndr occ_info final_rhs
        then [] -- abbreviated
        else -- Keep the binding
             -- pprTrace "Binding" (ppr final_bndr <+> ppr new_unfolding) $
             return (mkFloatBind env (NonRec final_bndr final_rhs)) }

(See in full context here)

This is awfully suspicious: the new_arity and the new_unfolding will, I understand, not be available at the binder's use sites (which is where they are to be used).

I don't know how to make evidence of the suspected bad behaviour. And maybe I'm just missing something, and everything is actually fine here.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information