It was noticed in #20134 that each simplifier iteration used an increasing amount of memory and that a certain portion of memory was not released until the simplfier had completely finished.
I profiled the program using
-hi profiling and observed that there was
a thunk arising in the computation of
ug_boring_ok. On each iteration
ug_boring_ok would be updated, but not forced, which would leave a
thunk in the shape of
ug_boring_ok = inlineBoringOk expr0 || inlineBoringOk expr2 || inlineBoringOk expr3 || ...
which would retain all previous
ug_boring_ok was forced
Forcing this accumulator eagerly results in a flat profile over multiple simplifier runs.
This reduces the maximum residency when compiling the test in #20134 from 2GB to 1.3G.