[llvm] 8de1613 - [X86] Fix -Wsometimes-uninitialized in X86InstrInfo.cpp (NFC)
Jie Fu via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 02:09:14 PDT 2023
Author: Jie Fu
Date: 2023-04-27T17:08:24+08:00
New Revision: 8de16131cb0eac5a9b716cadb6125377b271f862
URL: https://github.com/llvm/llvm-project/commit/8de16131cb0eac5a9b716cadb6125377b271f862
DIFF: https://github.com/llvm/llvm-project/commit/8de16131cb0eac5a9b716cadb6125377b271f862.diff
LOG: [X86] Fix -Wsometimes-uninitialized in X86InstrInfo.cpp (NFC)
/data/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp:9793:3: error: variable 'MaddOpc' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
default:
^~~~~~~
/data/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp:9854:25: note: uninitialized use occurs here
Madd->setDesc(TII.get(MaddOpc));
^~~~~~~
/data/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp:9791:19: note: initialize the variable 'MaddOpc' to silence this warning
unsigned MaddOpc;
^
= 0
/data/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp:9793:3: error: variable 'AddOpc' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
default:
^~~~~~~
/data/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp:9862:46: note: uninitialized use occurs here
BuildMI(*MF, MIMetadata(Root), TII.get(AddOpc), DstReg)
^~~~~~
/data/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp:9790:18: note: initialize the variable 'AddOpc' to silence this warning
unsigned AddOpc;
^
= 0
2 errors generated.
Added:
Modified:
llvm/lib/Target/X86/X86InstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 2ee9ab6f95f3..c499410928cb 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -9787,8 +9787,8 @@ genAlternativeDpCodeSequence(MachineInstr &Root, const TargetInstrInfo &TII,
MachineRegisterInfo &RegInfo = MF->getRegInfo();
unsigned Opc = Root.getOpcode();
- unsigned AddOpc;
- unsigned MaddOpc;
+ unsigned AddOpc = 0;
+ unsigned MaddOpc = 0;
switch (Opc) {
default:
assert("It should not reach here");
More information about the llvm-commits
mailing list