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

Jason Ekstrand jason at jlekstrand.net
Tue Jan 27 14:16:59 PST 2015


On Tue, Jan 27, 2015 at 2:01 PM, Eric Anholt <eric at anholt.net> wrote:

> 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.
>

Yup, figured.  All that should be fixed in the v3 I just sent.  (It's
accidentally named v2)
--Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150127/2db9781b/attachment.html>


More information about the mesa-dev mailing list