Skip to content

Commit b3b0acd

Browse files
committed
[NFC] Refine some uninitialized used variables.
These warning are reported by static code analysis tool: Klocwork Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D95421
1 parent 64cdba6 commit b3b0acd

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,7 @@ const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) {
26972697
}
26982698

26992699
bool HasByrefExtendedLayout = false;
2700-
Qualifiers::ObjCLifetime Lifetime;
2700+
Qualifiers::ObjCLifetime Lifetime = Qualifiers::OCL_None;
27012701
if (getContext().getByrefLifetime(Ty, Lifetime, HasByrefExtendedLayout) &&
27022702
HasByrefExtendedLayout) {
27032703
/// void *__byref_variable_layout;
@@ -2767,8 +2767,8 @@ void CodeGenFunction::emitByrefStructureInit(const AutoVarEmission &emission) {
27672767
const VarDecl &D = *emission.Variable;
27682768
QualType type = D.getType();
27692769

2770-
bool HasByrefExtendedLayout;
2771-
Qualifiers::ObjCLifetime ByrefLifetime;
2770+
bool HasByrefExtendedLayout = false;
2771+
Qualifiers::ObjCLifetime ByrefLifetime = Qualifiers::OCL_None;
27722772
bool ByRefHasLifetime =
27732773
getContext().getByrefLifetime(type, ByrefLifetime, HasByrefExtendedLayout);
27742774

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ bool CoalescerPair::setRegisters(const MachineInstr *MI) {
442442
Flipped = CrossClass = false;
443443

444444
Register Src, Dst;
445-
unsigned SrcSub, DstSub;
445+
unsigned SrcSub = 0, DstSub = 0;
446446
if (!isMoveInstr(TRI, MI, Src, Dst, SrcSub, DstSub))
447447
return false;
448448
Partial = SrcSub || DstSub;
@@ -537,7 +537,7 @@ bool CoalescerPair::isCoalescable(const MachineInstr *MI) const {
537537
if (!MI)
538538
return false;
539539
Register Src, Dst;
540-
unsigned SrcSub, DstSub;
540+
unsigned SrcSub = 0, DstSub = 0;
541541
if (!isMoveInstr(TRI, MI, Src, Dst, SrcSub, DstSub))
542542
return false;
543543

@@ -1590,7 +1590,7 @@ MachineInstr *RegisterCoalescer::eliminateUndefCopy(MachineInstr *CopyMI) {
15901590
// CoalescerPair may have a new register class with adjusted subreg indices
15911591
// at this point.
15921592
Register SrcReg, DstReg;
1593-
unsigned SrcSubIdx, DstSubIdx;
1593+
unsigned SrcSubIdx = 0, DstSubIdx = 0;
15941594
if(!isMoveInstr(*TRI, CopyMI, SrcReg, DstReg, SrcSubIdx, DstSubIdx))
15951595
return nullptr;
15961596

@@ -1966,7 +1966,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
19661966
if (!canJoinPhys(CP)) {
19671967
// Before giving up coalescing, if definition of source is defined by
19681968
// trivial computation, try rematerializing it.
1969-
bool IsDefCopy;
1969+
bool IsDefCopy = false;
19701970
if (reMaterializeTrivialDef(CP, CopyMI, IsDefCopy))
19711971
return true;
19721972
if (IsDefCopy)
@@ -2005,7 +2005,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
20052005

20062006
// If definition of source is defined by trivial computation, try
20072007
// rematerializing it.
2008-
bool IsDefCopy;
2008+
bool IsDefCopy = false;
20092009
if (reMaterializeTrivialDef(CP, CopyMI, IsDefCopy))
20102010
return true;
20112011

@@ -3798,7 +3798,7 @@ bool RegisterCoalescer::applyTerminalRule(const MachineInstr &Copy) const {
37983798
if (!UseTerminalRule)
37993799
return false;
38003800
Register SrcReg, DstReg;
3801-
unsigned SrcSubReg, DstSubReg;
3801+
unsigned SrcSubReg = 0, DstSubReg = 0;
38023802
if (!isMoveInstr(*TRI, &Copy, SrcReg, DstReg, SrcSubReg, DstSubReg))
38033803
return false;
38043804
// Check if the destination of this copy has any other affinity.
@@ -3823,7 +3823,7 @@ bool RegisterCoalescer::applyTerminalRule(const MachineInstr &Copy) const {
38233823
if (&MI == &Copy || !MI.isCopyLike() || MI.getParent() != OrigBB)
38243824
continue;
38253825
Register OtherSrcReg, OtherReg;
3826-
unsigned OtherSrcSubReg, OtherSubReg;
3826+
unsigned OtherSrcSubReg = 0, OtherSubReg = 0;
38273827
if (!isMoveInstr(*TRI, &Copy, OtherSrcReg, OtherReg, OtherSrcSubReg,
38283828
OtherSubReg))
38293829
return false;

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13830,7 +13830,7 @@ static SDValue lowerShuffleAsInsertPS(const SDLoc &DL, SDValue V1, SDValue V2,
1383013830
assert(V2.getSimpleValueType() == MVT::v4f32 && "Bad operand type!");
1383113831

1383213832
// Attempt to match the insertps pattern.
13833-
unsigned InsertPSMask;
13833+
unsigned InsertPSMask = 0;
1383413834
if (!matchShuffleAsInsertPS(V1, V2, InsertPSMask, Zeroable, Mask, DAG))
1383513835
return SDValue();
1383613836

0 commit comments

Comments
 (0)