Benchmark: Costlang.Fold_constants: reduces let x = c in e when c is a constant
This introduces let x = const in e
=> e[const/x]
reduction to Costlang's constant folding transformer Fold_constants
.
This optimization is required for the correct benchmark dependency analysis by eliminating some coefficient variables multiplied by 0 of the intercept cases such as addlogadd
. It is like
fun size1 -> fun size2 ->
let a = size1 + size2 in
coeff * (a * log2 (1 + a)) + const
For the intercept case, size1
and size2
are fixed to 0
. However, currently they do not optimize coeff
out currently. Instead we have:
let a = 0 in
coeff * (a * log2 (1 + a)) + const
This makes the benchmarks of the non-intercept case and intercept case of N_IMul_int
and N_IMul_nat
ambiguous.
This MR expands let a = 0
and simplifies the above formula to a simple
const
and resolves the ambiguity of N_IMul_*
.
Edited by Jun Furuse