diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2020-01-15 11:51:58 -0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-29 18:25:36 +0000 |
commit | 8548fe19f03ecaee711ed9041be3dc05c7c22e56 (patch) | |
tree | da206194979eae5d371cd9c193f9257a2313cac8 /src/amd/compiler/aco_assembler.cpp | |
parent | db19e96c8c63ee266fee37d3eb634b0ca30a28ab (diff) |
nir: Make nir_deref_path_init skip trivial casts
In a NIR generated using SPIR-V initializers to variables, copy
propagation can end up transforming
vec1 32 ssa_33 = deref_var &@1 (shared mat2x4)
vec1 32 ssa_35 = mov ssa_33
vec1 32 ssa_7 = deref_cast (mat2x4 *)ssa_35 (shared mat2x4) /* ptr_stride=0 */
into
vec1 32 ssa_33 = deref_var &@1 (shared mat2x4)
vec1 32 ssa_7 = deref_cast (mat2x4 *)ssa_33 (shared mat2x4) /* ptr_stride=0 */
Before the optimization, the "head" of a path of deref that uses ssa_7
will be the cast. After, it will be the variable in ssa_33. Since
the types are the same, this is a trivial cast that would be picked up
by nir_opt_deref.
If we need to compare such deref-chain after optimization with another
deref-chain for the same variable, the compare function will get
confused by the cast in the middle.
One alternative would be to add nir_opt_deref to places that compare
derefs, but that might not scale well, so skip the trivial casts when
generating the paths instead.
Motivated by the discussion in
https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3047#note_383660.
Reviewed-by: Jason Ekstrand <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3420>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3420>
Diffstat (limited to 'src/amd/compiler/aco_assembler.cpp')
0 files changed, 0 insertions, 0 deletions