Skip to content

nir: Don't reassociate add/mul chains containing only constants

Kenneth Graunke requested to merge kwg/mesa:subpass into master

The idea here is to reassociate a * (b * c) into (a * c) * b, when b is a non-constant value, but a and c are constants, allowing them to be combined.

But nothing was enforcing that 'b' must be non-constant, which meant that running opt_algebraic in a loop would never terminate if the IR contained non-folded constant expressions like 256 * 0.5 * 2. Normally, we call constant folding in such a loop too, but IMO it's better for nir_opt_algebraic to be robust and not rely on that.

Bugzilla: Fixes: 32e266a9 i965: Compile fp64 funcs only if we do not have 64-bit hardware support

Merge request reports