Overly clever constant folding
Walter Bright
newshound2 at digitalmars.com
Mon Dec 12 02:13:00 UTC 2022
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?
> Today's optimizer are shockingly good at doing this kind of transformations
The optimizer is doing the constant folding.
> And if take a step back to the step back, we notice that this is where the "fill
> a bug report" approach fails.
Not filing a bug report means the bug will never get fixed. The n.g. is not a
practical bug reporting system (I know, I tried it in the early days of D).
> we should also stop inlining in there.
I do agree with that. In fact, I implemented it:
https://github.com/dlang/dmd/blob/master/compiler/src/dmd/backend/inliner.d
More information about the Digitalmars-d
mailing list