[llvm] 9242b99 - MSP430 - fix uninitialized variable warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 06:22:25 PST 2019


Author: Simon Pilgrim
Date: 2019-11-14T14:21:16Z
New Revision: 9242b994510d9a03e33790168a87161f8577f4e9

URL: https://github.com/llvm/llvm-project/commit/9242b994510d9a03e33790168a87161f8577f4e9
DIFF: https://github.com/llvm/llvm-project/commit/9242b994510d9a03e33790168a87161f8577f4e9.diff

LOG: MSP430 - fix uninitialized variable warnings. NFCI.

Added: 
    

Modified: 
    llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
    llvm/lib/Target/MSP430/MSP430MachineFunctionInfo.h
    llvm/lib/Target/MSP430/MSP430Subtarget.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
index 23449585505e..8550230155c8 100644
--- a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
@@ -37,25 +37,22 @@ namespace {
     enum {
       RegBase,
       FrameIndexBase
-    } BaseType;
+    } BaseType = RegBase;
 
     struct {            // This is really a union, discriminated by BaseType!
       SDValue Reg;
-      int FrameIndex;
+      int FrameIndex = 0;
     } Base;
 
-    int16_t Disp;
-    const GlobalValue *GV;
-    const Constant *CP;
-    const BlockAddress *BlockAddr;
-    const char *ES;
-    int JT;
-    unsigned Align;    // CP alignment.
-
-    MSP430ISelAddressMode()
-      : BaseType(RegBase), Disp(0), GV(nullptr), CP(nullptr),
-        BlockAddr(nullptr), ES(nullptr), JT(-1), Align(0) {
-    }
+    int16_t Disp = 0;
+    const GlobalValue *GV = nullptr;
+    const Constant *CP = nullptr;
+    const BlockAddress *BlockAddr = nullptr;
+    const char *ES = nullptr;
+    int JT = -1;
+    unsigned Align = 0;  // CP alignment.
+
+    MSP430ISelAddressMode() = default;
 
     bool hasSymbolicDisplacement() const {
       return GV != nullptr || CP != nullptr || ES != nullptr || JT != -1;

diff  --git a/llvm/lib/Target/MSP430/MSP430MachineFunctionInfo.h b/llvm/lib/Target/MSP430/MSP430MachineFunctionInfo.h
index 2b2c8967a749..712519cfe38a 100644
--- a/llvm/lib/Target/MSP430/MSP430MachineFunctionInfo.h
+++ b/llvm/lib/Target/MSP430/MSP430MachineFunctionInfo.h
@@ -24,21 +24,21 @@ class MSP430MachineFunctionInfo : public MachineFunctionInfo {
 
   /// CalleeSavedFrameSize - Size of the callee-saved register portion of the
   /// stack frame in bytes.
-  unsigned CalleeSavedFrameSize;
+  unsigned CalleeSavedFrameSize = 0;
 
   /// ReturnAddrIndex - FrameIndex for return slot.
-  int ReturnAddrIndex;
+  int ReturnAddrIndex = 0;
 
   /// VarArgsFrameIndex - FrameIndex for start of varargs area.
-  int VarArgsFrameIndex;
+  int VarArgsFrameIndex = 0;
 
   /// SRetReturnReg - Some subtargets require that sret lowering includes
   /// returning the value of the returned struct in a register. This field
   /// holds the virtual register into which the sret argument is passed.
-  unsigned SRetReturnReg;
+  unsigned SRetReturnReg = 0;
 
 public:
-  MSP430MachineFunctionInfo() : CalleeSavedFrameSize(0) {}
+  MSP430MachineFunctionInfo() = default;
 
   explicit MSP430MachineFunctionInfo(MachineFunction &MF)
     : CalleeSavedFrameSize(0), ReturnAddrIndex(0), SRetReturnReg(0) {}

diff  --git a/llvm/lib/Target/MSP430/MSP430Subtarget.h b/llvm/lib/Target/MSP430/MSP430Subtarget.h
index ab2b71e3bb1a..2348d984d7e2 100644
--- a/llvm/lib/Target/MSP430/MSP430Subtarget.h
+++ b/llvm/lib/Target/MSP430/MSP430Subtarget.h
@@ -36,8 +36,8 @@ class MSP430Subtarget : public MSP430GenSubtargetInfo {
 
 private:
   virtual void anchor();
-  bool ExtendedInsts;
-  HWMultEnum HWMultMode;
+  bool ExtendedInsts = false;
+  HWMultEnum HWMultMode = NoHWMult;
   MSP430FrameLowering FrameLowering;
   MSP430InstrInfo InstrInfo;
   MSP430TargetLowering TLInfo;


        


More information about the llvm-commits mailing list