================
@@ -113,44 +113,58 @@ void LoongArchDAGToDAGISel::Select(SDNode *Node) {
     APInt SplatValue, SplatUndef;
     unsigned SplatBitSize;
     bool HasAnyUndefs;
-    unsigned Op;
+    unsigned Op = 0;
----------------
ylzsx wrote:

Without initialization, a warning will occur. I'm not sure why it didn't happen 
before.
```
[44/185] Building CXX object 
lib/Target/LoongArch/CMakeFiles/LLVMLoongArchCodeGen.dir/LoongArchISelDAGToDAG.cpp.o
/home/yangzhaoxin/workspace/flang-test/llvm-project/llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.cpp:131:7:
 warning: variable 'Op' is used uninitialized whenever switch default is taken 
[-Wsometimes-uninitialized]
  131 |       default:
      |       ^~~~~~~
/home/yangzhaoxin/workspace/flang-test/llvm-project/llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.cpp:150:36:
 note: uninitialized use occurs here
  150 |       Res = CurDAG->getMachineNode(Op, DL, ResTy, Imm);
      |                                    ^~
/home/yangzhaoxin/workspace/flang-test/llvm-project/llvm/lib/Target/LoongArch/LoongArchISelDAGToDAG.cpp:116:16:
 note: initialize the variable 'Op' to silence this warning
  116 |     unsigned Op;
      |                ^
      |                 = 0
1 warning generated.
```

https://github.com/llvm/llvm-project/pull/159258
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to