nouveau: Silence some warnings at -Og
authorAdam Jackson <ajax@redhat.com>
Tue, 26 Jan 2021 19:27:48 +0000 (14:27 -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_from_tgsi.cpp: In member function ‘bool {anonymous}::Converter::handleInstruction(const tgsi_full_instruction*)’:
   ../src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:3419:22: warning: ‘src1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    3419 |          geni = mkOp3(op, dstTy, dst0[c], fetchSrc(0, c), src1, mkImm(0x1f));
   ../src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:3272:15: warning: ‘val1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    3272 |          mkOp1(OP_EX2, TYPE_F32, dst0[1], val1);

Can't happen, just initialize them to NULL.

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

index 8eb7104..b2e0fb0 100644 (file)
@@ -3121,7 +3121,7 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
 
    Value *dst0[4], *rDst0[4];
    Value *src0, *src1, *src2, *src3;
-   Value *val0, *val1;
+   Value *val0 = NULL, *val1 = NULL;
    int c;
 
    tgsi = tgsi::Instruction(insn);
@@ -3415,6 +3415,8 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
    case TGSI_OPCODE_READ_INVOC:
       if (tgsi.getOpcode() == TGSI_OPCODE_READ_INVOC)
          src1 = fetchSrc(1, 0);
+      else
+         src1 = val0;
       FOR_EACH_DST_ENABLED_CHANNEL(0, c, tgsi) {
          geni = mkOp3(op, dstTy, dst0[c], fetchSrc(0, c), src1, mkImm(0x1f));
          geni->subOp = NV50_IR_SUBOP_SHFL_IDX;