Overly clever constant folding

Timon Gehr timon.gehr at gmx.ch
Mon Dec 12 21:36:50 UTC 2022


On 12/12/22 03:13, Walter Bright wrote:
> On 12/11/2022 12:39 PM, deadalnix wrote:
>> why is constant folding done there to begin with?
> 
> How else are you going to have, for example, a static initializer 
> initialized with an expression? How about `static if (expression)` ?
> 
> How can you do optimization without constant folding?

I think his proposal was not to stop doing it altogether but to instead 
do a roundtrip through the backend for constant folding. (I guess SDC is 
doing CTFE by jitting with LLVM.)


More information about the Digitalmars-d mailing list