[Mesa-dev] [PATCH 3/3] nv50/ir: Fix unused var warnings in release build

Eric Engestrom eric.engestrom at imgtec.com
Mon Dec 4 16:19:31 UTC 2017


On Saturday, 2017-12-02 13:28:04 -0500, Ilia Mirkin wrote:
> On Sat, Dec 2, 2017 at 1:22 PM, Rhys Kidd <rhyskidd at gmail.com> wrote:
> > Signed-off-by: Rhys Kidd <rhyskidd at gmail.com>
> > ---
> >  src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp | 2 +-
> >  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp  | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
> > index cc2a88eb40..139ff4a31d 100644
> > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
> > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp
> > @@ -621,7 +621,7 @@ void
> >  CodeEmitterNV50::emitLOAD(const Instruction *i)
> >  {
> >     DataFile sf = i->src(0).getFile();
> > -   int32_t offset = i->getSrc(0)->reg.data.offset;
> > +   MAYBE_UNUSED int32_t offset = i->getSrc(0)->reg.data.offset;
> >
> >     switch (sf) {
> >     case FILE_SHADER_INPUT:
> > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> > index 61d4e6a2d0..f49459b969 100644
> > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> > @@ -3308,7 +3308,7 @@ PostRaLoadPropagation::handleMADforNV50(Instruction *i)
> >           i->setSrc(1, def->getSrc(0));
> >        } else {
> >           ImmediateValue val;
> > -         bool ret = def->src(0).getImmediate(val);
> > +         MAYBE_UNUSED bool ret = def->src(0).getImmediate(val);
> 
> Can you write a comment mentioning that getImmediate() has
> side-effects on the argument, so this *shouldn't* get folded into the
> assert? My concern is that with the MAYBE_UNUSED there, someone with a
> twitchy thumb may be tempted to press that button...

Being someone with such a twitchy thumb, I approve of adding this
comment :)
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> 
>   -ilia
> 
> >           assert(ret);
> >           if (i->getSrc(1)->reg.data.id & 1)
> >              val.reg.data.u32 >>= 16;
> > --
> > 2.14.1
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list