[Mesa-dev] [PATCH] nir/validate: Ensure that phi sources are SSA-only

Connor Abbott cwabbott0 at gmail.com
Tue Feb 3 12:22:10 PST 2015


On Tue, Feb 3, 2015 at 1:49 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> For whatever reason, I thought we might have non-ssa phi sources.  However,
> I looked again and I don't think it's possible.  Also, this patch applies
> with no piglit regressions.

Yeah, the only reason I made it so that phi instructions could have
non-SSA sources is for the old to-SSA pass -- it's pretty convenient
there. With the stuff about inserting new definitions for range
analysis, I may end up making it use a new to-SSA helper (that the
variable-to-SSA pass and range analysis would also use) that doesn't
rely on this, so after that it should be possible to make phi sources
(and destinations) SSA-only like what we did with load_const.

>
> On Tue, Feb 3, 2015 at 10:49 AM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
>>
>> ---
>>  src/glsl/nir/nir_validate.c | 13 +++----------
>>  1 file changed, 3 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c
>> index 7c801b2..5b47f1a 100644
>> --- a/src/glsl/nir/nir_validate.c
>> +++ b/src/glsl/nir/nir_validate.c
>> @@ -488,16 +488,9 @@ validate_phi_src(nir_phi_instr *instr, nir_block
>> *pred, validate_state *state)
>>     exec_list_validate(&instr->srcs);
>>     nir_foreach_phi_src(instr, src) {
>>        if (src->pred == pred) {
>> -         unsigned num_components;
>> -         if (src->src.is_ssa)
>> -            num_components = src->src.ssa->num_components;
>> -         else {
>> -            if (src->src.reg.reg->is_packed)
>> -               num_components = 4; /* can't check anything */
>> -            else
>> -               num_components = src->src.reg.reg->num_components;
>> -         }
>> -         assert(num_components == instr->dest.ssa.num_components);
>> +         assert(src->src.is_ssa);
>> +         assert(src->src.ssa->num_components ==
>> +                instr->dest.ssa.num_components);
>>
>>           validate_src(&src->src, state);
>>           return;
>> --
>> 2.2.2
>>
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list