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
{

0 commit comments

Comments
 (0)