Skip to content

Commit cd53fb1

Browse files
FilipFudalasys_zuul
authored andcommitted
Get rid of -Wunused-function, Wunused-variable warnings
Change-Id: I3dd9622974f673232a0df287a623223ecc45071a
1 parent 8d8f85a commit cd53fb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+71
-201
lines changed

IGC/AdaptorCommon/AddCopyIntrinsic.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ class AddCopyIntrinsic : public FunctionPass
8585
Value* V,
8686
SmallVector<std::pair<Value*, int>, 16>& EltSrcs);
8787
Value* removeUndefWrite(Value* StoreVal);
88+
#ifdef HANDLE_ALLOCA
8889
void handleAlloca(AllocaInst* AI);
90+
#endif
8991
void handleShuffleVector(ShuffleVectorInst* SVI);
9092

9193
void convertCopyBuiltin(CallInst* CI);
@@ -127,10 +129,6 @@ bool AddCopyIntrinsic::runOnFunction(Function& F)
127129
}
128130

129131
m_changed = false;
130-
BasicBlock *EntryBB = &(F.getEntryBlock());
131-
BasicBlock::iterator II = EntryBB->begin();
132-
BasicBlock::iterator IE = EntryBB->end();
133-
BasicBlock::iterator nextII = II;
134132
for (auto BI = F.begin(), BE = F.end(); BI != BE; ++BI)
135133
{
136134
BasicBlock* BB = &*BI;
@@ -369,6 +367,7 @@ Value* AddCopyIntrinsic::removeUndefWrite(Value* V)
369367
return newVec;
370368
}
371369

370+
#ifdef HANDLE_ALLOCA
372371
void AddCopyIntrinsic::handleAlloca(AllocaInst* AI)
373372
{
374373
if (!isCandidate(AI))
@@ -402,6 +401,7 @@ void AddCopyIntrinsic::handleAlloca(AllocaInst* AI)
402401
m_changed = true;
403402
}
404403
}
404+
#endif
405405

406406
void AddCopyIntrinsic::handleShuffleVector(ShuffleVectorInst* SVI)
407407
{

IGC/AdaptorCommon/AddImplicitArgs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ void AddImplicitArgs::updateNewFuncArgs(llvm::Function* pFunc, llvm::Function* p
283283
std::string str0;
284284
llvm::raw_string_ostream s(str0);
285285
currArg->getType()->print(s);
286-
StringRef argTypeName = s.str();
287286

288287
BasicBlock &entry = pNewFunc->getEntryBlock();
289288
newArg = new llvm::BitCastInst(&(*currArg), (*I).getType(), "", &entry.front());
@@ -425,7 +424,6 @@ void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction(CodeGenContext* ct
425424
std::string str0;
426425
llvm::raw_string_ostream s(str0);
427426
arg->getType()->print(s);
428-
StringRef argTypeName = s.str();
429427

430428
arg = new llvm::BitCastInst(arg, new_arg_iter->getType(), "", cInst);
431429
}

IGC/AdaptorOCL/SPIRV/SPIRVInternal.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9393

9494
#include "common/LLVMWarningsPop.hpp"
9595

96+
#include "../../inc/common/UFO/portable_compiler.h"
97+
9698
#include <utility>
9799
#include <functional>
98100

@@ -102,10 +104,10 @@ namespace spv {
102104
using namespace llvm;
103105

104106
namespace kOCLTypeQualifierName {
105-
const static char *Const = "const";
106-
const static char *Volatile = "volatile";
107-
const static char *Restrict = "restrict";
108-
const static char *Pipe = "pipe";
107+
__unused const static char *Const = "const";
108+
__unused const static char *Volatile = "volatile";
109+
__unused const static char *Restrict = "restrict";
110+
__unused const static char *Pipe = "pipe";
109111
}
110112

111113
template<> inline void

IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ isOpenCLKernel(SPIRVFunction *BF) {
104104
return BF->getModule()->isEntryPoint(ExecutionModelKernel, BF->getId());
105105
}
106106

107-
static void
107+
__unused static void
108108
dumpLLVM(Module *M, const std::string &FName) {
109109
std::error_code EC;
110110
raw_fd_ostream FS(FName, EC, sys::fs::F_None);
@@ -1956,14 +1956,6 @@ SPIRVToLLVM::postProcessOCL() {
19561956
return true;
19571957
}
19581958

1959-
static Value* StripAddrspaceCast(Value *pVal)
1960-
{
1961-
while (Operator::getOpcode(pVal) == Instruction::AddrSpaceCast)
1962-
pVal = cast<Operator>(pVal)->getOperand(0);
1963-
1964-
return pVal;
1965-
}
1966-
19671959
bool
19681960
SPIRVToLLVM::postProcessFunctionsReturnStruct(Function *F) {
19691961

@@ -3697,12 +3689,12 @@ SPIRVToLLVM::transKernelMetadata()
36973689
auto &funcInfo = MD.FuncMD[F];
36983690

36993691
// Generate metadata for initializer
3700-
if (auto EM = BF->getExecutionMode(ExecutionModeInitializer)) {
3692+
if (BF->getExecutionMode(ExecutionModeInitializer)) {
37013693
funcInfo.IsInitializer = true;
37023694
}
37033695

37043696
// Generate metadata for finalizer
3705-
if (auto EM = BF->getExecutionMode(ExecutionModeFinalizer)) {
3697+
if (BF->getExecutionMode(ExecutionModeFinalizer)) {
37063698
funcInfo.IsFinalizer = true;
37073699
}
37083700

@@ -3981,7 +3973,7 @@ SPIRVToLLVM::transCompilerOption() {
39813973
return true;
39823974
}
39833975

3984-
static void dumpSPIRVBC(const char* fname, const char* data, unsigned int size)
3976+
__unused static void dumpSPIRVBC(const char* fname, const char* data, unsigned int size)
39853977
{
39863978
FILE* fp;
39873979
fp = fopen(fname, "wb");

IGC/Compiler/CISACodeGen/AdvCodeMotion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace {
7777
}
7878

7979
bool hoistUniform(BasicBlock* Src, BasicBlock* Dst) const;
80-
bool hoistMost(bool InvPred, BasicBlock* IfBB,
80+
__unused bool hoistMost(bool InvPred, BasicBlock* IfBB,
8181
BasicBlock* TBB, BasicBlock* FBB, BasicBlock* JBB) const;
8282
bool hoistMost2(bool InvPred, BasicBlock* IfBB,
8383
BasicBlock* TBB, BasicBlock* FBB, BasicBlock* JBB) const;

IGC/Compiler/CISACodeGen/AdvMemOpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,5 @@ bool AdvMemOpt::hoistUniformLoad(ArrayRef<BasicBlock*> Line) const {
289289
break;
290290
}
291291
}
292-
return false;
292+
return Changed;
293293
}

IGC/Compiler/CISACodeGen/CISACodeGen.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626
#pragma once
2727
#include "Compiler/CodeGenPublic.h"
2828
#include "visaBuilder_interface.h"
29+
#include "../../inc/common/UFO/portable_compiler.h"
2930

3031
namespace USC
3132
{
@@ -105,7 +106,7 @@ namespace IGC
105106

106107
#define DECLARE_CISA_OPCODE(opCode, name, visaname) \
107108
visaname,
108-
static ISA_Opcode ConvertOpcode[] =
109+
__unused static ISA_Opcode ConvertOpcode[] =
109110
{
110111
#include "isaDef.def"
111112
};

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ uint64_t CShader::GetConstantExpr(ConstantExpr* CE) {
13411341
case Instruction::LShr: {
13421342
Constant* C = CE->getOperand(0);
13431343
if (ConstantExpr * CE1 = dyn_cast<ConstantExpr>(C)) {
1344-
if (IntegerType * ITy = dyn_cast<IntegerType>(CE1->getType())) {
1344+
if (dyn_cast<IntegerType>(CE1->getType())) {
13451345
uint64_t ShAmt = GetImmediateVal(CE->getOperand(1));
13461346
return GetConstantExpr(CE1) >> ShAmt;
13471347
}
@@ -2756,7 +2756,7 @@ bool CShader::CanTreatScalarSourceAsAlias(llvm::InsertElementInst* IEI) {
27562756
if (!isa<llvm::Instruction>(ScalarOp))
27572757
return false;
27582758
// Skip the scalar operand may be treated as alias.
2759-
if (auto PN = llvm::dyn_cast<llvm::PHINode>(ScalarOp))
2759+
if (llvm::dyn_cast<llvm::PHINode>(ScalarOp))
27602760
return false;
27612761
if (auto EEI = llvm::dyn_cast<llvm::ExtractElementInst>(ScalarOp)) {
27622762
if (CanTreatAsAlias(EEI))

IGC/Compiler/CISACodeGen/CheckInstrTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void CheckInstrTypes::visitAllocaInst(AllocaInst& I)
275275
g_InstrTypes->hasPrimitiveAlloca = true;
276276
}
277277

278-
if (auto md = I.getMetadata("igc.read_only_array"))
278+
if (I.getMetadata("igc.read_only_array"))
279279
{
280280
g_InstrTypes->hasReadOnlyArray = true;
281281
}

IGC/Compiler/CISACodeGen/CoalescingEngine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ namespace IGC
11871187
}
11881188
else
11891189
{
1190-
if (CoalescingEngine::CCTuple * thisCCTuple = GetValueCCTupleMapping(val))
1190+
if (GetValueCCTupleMapping(val))
11911191
{
11921192
if (!payloadOffsetComputed)
11931193
{

IGC/Compiler/CISACodeGen/DebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void DebugInfoData::markOutputVars(const llvm::Instruction* pInst)
247247
return;
248248
}
249249

250-
if (const Constant * pConstVal = dyn_cast<Constant>(pVal))
250+
if (dyn_cast<Constant>(pVal))
251251
{
252252
if (!isa<GlobalVariable>(pVal) && !isa<ConstantExpr>(pVal))
253253
{

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3992,7 +3992,7 @@ bool EmitPass::interceptRenderTargetWritePayloadCoalescing(
39923992
{
39933993
assert(ccTuple->GetRoot()); //in other words, there is a 'supremum' element
39943994
assert(llvm::isa<llvm::RTWritIntrinsic>(ccTuple->GetRoot()));
3995-
if (llvm::RTWritIntrinsic * rtwi = llvm::dyn_cast<llvm::RTWritIntrinsic>(ccTuple->GetRoot()))
3995+
if (llvm::dyn_cast<llvm::RTWritIntrinsic>(ccTuple->GetRoot()))
39963996
{
39973997
//Take left reserved offset from 'root' of the group, not from this instruction.
39983998
offset = m_CE->GetLeftReservedOffset(ccTuple->GetRoot(), m_currShader->m_SIMDSize);
@@ -4030,7 +4030,7 @@ bool EmitPass::interceptRenderTargetWritePayloadCoalescing(
40304030
}
40314031
else
40324032
{
4033-
if (CoalescingEngine::CCTuple * thisCCTuple = m_CE->GetValueCCTupleMapping(val))
4033+
if (m_CE->GetValueCCTupleMapping(val))
40344034
{
40354035
src[index] = GetSymbol(val);
40364036
}
@@ -6150,7 +6150,7 @@ void EmitPass::interceptSamplePayloadCoalescing(
61506150
}
61516151
else
61526152
{
6153-
if (CoalescingEngine::CCTuple * thisCCTuple = m_CE->GetValueCCTupleMapping(val))
6153+
if (m_CE->GetValueCCTupleMapping(val))
61546154
{
61556155
src = GetSymbol(val);
61566156
}
@@ -8243,17 +8243,6 @@ void EmitPass::emitExtract(llvm::Instruction* inst)
82438243
}
82448244
}
82458245

8246-
static bool IsOWordAlignedLoad(LoadInst* inst)
8247-
{
8248-
Value* ptrOpnd = inst->getPointerOperand();
8249-
if (ptrOpnd && isa<CallInst>(ptrOpnd) && GetOpCode(cast<CallInst>(ptrOpnd)) == llvm_owordptr)
8250-
{
8251-
assert(inst->getAlignment() == 16);
8252-
return true;
8253-
}
8254-
return false;
8255-
}
8256-
82578246
void EmitPass::emitUAVSerialize()
82588247
{
82598248
m_encoder->Wait();
@@ -8481,38 +8470,6 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc
84818470
}
84828471
}
84838472

8484-
/// getMsgBlockSizes() - Return the block size and number of blocks considering
8485-
/// the alignment.
8486-
static std::pair<unsigned, unsigned>
8487-
getMsgBlockSizes(unsigned sizeInBits, unsigned alignInBits) {
8488-
// BYTE
8489-
if (sizeInBits == 8)
8490-
return std::make_pair(8, 1);
8491-
8492-
// WORD
8493-
if (sizeInBits == 16) // W or short is supported through <2 x i8>.
8494-
return std::make_pair(8, 2);
8495-
8496-
// DWORD/QWORD need alignement checking.
8497-
bool isAligned = (alignInBits == 0) || (sizeInBits <= alignInBits);
8498-
8499-
// DWORD
8500-
if (sizeInBits == 32) {
8501-
if (isAligned)
8502-
return std::make_pair(32, 1);
8503-
return std::make_pair(8, 4);
8504-
}
8505-
8506-
// QWORD
8507-
if (sizeInBits == 64) {
8508-
if (isAligned)
8509-
return std::make_pair(64, 1);
8510-
return std::make_pair(8, 8);
8511-
}
8512-
assert(false && "Unsupported block size!");
8513-
return std::make_pair(~0U, ~0U);
8514-
}
8515-
85168473
void EmitPass::emitLoad(LoadInst* inst, Value* offset, ConstantInt* immOffset)
85178474
{
85188475
emitVectorLoad(inst, offset, immOffset);

IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ namespace {
134134
return VectorType::get(IRB->getInt32Ty(), NumElts * 2);
135135
}
136136

137-
bool hasExpandedValues(Value* V) const;
138137
ValuePair getExpandedValues(Value* V);
139138
void setExpandedValues(Value* V, Value* Lo, Value* Hi);
140139

@@ -496,25 +495,21 @@ bool Emu64Ops::runOnFunction(Function& F) {
496495
return Changed;
497496
}
498497

499-
bool Emu64Ops::hasExpandedValues(Value* V) const {
500-
return ValueMap.find(V) != ValueMap.end();
501-
}
502-
503498
ValuePair Emu64Ops::getExpandedValues(Value* V) {
504499
ValueMapTy::iterator VMI;
505500
bool New;
506501
std::tie(VMI, New) = ValueMap.insert(std::make_pair(V, ValuePair()));
507502
if (!New)
508503
return VMI->second;
509504

510-
if (ConstantInt * CI = dyn_cast<ConstantInt>(V)) {
505+
if (dyn_cast<ConstantInt>(V)) {
511506
Value* Lo = IRB->CreateTrunc(V, IRB->getInt32Ty());
512507
Value* Hi = IRB->CreateTrunc(IRB->CreateLShr(V, 32), IRB->getInt32Ty());
513508
VMI->second = std::make_pair(Lo, Hi);
514509
return VMI->second;
515510
}
516511

517-
if (UndefValue * Undef = dyn_cast<UndefValue>(V)) {
512+
if (dyn_cast<UndefValue>(V)) {
518513
Value* Lo = UndefValue::get(IRB->getInt32Ty());
519514
Value* Hi = UndefValue::get(IRB->getInt32Ty());
520515
VMI->second = std::make_pair(Lo, Hi);

IGC/Compiler/CISACodeGen/EstimateFunctionSize.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,15 @@ namespace {
165165
}
166166
}
167167

168+
#if defined(_DEBUG)
168169
void print(raw_ostream& os);
169170

170-
#if defined(_DEBUG)
171171
void dump() { print(llvm::errs()); }
172172
#endif
173173
};
174174

175175
} // namespace
176+
#if defined(_DEBUG)
176177

177178
void FunctionNode::print(raw_ostream& os) {
178179
os << "Function: " << F->getName() << ", " << Size << "\n";
@@ -181,6 +182,7 @@ void FunctionNode::print(raw_ostream& os) {
181182
for (auto G : CallerList)
182183
os << "<<<---" << G->getName() << "\n";
183184
}
185+
#endif
184186

185187
void EstimateFunctionSize::clear() {
186188
M = nullptr;

IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -153,45 +153,6 @@ namespace {
153153
CollectGeometryShaderProperties* m_gsProps;
154154
};
155155

156-
/// Returns the position of an attribute within the Vertex Header based on the semantics
157-
/// of the attribute.
158-
Unit<Element> GetOffsetInHeader(SGVUsage usage)
159-
{
160-
switch (usage)
161-
{
162-
case POINT_WIDTH:
163-
return Unit<Element>(3);
164-
case POSITION_X:
165-
return Unit<Element>(4);
166-
case POSITION_Y:
167-
return Unit<Element>(5);
168-
case POSITION_Z:
169-
return Unit<Element>(6);
170-
case POSITION_W:
171-
return Unit<Element>(7);
172-
case CLIP_DISTANCE_X:
173-
return Unit<Element>(8);
174-
case CLIP_DISTANCE_Y:
175-
return Unit<Element>(9);
176-
case CLIP_DISTANCE_Z:
177-
return Unit<Element>(10);
178-
case CLIP_DISTANCE_W:
179-
return Unit<Element>(11);
180-
default:
181-
assert(0 && "unknown SGV usage");
182-
return Unit<Element>(0);
183-
}
184-
}
185-
186-
llvm::Value* CreateImmediate(llvm::Module* pModule, uint immediate)
187-
{
188-
llvm::Value* pImm =
189-
llvm::ConstantInt::get(
190-
llvm::Type::getInt32Ty(pModule->getContext()), immediate);
191-
192-
return pImm;
193-
}
194-
195156
} // end of unnamed namespace
196157

197158

0 commit comments

Comments
 (0)