[PATCH] D40648: A few initializations to please Valgrind. NFC

Jesper Antonsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 05:16:58 PST 2017


JesperAntonsson created this revision.
Herald added a subscriber: JDevlieghere.

Three fairly trivial null initializations to avoid Valgrind complaints.


https://reviews.llvm.org/D40648

Files:
  include/llvm/CodeGen/MachineOperand.h
  lib/CodeGen/AsmPrinter/DwarfDebug.h
  lib/Transforms/Scalar/SROA.cpp


Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp
+++ lib/Transforms/Scalar/SROA.cpp
@@ -1547,7 +1547,7 @@
   // never are able to compute one directly that has the correct type, we'll
   // fall back to it, so keep it and the base it was computed from around here.
   Value *OffsetPtr = nullptr;
-  Value *OffsetBasePtr;
+  Value *OffsetBasePtr = nullptr;
 
   // Remember any i8 pointer we come across to re-use if we need to do a raw
   // byte offset.
Index: lib/CodeGen/AsmPrinter/DwarfDebug.h
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -226,7 +226,7 @@
   const MachineFunction *CurFn = nullptr;
 
   /// If nonnull, stores the CU in which the previous subprogram was contained.
-  const DwarfCompileUnit *PrevCU;
+  const DwarfCompileUnit *PrevCU = nullptr;
 
   /// As an optimization, there is no need to emit an entry in the directory
   /// table for the same directory as DW_AT_comp_dir.
Index: include/llvm/CodeGen/MachineOperand.h
===================================================================
--- include/llvm/CodeGen/MachineOperand.h
+++ include/llvm/CodeGen/MachineOperand.h
@@ -190,7 +190,11 @@
   } Contents;
 
   explicit MachineOperand(MachineOperandType K)
-    : OpKind(K), SubReg_TargetFlags(0), ParentMI(nullptr) {}
+    : OpKind(K), SubReg_TargetFlags(0),
+      IsDef(0), IsImp(0), IsKill(0), IsDead(0), IsUndef(0),
+      IsInternalRead(0), IsEarlyClobber(0), IsDebug(0),
+      ParentMI(nullptr) {}
+
 public:
   /// getType - Returns the MachineOperandType for this operand.
   ///


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40648.124918.patch
Type: text/x-patch
Size: 1716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171130/72c6fa7b/attachment.bin>


More information about the llvm-commits mailing list