nv50/ir: make a copy of tex src if it's referenced multiple times
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 10 Apr 2018 02:19:35 +0000 (22:19 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Mon, 23 Apr 2018 03:03:16 +0000 (23:03 -0400)
commit5428066f5e1ef5ea6ae04c84019f270023cfc6aa
treeb4a4e2bfbacd5f913e51b90a209ae162e307cdb5
parent6c5abb68c79d4acf71112b5ba4924a5af2d1e5c9
nv50/ir: make a copy of tex src if it's referenced multiple times

For nv50 we coalesce the srcs and defs into a single node. As such, we
can end up with impossible constraints if the source is referenced
after the tex operation (which, due to the coalescing of values, will
have overwritten it).

This logic already exists for inserting moves for MERGE/UNION sources.
It's the exact same idea here, so leverage that code, which also
includes a few optimizations around not extending live ranges
unnecessarily.

Fixes tests/spec/glsl-1.30/execution/fs-textureSize-components.shader_test

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp