nouveau: Silence a warning at -Og
authorAdam Jackson <ajax@redhat.com>
Tue, 26 Jan 2021 19:30:28 +0000 (14:30 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 18 Feb 2021 20:59:43 +0000 (20:59 +0000)
   ../src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp: In member function ‘void nv50_ir::AlgebraicOpt::handleCVT_EXTBF(nv50_ir::Instruction*)’:
   ../src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp:2238:57: warning: ‘offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Just set it to 0 to handle the corner case.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index f5514c6..6da706b 100644 (file)
@@ -2167,7 +2167,7 @@ AlgebraicOpt::handleCVT_EXTBF(Instruction *cvt)
    Instruction *insn = cvt->getSrc(0)->getInsn();
    ImmediateValue imm;
    Value *arg = NULL;
-   unsigned width, offset;
+   unsigned width, offset = 0;
    if ((cvt->sType != TYPE_U32 && cvt->sType != TYPE_S32) || !insn)
       return;
    if (insn->op == OP_EXTBF && insn->src(1).getImmediate(imm)) {
@@ -2199,7 +2199,7 @@ AlgebraicOpt::handleCVT_EXTBF(Instruction *cvt)
 
       arg = insn->getSrc(!s);
       Instruction *shift = arg->getInsn();
-      offset = 0;
+
       if (shift && shift->op == OP_SHR &&
           shift->sType == cvt->sType &&
           shift->src(1).getImmediate(imm) &&