summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-02-04 21:38:28 -0800
committerJason Ekstrand <[email protected]>2015-02-19 17:06:17 -0800
commit902b0ccc9a5266955d104dc7652ac00e66081f95 (patch)
tree3a6dfa42a6990e99657b3549e38ee310cc6bdc3a /src/glsl
parent0281fd07865e6ff5c85032b403a073b50659c1ac (diff)
nir/from_ssa: Don't try to read an invalid instruction
Right now, the nir_instr_prev function function blindly looks up the previous element in the exec list and casts it to an instruction even if it's the tail sentinel. The next commit will change this to return null if it's the first instruction. Making this change first avoids getting a segfault between commits. The only reason we never noticed is that, thanks to the way things are laid out in nir_block, the casted instruction's type was never parallal_copy. Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir_from_ssa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_from_ssa.c b/src/glsl/nir/nir_from_ssa.c
index 3625237dd3d..7c500957767 100644
--- a/src/glsl/nir/nir_from_ssa.c
+++ b/src/glsl/nir/nir_from_ssa.c
@@ -272,7 +272,7 @@ get_parallel_copy_at_end_of_block(nir_block *block)
if (last_instr->type == nir_instr_type_jump)
last_instr = nir_instr_prev(last_instr);
- if (last_instr->type == nir_instr_type_parallel_copy)
+ if (last_instr && last_instr->type == nir_instr_type_parallel_copy)
return nir_instr_as_parallel_copy(last_instr);
else
return NULL;