[llvm] c7f127d - [MachineOutliner] Fix uninitialized variable warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 08:14:17 PST 2019


Author: Simon Pilgrim
Date: 2019-11-05T15:15:14Z
New Revision: c7f127d93f4bc694737081501c65ffa37fd1da50

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

LOG: [MachineOutliner] Fix uninitialized variable warnings. NFCI.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/MachineOutliner.h
    llvm/lib/CodeGen/MachineOutliner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/MachineOutliner.h b/llvm/include/llvm/CodeGen/MachineOutliner.h
index 3868fa415579..4a1b04ab3e88 100644
--- a/llvm/include/llvm/CodeGen/MachineOutliner.h
+++ b/llvm/include/llvm/CodeGen/MachineOutliner.h
@@ -37,10 +37,10 @@ enum InstrType { Legal, LegalTerminator, Illegal, Invisible };
 struct Candidate {
 private:
   /// The start index of this \p Candidate in the instruction list.
-  unsigned StartIdx;
+  unsigned StartIdx = 0;
 
   /// The number of instructions in this \p Candidate.
-  unsigned Len;
+  unsigned Len = 0;
 
   // The first instruction in this \p Candidate.
   MachineBasicBlock::iterator FirstInst;
@@ -49,20 +49,20 @@ struct Candidate {
   MachineBasicBlock::iterator LastInst;
 
   // The basic block that contains this Candidate.
-  MachineBasicBlock *MBB;
+  MachineBasicBlock *MBB = nullptr;
 
   /// Cost of calling an outlined function from this point as defined by the
   /// target.
-  unsigned CallOverhead;
+  unsigned CallOverhead = 0;
 
 public:
   /// The index of this \p Candidate's \p OutlinedFunction in the list of
   /// \p OutlinedFunctions.
-  unsigned FunctionIdx;
+  unsigned FunctionIdx = 0;
 
   /// Identifier denoting the instructions to emit to call an outlined function
   /// from this point. Defined by the target.
-  unsigned CallConstructionID;
+  unsigned CallConstructionID = 0;
 
   /// Contains physical register liveness information for the MBB containing
   /// this \p Candidate.

diff  --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index f26ebcb44ffe..c4c3f2f568b2 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -252,7 +252,7 @@ class SuffixTree {
   /// Ukkonen's algorithm.
   struct ActiveState {
     /// The next node to insert at.
-    SuffixTreeNode *Node;
+    SuffixTreeNode *Node = nullptr;
 
     /// The index of the first character in the substring currently being added.
     unsigned Idx = EmptyIdx;


        


More information about the llvm-commits mailing list