Skip to content

gpu_shader_fp64: Initialize function-local array to prevent compiler optimizations from undefs

Jesse Natalie requested to merge jenatali/piglit:indirect-temp-double into main

Without this, with a Mesa driver using the nir linker, the nir_vars_to_ssa pass will see that the load will be undef if pick and pick2 aren't the same. Then, nir_remove_dead_variables will see that the function-local array is then only used for stores, and is unneeded. After more optimizations, both pick and pick2 are considered unused and are removed. Thus, Mesa doesn't see those variables, and the test fails when it can't assign values to them.

Open question: Is this a Mesa bug for being too smart with these optimizations?

Merge request reports