Skip to content

Commit 373d8b0

Browse files
Artem Gindinsonigcbot
authored andcommitted
Update integer casting for LLVM 14 codebase
Make sure all possible warnings are silenced whenever LLVM 14 is enabled.
1 parent 6e2d9f8 commit 373d8b0

File tree

18 files changed

+61
-65
lines changed

18 files changed

+61
-65
lines changed

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ uint CShader::GetNbVectorElementAndMask(llvm::Value* val, uint32_t& mask)
13951395
uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
13961396
uint32_t totalBytes = eltBytes * elts;
13971397

1398-
unsigned align = LD->getAlignment();
1398+
unsigned align = (unsigned)LD->getAlignment();
13991399

14001400
uint bufferIndex = 0;
14011401
bool directIndexing = false;

IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ uint ConstantCoalescing::GetAlignment(Instruction* load) const
11651165

11661166
if (isa<LoadInst>(load))
11671167
{
1168-
alignment = cast<LoadInst>(load)->getAlignment();
1168+
alignment = (uint)cast<LoadInst>(load)->getAlignment();
11691169
}
11701170
else
11711171
{

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11542,7 +11542,7 @@ void EmitPass::emitLoad(LoadInst* inst, Value* offset, ConstantInt* immOffset)
1154211542
immOffset,
1154311543
inst->getType(),
1154411544
cacheOpts,
11545-
inst->getAlignment());
11545+
(uint32_t)inst->getAlignment());
1154611546
return;
1154711547
}
1154811548
emitVectorLoad(inst, offset, immOffset);
@@ -12697,7 +12697,7 @@ void EmitPass::emitStore(StoreInst* inst, Value* varOffset, ConstantInt* immOffs
1269712697
immOffset,
1269812698
inst->getValueOperand(),
1269912699
cacheOpts,
12700-
inst->getAlignment());
12700+
(uint32_t)inst->getAlignment());
1270112701
return;
1270212702
}
1270312703
emitVectorStore(inst, varOffset, immOffset);
@@ -17960,7 +17960,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
1796017960
IGC_ASSERT_MESSAGE(!(destUniform && !srcUniform),
1796117961
"If ld's dest is uniform, ld's src must be uniform");
1796217962

17963-
unsigned align = inst->getAlignment();
17963+
unsigned align = (unsigned)inst->getAlignment();
1796417964
VISA_Type destType = m_destination->GetType();
1796517965
uint32_t width = numLanes(m_currShader->m_SIMDSize);
1796617966
uint bufferIndex = 0;
@@ -18482,7 +18482,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO
1848218482

1848318483
uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
1848418484
uint32_t totalBytes = elts * eltBytes;
18485-
unsigned align = inst->getAlignment();
18485+
unsigned align = (unsigned)inst->getAlignment();
1848618486
CVariable* storedVar = GetSymbol(storedVal);
1848718487
unsigned int width = numLanes(m_currShader->m_SIMDSize);
1848818488

IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@ namespace {
124124
void setExpandedValues(Value* V, Value* Lo, Value* Hi);
125125

126126
unsigned getAlignment(LoadInst* LD) const {
127-
unsigned Align = LD->getAlignment();
127+
unsigned Align = (unsigned)LD->getAlignment();
128128
if (Align == 0)
129-
Align = DL->getABITypeAlignment(LD->getType());
129+
Align = (unsigned)DL->getABITypeAlignment(LD->getType());
130130
return Align;
131131
}
132132

133133
unsigned getAlignment(StoreInst* ST) const {
134-
unsigned Align = ST->getAlignment();
134+
unsigned Align = (unsigned)ST->getAlignment();
135135
if (Align == 0)
136-
Align = DL->getABITypeAlignment(ST->getType());
136+
Align = (unsigned)DL->getABITypeAlignment(ST->getType());
137137
return Align;
138138
}
139139

IGC/Compiler/CISACodeGen/PartialEmuI64OpsPass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,16 @@ namespace {
125125
bool valueNotStored(Value* V);
126126

127127
unsigned getAlignment(LoadInst* LD) const {
128-
unsigned Align = LD->getAlignment();
128+
unsigned Align = (unsigned)LD->getAlignment();
129129
if (Align == 0)
130-
Align = DL->getABITypeAlignment(LD->getType());
130+
Align = (unsigned)DL->getABITypeAlignment(LD->getType());
131131
return Align;
132132
}
133133

134134
unsigned getAlignment(StoreInst* ST) const {
135-
unsigned Align = ST->getAlignment();
135+
unsigned Align = (unsigned)ST->getAlignment();
136136
if (Align == 0)
137-
Align = DL->getABITypeAlignment(ST->getType());
137+
Align = (unsigned)DL->getABITypeAlignment(ST->getType());
138138
return Align;
139139
}
140140

IGC/Compiler/CISACodeGen/VectorPreProcess.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ namespace
115115
}
116116
unsigned int getAlignment() const
117117
{
118-
return isa<LoadInst>(m_inst) ? getLoad()->getAlignment() : getLdRaw()->getAlignment();
118+
return (unsigned)(isa<LoadInst>(m_inst) ? getLoad()->getAlignment() : getLdRaw()->getAlignment());
119119
}
120120
void setAlignment(unsigned int alignment)
121121
{
@@ -220,7 +220,7 @@ namespace
220220
}
221221
unsigned int getAlignment() const
222222
{
223-
return isa<StoreInst>(m_inst) ? getStore()->getAlignment() : getStoreRaw()->getAlignment();
223+
return (unsigned)(isa<StoreInst>(m_inst) ? getStore()->getAlignment() : getStoreRaw()->getAlignment());
224224
}
225225
void setAlignment(unsigned int alignment)
226226
{

IGC/Compiler/CISACodeGen/VectorProcess.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,11 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
284284
uint32_t align;
285285
if (LI)
286286
{
287-
align = LI->getAlignment();
287+
align = (uint32_t)LI->getAlignment();
288288
}
289289
else if (SI)
290290
{
291-
align = SI->getAlignment();
291+
align = (uint32_t)SI->getAlignment();
292292
}
293293
else
294294
{

IGC/Compiler/CISACodeGen/helper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ namespace IGC
359359
GenISAIntrinsic::GenISA_ldraw_indexed,
360360
tys);
361361

362-
unsigned alignment = inst->getAlignment();
362+
unsigned alignment = (unsigned)inst->getAlignment();
363363
if (alignment == 0)
364-
alignment = DL.getABITypeAlignment(inst->getType());
364+
alignment = (unsigned)DL.getABITypeAlignment(inst->getType());
365365

366366
IRBuilder<> builder(inst);
367367

@@ -406,9 +406,9 @@ namespace IGC
406406
func = GenISAIntrinsic::getDeclaration(module, llvm::GenISAIntrinsic::GenISA_storeraw_indexed, types);
407407
}
408408
IRBuilder<> builder(inst);
409-
unsigned alignment = inst->getAlignment();
409+
unsigned alignment = (unsigned)inst->getAlignment();
410410
if (alignment == 0)
411-
alignment = DL.getABITypeAlignment(storeVal->getType());
411+
alignment = (unsigned)DL.getABITypeAlignment(storeVal->getType());
412412
Value* attr[] =
413413
{
414414
bufPtr,

IGC/Compiler/FixResourcePtr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Value* FixResourcePtr::CreateLoadIntrinsic(LoadInst* inst, Instruction* bufPtr,
249249
unsigned alignment = (inst->getType()->getScalarSizeInBits() / 8);
250250
if (inst->getAlignment() > 0)
251251
{
252-
alignment = inst->getAlignment();
252+
alignment = (unsigned)inst->getAlignment();
253253
}
254254

255255
Value* attr[] =

IGC/Compiler/Legalizer/TypeLegalizer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,17 +578,17 @@ namespace IGC {
578578

579579
template<> inline
580580
unsigned TypeLegalizer::getAlignment(LoadInst* Ld) const {
581-
unsigned Align = Ld->getAlignment();
581+
unsigned Align = (unsigned)Ld->getAlignment();
582582
if (Align == 0)
583-
Align = DL->getABITypeAlignment(Ld->getType());
583+
Align = (unsigned)DL->getABITypeAlignment(Ld->getType());
584584
return Align;
585585
}
586586

587587
template<> inline
588588
unsigned TypeLegalizer::getAlignment(StoreInst* St) const {
589-
unsigned Align = St->getAlignment();
589+
unsigned Align = (unsigned)St->getAlignment();
590590
if (Align == 0)
591-
Align = DL->getABITypeAlignment(St->getValueOperand()->getType());
591+
Align = (unsigned)DL->getABITypeAlignment(St->getValueOperand()->getType());
592592
return Align;
593593
}
594594

0 commit comments

Comments
 (0)