Because of the way type analysis is done, an integer/float literal that's used anywhere creates two instructions:
In step 1 (HirGen.zig reduction):
%0 = int(1234)
%1 = coerce(@Ref.u32, %0)
In step 2 (type_analysis.zig):
%0 = constant(@Ref.comptime_uint, 1234)
%1 = constant(@Ref.u32, 1234)
After type analysis, instruction %0 (the comptime_uint) constant is no longer needed, and is distracting. It's not breaking anything right now, but does need to be skipped. It would be nice to only have one relevant constant for i.e. top level declaration block_inline.
We should adapt the currently disabled dead_code_elimination into a dead_constant_elimination that removes the unused constants.
Because of the way type analysis is done, an integer/float literal that's used anywhere creates two instructions:
In step 1 (HirGen.zig reduction):
%0 = int(1234)
%1 = coerce(@Ref.u32, %0)
In step 2 (type_analysis.zig):
%0 = constant(@Ref.comptime_uint, 1234)
%1 = constant(@Ref.u32, 1234)
After type analysis, instruction %0 (the comptime_uint) constant is no longer needed, and is distracting. It's not breaking anything right now, but does need to be skipped. It would be nice to only have one relevant constant for i.e. top level declaration block_inline.
We should adapt the currently disabled dead_code_elimination into a dead_constant_elimination that removes the unused constants.