Skip to content
Commit e49d7abf authored by Faith Ekstrand's avatar Faith Ekstrand Committed by Juan A. Suarez Romero
Browse files

nir/lower_vec_to_movs: Only coalesce if the vec had a SSA destination

Otherwise we may end up trying to coalesce in a case such as

ssa_1 = fadd r1, r2
r3.x = fneg(r2);
r3 = vec4(ssa_1, ssa_1.y, ...)

and that would cause us to move the writes to r3 from the vec to the
fadd which would re-order them with respect to the write from the fneg.
In order to solve this, we just don't coalesce if the destination of the
vec is not SSA.  We could try to get clever and still coalesce if there
are no writes to the destination of the vec between the vec and the ALU
source.  However, since registers only come from phi webs and indirects,
the chances of having a vec with a register destination that is actually
coalescable into its source is very slim.

Shader-db results on Haswell:

    total instructions in shared programs: 13657906 -> 13659101 (<.01%)
    instructions in affected programs: 149291 -> 150486 (0.80%)
    helped: 0
    HURT: 592

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105440


Fixes: 2458ea95 "nir/lower_vec_to_movs: Coalesce movs on-the-fly when possible"
Reported-by: default avatarVadym Shovkoplias <vadym.shovkoplias@globallogic.com>
Tested-by: default avatarVadym Shovkoplias <vadym.shovkoplias@globallogic.com>
Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
(cherry picked from commit 800df942)
parent 1ec91665
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment