[Mesa-dev] [PATCH v2 1/3] nir: Add a pass to lower vector phi nodes to scalar phi nodes

Eric Anholt eric at anholt.net
Tue Jan 27 14:01:28 PST 2015


Jason Ekstrand <jason at jlekstrand.net> writes:

> On Mon, Jan 26, 2015 at 3:58 PM, Eric Anholt <eric at anholt.net> wrote:
>
>> Jason Ekstrand <jason at jlekstrand.net> writes:
>>
>> > On Mon, Jan 26, 2015 at 11:21 AM, Eric Anholt <eric at anholt.net> wrote:
>> >
>> >> Jason Ekstrand <jason at jlekstrand.net> writes:
>> >> > +      case nir_instr_type_phi: {
>> >> > +         nir_phi_instr *src_phi = nir_instr_as_phi(src_instr);
>> >> > +
>> >> > +         /* Insert an entry and mark it as scalarizable for now. That
>> >> way
>> >> > +          * we don't recurse forever and a cycle in the depencence
>> graph
>> >> > +          * won't automatically make us fail to scalarize.
>> >> > +          */
>> >> > +         entry = _mesa_hash_table_insert(state->phi_table, src_phi,
>> >> (void *)1);
>> >>
>> >> I expect "(void *)1" will give compiler warnings generally.  "(void
>> >> *)(uintptr_t)1" is the usual workaround.
>> >>
>> >> Useful comment, though!
>> >>
>> >> > +         bool scalarizable = should_lower_phi(src_phi, state);
>> >> > +         entry->data = (void *)scalarizable;
>> >>
>> >> No need to cast to void *, since not C++.
>> >>
>> >
>> > I'm confused.  You want more casting above but less here?  Could you
>> pleas
>> > be a little more specific.
>>
>> Yes, you have to add the cast above to avoid a compiler warning about
>> casting from a small int to a pointer, while casting to void * to assign
>> to a void * is only a c++ism
>>
>
> But I'm casting a bool to void *...

So the same thing: to go from something-that's-not-a-long, you cast
through uintptr_t first.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150127/4d243e47/attachment-0001.sig>


More information about the mesa-dev mailing list