mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 16:00:09 +01:00
i965/vs: Fix invalid array access in copy propagation.
Accessing virtual_grf_reg_map[inst->dst.reg] is invalid if
inst->dst.file != GRF. Since is_direct_copy already implies a GRF
destination, we can just move the check earlier.
Fixes a regression in commit 07ee9f374f.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44302
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
de88e00c94
commit
7ccf04ebcf
1 changed files with 17 additions and 16 deletions
|
|
@ -297,23 +297,24 @@ vec4_visitor::opt_copy_propagation()
|
|||
}
|
||||
|
||||
/* Track available source registers. */
|
||||
const int reg = virtual_grf_reg_map[inst->dst.reg] + inst->dst.reg_offset;
|
||||
|
||||
/* Update our destination's current channel values. For a direct copy,
|
||||
* the value is the newly propagated source. Otherwise, we don't know
|
||||
* the new value, so clear it.
|
||||
*/
|
||||
bool direct_copy = is_direct_copy(inst);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (inst->dst.writemask & (1 << i)) {
|
||||
cur_value[reg][i] = direct_copy ? &inst->src[0] : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the records for any registers whose current value came from
|
||||
* our destination's updated channels, as the two are no longer equal.
|
||||
*/
|
||||
if (inst->dst.file == GRF) {
|
||||
const int reg =
|
||||
virtual_grf_reg_map[inst->dst.reg] + inst->dst.reg_offset;
|
||||
|
||||
/* Update our destination's current channel values. For a direct copy,
|
||||
* the value is the newly propagated source. Otherwise, we don't know
|
||||
* the new value, so clear it.
|
||||
*/
|
||||
bool direct_copy = is_direct_copy(inst);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (inst->dst.writemask & (1 << i)) {
|
||||
cur_value[reg][i] = direct_copy ? &inst->src[0] : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear the records for any registers whose current value came from
|
||||
* our destination's updated channels, as the two are no longer equal.
|
||||
*/
|
||||
if (inst->dst.reladdr)
|
||||
memset(cur_value, 0, sizeof(cur_value));
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue