Skip to content

Commit

Permalink
Fix uninitialized class members
Browse files Browse the repository at this point in the history
Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D148692
  • Loading branch information
akshaykhadse committed Apr 20, 2023
1 parent 33e2e71 commit 43b3869
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/GlobalISel/LoadStoreOpt.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class LoadStoreOpt : public MachineFunctionPass {
/// that bit's value is legal. E.g. if bit 64 is set, then 64 bit scalar
/// stores are legal.
DenseMap<unsigned, BitVector> LegalStoreSizes;
bool IsPreLegalizer;
bool IsPreLegalizer = false;
/// Contains instructions to be erased at the end of a block scan.
SmallSet<MachineInstr *, 16> InstsToErase;

Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ReachingDefAnalysis : public MachineFunctionPass {
MachineFunction *MF = nullptr;
const TargetRegisterInfo *TRI = nullptr;
LoopTraversal::TraversalOrder TraversedMBBOrder;
unsigned NumRegUnits;
unsigned NumRegUnits = 0;
/// Instruction that defined each register, relative to the beginning of the
/// current basic block. When a LiveRegsDefInfo is used to represent a
/// live-out register, this value is relative to the end of the basic block,
Expand All @@ -87,7 +87,7 @@ class ReachingDefAnalysis : public MachineFunctionPass {

/// Current instruction number.
/// The first instruction in each basic block is 0.
int CurInstr;
int CurInstr = -1;

/// Maps instructions to their instruction Ids, relative to the beginning of
/// their basic blocks.
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace llvm {
MachineBasicBlock::iterator RegionEnd;

/// Instructions in this region (distance(RegionBegin, RegionEnd)).
unsigned NumRegionInstrs;
unsigned NumRegionInstrs = 0;

/// After calling BuildSchedGraph, each machine instruction in the current
/// scheduling region is mapped to an SUnit.
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/BranchFolding.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ class TargetRegisterInfo;
};
std::vector<SameTailElt> SameTails;

bool AfterBlockPlacement;
bool EnableTailMerge;
bool EnableHoistCommonCode;
bool UpdateLiveIns;
bool AfterBlockPlacement = false;
bool EnableTailMerge = false;
bool EnableHoistCommonCode = false;
bool UpdateLiveIns = false;
unsigned MinCommonTailLength;
const TargetInstrInfo *TII = nullptr;
const MachineRegisterInfo *MRI = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/CodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3247,7 +3247,7 @@ class AddressingModeMatcher {
bool IgnoreProfitability;

/// True if we are optimizing for size.
bool OptSize;
bool OptSize = false;

ProfileSummaryInfo *PSI;
BlockFrequencyInfo *BFI;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/IfConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ namespace {

LivePhysRegs Redefs;

bool PreRegAlloc;
bool MadeChange;
bool PreRegAlloc = true;
bool MadeChange = false;
int FnNum = -1;
std::function<bool(const MachineFunction &)> PredicateFtor;

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineBlockPlacement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class MachineBlockPlacement : public MachineFunctionPass {

/// True: use block profile count to compute tail duplication cost.
/// False: use block frequency to compute tail duplication cost.
bool UseProfileCount;
bool UseProfileCount = false;

/// Allocator and owner of BlockChain structures.
///
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MachineCombiner : public MachineFunctionPass {
TargetSchedModel TSchedModel;

/// True if optimizing for code size.
bool OptSize;
bool OptSize = false;

public:
static char ID;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineCopyPropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class MachineCopyPropagation : public MachineFunctionPass {

CopyTracker Tracker;

bool Changed;
bool Changed = false;
};

} // end anonymous namespace
Expand Down
10 changes: 5 additions & 5 deletions llvm/lib/CodeGen/MachineLICM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ namespace {
const MachineFrameInfo *MFI = nullptr;
MachineRegisterInfo *MRI = nullptr;
TargetSchedModel SchedModel;
bool PreRegAlloc;
bool HasProfileData;
bool PreRegAlloc = false;
bool HasProfileData = false;

// Various analyses that we use...
AliasAnalysis *AA = nullptr; // Alias analysis info.
Expand All @@ -128,8 +128,8 @@ namespace {
MachineDominatorTree *DT = nullptr; // Machine dominator tree for the cur loop

// State that is updated as we process loops
bool Changed; // True if a loop is changed.
bool FirstInLoop; // True if it's the first LICM in the loop.
bool Changed = false; // True if a loop is changed.
bool FirstInLoop = false; // True if it's the first LICM in the loop.
MachineLoop *CurLoop = nullptr; // The current loop we are working on.
MachineBasicBlock *CurPreheader = nullptr; // The preheader for CurLoop.

Expand Down Expand Up @@ -163,7 +163,7 @@ namespace {
// If a MBB does not dominate loop exiting blocks then it may not safe
// to hoist loads from this block.
// Tri-state: 0 - false, 1 - true, 2 - unknown
unsigned SpeculationState;
unsigned SpeculationState = SpeculateUnknown;

public:
MachineLICMBase(char &PassID, bool PreRegAlloc)
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/MachineVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ namespace {
const MachineRegisterInfo *MRI = nullptr;
const RegisterBankInfo *RBI = nullptr;

unsigned foundErrors;
unsigned foundErrors = 0;

// Avoid querying the MachineFunctionProperties for each operand.
bool isFunctionRegBankSelected;
bool isFunctionSelected;
bool isFunctionTracksDebugUserValues;
bool isFunctionRegBankSelected = false;
bool isFunctionSelected = false;
bool isFunctionTracksDebugUserValues = false;

using RegVector = SmallVector<Register, 16>;
using RegMaskVector = SmallVector<const uint32_t *, 4>;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/PrologEpilogInserter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ class PEI : public MachineFunctionPass {
// Flag to control whether to use the register scavenger to resolve
// frame index materialization registers. Set according to
// TRI->requiresFrameIndexScavenging() for the current function.
bool FrameIndexVirtualScavenging;
bool FrameIndexVirtualScavenging = false;

// Flag to control whether the scavenger should be passed even though
// FrameIndexVirtualScavenging is used.
bool FrameIndexEliminationScavenging;
bool FrameIndexEliminationScavenging = false;

// Emit remarks.
MachineOptimizationRemarkEmitter *ORE = nullptr;
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/RegAllocGreedy.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class LLVM_LIBRARY_VISIBILITY RAGreedy : public MachineFunctionPass,
CO_Interf = 2
};

uint8_t CutOffInfo;
uint8_t CutOffInfo = CutOffStage::CO_None;

#ifndef NDEBUG
static const char *const StageName[];
Expand Down Expand Up @@ -278,9 +278,9 @@ class LLVM_LIBRARY_VISIBILITY RAGreedy : public MachineFunctionPass,

/// Flags for the live range priority calculation, determined once per
/// machine function.
bool RegClassPriorityTrumpsGlobalness;
bool RegClassPriorityTrumpsGlobalness = false;

bool ReverseLocalAssignment;
bool ReverseLocalAssignment = false;

public:
RAGreedy(const RegClassFilterFunc F = allocateAllRegClasses);
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/ShrinkWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ class ShrinkWrap : public MachineFunctionPass {
MachineOptimizationRemarkEmitter *ORE = nullptr;

/// Frequency of the Entry block.
uint64_t EntryFreq;
uint64_t EntryFreq = 0;

/// Current opcode for frame setup.
unsigned FrameSetupOpcode;
unsigned FrameSetupOpcode = ~0u;

/// Current opcode for frame destroy.
unsigned FrameDestroyOpcode;
unsigned FrameDestroyOpcode = ~0u;

/// Stack pointer register, used by llvm.{savestack,restorestack}
Register SP;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class TwoAddressInstructionPass : public MachineFunctionPass {
LiveVariables *LV = nullptr;
LiveIntervals *LIS = nullptr;
AliasAnalysis *AA = nullptr;
CodeGenOpt::Level OptLevel;
CodeGenOpt::Level OptLevel = CodeGenOpt::None;

// The current basic block being processed.
MachineBasicBlock *MBB = nullptr;
Expand Down

0 comments on commit 43b3869

Please sign in to comment.