[llvm-branch-commits] [llvm] [LoongArch] Generate [x]vldi instructions with special constant splats (PR #159258)

Zhaoxin Yang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 18 02:01:52 PDT 2025


================
@@ -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


More information about the llvm-branch-commits mailing list