Skip to content

nir: Use alu source components count in nir_alu_srcs_negative_equal

When we use source from ALU instruction directly, the default swizzle array should be populated with the same amount of components as the src has.

Otherwise, if we use nir_ssa_alu_instr_src_components, it can return the destination components count that is lower than component index actually used in that source. This can lead to false equality between 0 (uninitialized) and 0 (.x) in swizzle comparison below.

For example, this problem can happen when running nir_opt_comparison_pre with the following instructions:

vec1  1 ssa_40 = flt! ssa_37, ssa_39.y
if ssa_40 {
   vec1 32 ssa_41 = fneg ssa_39.x
   vec1 32 ssa_42 = fadd ssa_37, ssa_41
}

Fixes: c6ee46a7 ("nir: Add nir_alu_srcs_negative_equal") Closes: #8704 (closed) Signed-off-by: Sviatoslav Peleshko sviatoslav.peleshko@globallogic.com

Merge request reports