The theory here was to detect a temporary variable used within a loop,
and avoid considering it live across the entire loop. However, it was
overeager and failed when the first definition of the variable
appeared within the loop but was only conditionally defined.
Fixes glsl-fs-loop-redundant-condition.
if (inst->src[i].file == GRF && inst->src[i].reg != 0) {
int reg = inst->src[i].reg;
- if (!loop_depth || (this->virtual_grf_sizes[reg] == 1 &&
- def[reg] >= bb_header_ip)) {
+ if (!loop_depth) {
use[reg] = ip;
} else {
def[reg] = MIN2(loop_start, def[reg]);
if (inst->dst.file == GRF && inst->dst.reg != 0) {
int reg = inst->dst.reg;
- if (!loop_depth || (this->virtual_grf_sizes[reg] == 1 &&
- !inst->predicated)) {
+ if (!loop_depth) {
def[reg] = MIN2(def[reg], ip);
} else {
def[reg] = MIN2(def[reg], loop_start);