mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-24 08:10:22 +01:00
pco: Fix encoding of branch to an empty block
When calculating the relative offset for a branch the pco_first_igrp function is used to find the first instruction of a block. However if the block is empty the function does not return NULL as it description implies but returns a pointer to the list head which is not a valid node. Using this leads to a garbage relative offset been calculated which leads to unexpected behaviour. Fix is to add a check for the list been empty and return NULL (the same issue also exists in pco_last_igrp). This leads to the calling function, pco_cf_node_offset, searching for the next none empty block which is the expected behaviour. Fix deqp: dEQP-VK.graphicsfuzz.cov-two-nested-loops-switch-case-matrix-array-increment dEQP-VK.graphicsfuzz.stable-binarysearch-tree-false-if-discard-loop Signed-off-by: Nick Hamilton <nick.hamilton@imgtec.com> Reviewed-by: Simon Perretta <simon.perretta@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39287>
This commit is contained in:
parent
371656de90
commit
68cb76de5d
1 changed files with 6 additions and 0 deletions
|
|
@ -1534,6 +1534,9 @@ static inline pco_instr *pco_prev_instr(pco_instr *instr)
|
|||
*/
|
||||
static inline pco_igrp *pco_first_igrp(pco_block *block)
|
||||
{
|
||||
if (list_is_empty(&block->instrs))
|
||||
return NULL;
|
||||
|
||||
return list_first_entry(&block->instrs, pco_igrp, link);
|
||||
}
|
||||
|
||||
|
|
@ -1545,6 +1548,9 @@ static inline pco_igrp *pco_first_igrp(pco_block *block)
|
|||
*/
|
||||
static inline pco_igrp *pco_last_igrp(pco_block *block)
|
||||
{
|
||||
if (list_is_empty(&block->instrs))
|
||||
return NULL;
|
||||
|
||||
return list_first_entry(&block->instrs, pco_igrp, link);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue