Dead Code Elimination

Walter Bright newshound2 at digitalmars.com
Mon Oct 19 07:50:10 UTC 2026


On 10/19/2026 12:04 AM, Alexandru Ermicioi wrote:
> On Monday, 19 October 2026 at 06:46:13 UTC, Walter Bright wrote:
>> dmd -c -vasm -O -m32 dead.d:
> 
> So is it just 32 bit only?

See https://github.com/dlang/dmd/pull/24074

The alwaysframe is specific to OSX64.

But it does eliminate the dead code due to a DFA optimization called "constant 
propagation". There's a persistent belief that DMD does not do data flow 
analysis optimizations.

DMD does rely on the linker to remove unused functions, because the separate 
compilation model means one doesn't not know if a function gets called or not. 
Only the linker has the full information.


More information about the Digitalmars-d mailing list