Skip to content

Commit 2f8b90a

Browse files
juanrod2Zuul
authored andcommitted
Fixes for Klocwork issues
Change-Id: I1e14bbd578350210a840e4df8f71243a370ce0d9
1 parent 0381a4d commit 2f8b90a

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ bool Emu64Ops::populatePHIs(Function& F) {
610610
for (auto BI = BB.begin(); (PN = dyn_cast<PHINode>(BI)) != nullptr; ++BI) {
611611
if (!isInt64(PN))
612612
continue;
613-
Value* L, * H;
613+
Value* L = nullptr, * H = nullptr;
614614
std::tie(L, H) = getExpandedValues(PN);
615615

616616
PHINode* Lo = cast<PHINode>(L);
@@ -688,9 +688,9 @@ bool InstExpander::visitSub(BinaryOperator& BinOp) {
688688
if (!Emu->isInt64(&BinOp))
689689
return false;
690690

691-
Value* L0, * H0;
691+
Value* L0 = nullptr, * H0 = nullptr;
692692
std::tie(L0, H0) = Emu->getExpandedValues(BinOp.getOperand(0));
693-
Value* L1, * H1;
693+
Value* L1 = nullptr, * H1 = nullptr;
694694
std::tie(L1, H1) = Emu->getExpandedValues(BinOp.getOperand(1));
695695

696696
GenISAIntrinsic::ID GIID = GenISAIntrinsic::GenISA_sub_pair;
@@ -707,9 +707,9 @@ bool InstExpander::visitMul(BinaryOperator& BinOp) {
707707
if (!Emu->isInt64(&BinOp))
708708
return false;
709709

710-
Value* L0, * H0;
710+
Value* L0 = nullptr, * H0 = nullptr;
711711
std::tie(L0, H0) = Emu->getExpandedValues(BinOp.getOperand(0));
712-
Value* L1, * H1;
712+
Value* L1 = nullptr, * H1 = nullptr;
713713
std::tie(L1, H1) = Emu->getExpandedValues(BinOp.getOperand(1));
714714

715715
GenISAIntrinsic::ID GIID = GenISAIntrinsic::GenISA_mul_pair;
@@ -871,9 +871,9 @@ bool InstExpander::visitLShr(BinaryOperator& BinOp) {
871871
if (!Emu->isInt64(&BinOp))
872872
return false;
873873

874-
Value* Lo, * Hi;
874+
Value* Lo = nullptr, * Hi = nullptr;
875875
std::tie(Lo, Hi) = Emu->getExpandedValues(BinOp.getOperand(0));
876-
Value* ShAmt;
876+
Value* ShAmt = nullptr;
877877
std::tie(ShAmt, std::ignore) = Emu->getExpandedValues(BinOp.getOperand(1));
878878

879879
BasicBlock* OldBB = BinOp.getParent();
@@ -1121,9 +1121,9 @@ bool InstExpander::visitOr(BinaryOperator& BinOp) {
11211121
if (!Emu->isInt64(&BinOp))
11221122
return false;
11231123

1124-
Value* L0, * H0;
1124+
Value* L0 = nullptr, * H0 = nullptr;
11251125
std::tie(L0, H0) = Emu->getExpandedValues(BinOp.getOperand(0));
1126-
Value* L1, * H1;
1126+
Value* L1 = nullptr, * H1 = nullptr;
11271127
std::tie(L1, H1) = Emu->getExpandedValues(BinOp.getOperand(1));
11281128

11291129
Value* Lo = IRB->CreateOr(L0, L1);
@@ -1137,9 +1137,9 @@ bool InstExpander::visitXor(BinaryOperator& BinOp) {
11371137
if (!Emu->isInt64(&BinOp))
11381138
return false;
11391139

1140-
Value* L0, * H0;
1140+
Value* L0 = nullptr, * H0 = nullptr;
11411141
std::tie(L0, H0) = Emu->getExpandedValues(BinOp.getOperand(0));
1142-
Value* L1, * H1;
1142+
Value* L1 = nullptr, * H1 = nullptr;
11431143
std::tie(L1, H1) = Emu->getExpandedValues(BinOp.getOperand(1));
11441144

11451145
Value* Lo = IRB->CreateXor(L0, L1);
@@ -1174,7 +1174,7 @@ bool InstExpander::visitStore(StoreInst& ST) {
11741174
if (!Emu->isInt64(V))
11751175
return false;
11761176

1177-
Value* Lo, * Hi;
1177+
Value* Lo = nullptr, * Hi = nullptr;
11781178
std::tie(Lo, Hi) = Emu->getExpandedValues(V);
11791179

11801180
Type* V2I32Ty = Emu->getV2Int32Ty();
@@ -1539,7 +1539,7 @@ bool InstExpander::visitSIToFP(SIToFPInst& S2F) {
15391539
if (!Emu->isInt64(Src))
15401540
return false;
15411541

1542-
Value* Lo, * Hi;
1542+
Value* Lo = nullptr, * Hi = nullptr;
15431543
std::tie(Lo, Hi) = Emu->getExpandedValues(Src);
15441544

15451545
Type* DstTy = S2F.getType();
@@ -1615,7 +1615,7 @@ bool InstExpander::visitIntToPtr(IntToPtrInst& I2P) {
16151615
if (!Emu->isInt64(Src))
16161616
return false;
16171617

1618-
Value* Lo, * Hi;
1618+
Value* Lo = nullptr, * Hi = nullptr;
16191619
std::tie(Lo, Hi) = Emu->getExpandedValues(Src);
16201620

16211621
GenISAIntrinsic::ID GIID = GenISAIntrinsic::GenISA_pair_to_ptr;
@@ -1647,7 +1647,7 @@ bool InstExpander::visitBitCast(BitCastInst& BC) {
16471647
if (Emu->isArg64Cast(&BC))
16481648
return false;
16491649

1650-
Value* Lo, * Hi;
1650+
Value* Lo = nullptr, * Hi = nullptr;
16511651
std::tie(Lo, Hi) = Emu->getExpandedValues(Src);
16521652

16531653
Type* V2I32Ty = Emu->getV2Int32Ty();
@@ -1665,12 +1665,12 @@ bool InstExpander::visitICmp(ICmpInst& Cmp) {
16651665
return false;
16661666

16671667
auto Pred = Cmp.getPredicate();
1668-
Value* L0, * H0;
1668+
Value* L0 = nullptr, * H0 = nullptr;
16691669
std::tie(L0, H0) = Emu->getExpandedValues(Cmp.getOperand(0));
1670-
Value* L1, * H1;
1670+
Value* L1 = nullptr, * H1 = nullptr;
16711671
std::tie(L1, H1) = Emu->getExpandedValues(Cmp.getOperand(1));
16721672

1673-
Value* T0, * T1, * T2, * T3, * Res = nullptr;
1673+
Value* T0 = nullptr, * T1 = nullptr, * T2 = nullptr, * T3 = nullptr, * Res = nullptr;
16741674
switch (Pred) {
16751675
default:
16761676
llvm_unreachable("Invalid ICmp predicate");
@@ -1751,7 +1751,7 @@ bool InstExpander::visitICmp(ICmpInst& Cmp) {
17511751
bool InstExpander::visitPHI(PHINode& PN) {
17521752
if (!Emu->isInt64(&PN))
17531753
return false;
1754-
Value* Lo, * Hi;
1754+
Value* Lo = nullptr, * Hi = nullptr;
17551755
std::tie(Lo, Hi) = Emu->getExpandedValues(&PN);
17561756
assert(Lo != nullptr && Hi != nullptr);
17571757
return false;
@@ -1764,7 +1764,7 @@ bool InstExpander::visitCall(CallInst& Call) {
17641764
auto Combine2xi32Toi64 = [this](Value* val)->Value *
17651765
{
17661766
assert(Emu->isInt64(val));
1767-
Value* InputLo, * InputHi;
1767+
Value* InputLo = nullptr, * InputHi = nullptr;
17681768
std::tie(InputLo, InputHi) = Emu->getExpandedValues(val);
17691769
Type* V2I32Ty = Emu->getV2Int32Ty();
17701770
Value* NewVal = UndefValue::get(V2I32Ty);
@@ -1825,7 +1825,7 @@ bool InstExpander::visitCall(CallInst& Call) {
18251825
auto* GenCopy = Call.clone();
18261826
GenCopy->insertBefore(&Call);
18271827
IRB->SetInsertPoint(&Call);
1828-
Value* Lo, * Hi;
1828+
Value* Lo = nullptr, * Hi = nullptr;
18291829
Spliti64To2xi32(GenCopy, Lo, Hi);
18301830
Call.replaceAllUsesWith(GenCopy);
18311831
Emu->setExpandedValues(GenCopy, Lo, Hi);
@@ -1849,7 +1849,7 @@ bool InstExpander::visitCall(CallInst& Call) {
18491849
opNum++;
18501850
}
18511851
IRB->SetInsertPoint(&Call);
1852-
Value* Lo, * Hi;
1852+
Value* Lo = nullptr, * Hi = nullptr;
18531853
Spliti64To2xi32(GenCopy, Lo, Hi);
18541854
Call.replaceAllUsesWith(GenCopy);
18551855
Emu->setExpandedValues(GenCopy, Lo, Hi);
@@ -1927,7 +1927,7 @@ bool InstExpander::visitCall(CallInst& Call) {
19271927
if (Emu->isInt64(&Call))
19281928
{
19291929
IRB->SetInsertPoint(&Call);
1930-
Value* OutputLo, * OutputHi;
1930+
Value* OutputLo = nullptr, * OutputHi = nullptr;
19311931
Spliti64To2xi32(CallCopy, OutputLo, OutputHi);
19321932
Emu->setExpandedValues(CallCopy, OutputLo, OutputHi);
19331933
}
@@ -1968,7 +1968,7 @@ bool InstExpander::visitVAArg(VAArgInst& VAAI) {
19681968
bool InstExpander::visitExtractElement(ExtractElementInst& EEI) {
19691969
// Fix index operand if necessary.
19701970
if (Emu->isInt64(EEI.getIndexOperand())) {
1971-
Value* L;
1971+
Value* L = nullptr;
19721972
std::tie(L, std::ignore) = Emu->getExpandedValues(EEI.getIndexOperand());
19731973
EEI.setOperand(1, L);
19741974
}
@@ -1998,7 +1998,7 @@ bool InstExpander::visitExtractElement(ExtractElementInst& EEI) {
19981998
bool InstExpander::visitInsertElement(InsertElementInst& IEI) {
19991999
// Fix index operand if necessary.
20002000
if (Emu->isInt64(IEI.getOperand(2))) {
2001-
Value* L;
2001+
Value* L = nullptr;
20022002
std::tie(L, std::ignore) = Emu->getExpandedValues(IEI.getOperand(2));
20032003
IEI.setOperand(2, L);
20042004
}
@@ -2011,7 +2011,7 @@ bool InstExpander::visitInsertElement(InsertElementInst& IEI) {
20112011
// NOTE: This is NOT the efficient way to handle that and needs revising
20122012
// later.
20132013

2014-
Value* Lo, * Hi;
2014+
Value* Lo = nullptr, * Hi = nullptr;
20152015
std::tie(Lo, Hi) = Emu->getExpandedValues(V);
20162016

20172017
// Create the emulated vector.

0 commit comments

Comments
 (0)