Which optimization applies to this code?
Every leaf names the precondition that makes the transformation legal and the thing it costs. An optimization without its precondition is a superstition, and one without its cost is a sales pitch — which is why no leaf here says only "this is faster".
How should this language be implemented?Which optimization applies to this code?Should I build a DSL?
Are all the operands of the expression known at compile time?
Known means literal, or provably a single constant on every path that reaches this point — which is what constant propagation computes. A value that is constant on one branch does not qualify.