Skip to content

Commit 6a557e0

Browse files
FilipFudalasys_zuul
authored andcommitted
[Autobackout]Revert of change: 3244dc1
Get rid of -Wunused-function, Wunused-variable warnings HSD/Radar: n/a Change-Id: I0ba7f75584ec00b4aa4bc8ca4850a4c2a9a777fc
1 parent f1805f7 commit 6a557e0

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

+201
-71
lines changed

IGC/AdaptorCommon/AddCopyIntrinsic.cpp

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

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

131129
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;
132134
for (auto BI = F.begin(), BE = F.end(); BI != BE; ++BI)
133135
{
134136
BasicBlock* BB = &*BI;
@@ -367,7 +369,6 @@ Value* AddCopyIntrinsic::removeUndefWrite(Value* V)
367369
return newVec;
368370
}
369371

370-
#ifdef HANDLE_ALLOCA
371372
void AddCopyIntrinsic::handleAlloca(AllocaInst* AI)
372373
{
373374
if (!isCandidate(AI))
@@ -401,7 +402,6 @@ void AddCopyIntrinsic::handleAlloca(AllocaInst* AI)
401402
m_changed = true;
402403
}
403404
}
404-
#endif
405405

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

IGC/AdaptorCommon/AddImplicitArgs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ 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();
286287

287288
BasicBlock &entry = pNewFunc->getEntryBlock();
288289
newArg = new llvm::BitCastInst(&(*currArg), (*I).getType(), "", &entry.front());
@@ -424,6 +425,7 @@ void AddImplicitArgs::replaceAllUsesWithNewOCLBuiltinFunction(CodeGenContext* ct
424425
std::string str0;
425426
llvm::raw_string_ostream s(str0);
426427
arg->getType()->print(s);
428+
StringRef argTypeName = s.str();
427429

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

IGC/AdaptorOCL/SPIRV/SPIRVInternal.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ 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-
9896
#include <utility>
9997
#include <functional>
10098

@@ -104,10 +102,10 @@ namespace spv {
104102
using namespace llvm;
105103

106104
namespace kOCLTypeQualifierName {
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";
105+
const static char *Const = "const";
106+
const static char *Volatile = "volatile";
107+
const static char *Restrict = "restrict";
108+
const static char *Pipe = "pipe";
111109
}
112110

113111
template<> inline void

IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp

Lines changed: 12 additions & 4 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-
__unused static void
107+
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,6 +1956,14 @@ 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+
19591967
bool
19601968
SPIRVToLLVM::postProcessFunctionsReturnStruct(Function *F) {
19611969

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

36913699
// Generate metadata for initializer
3692-
if (BF->getExecutionMode(ExecutionModeInitializer)) {
3700+
if (auto EM = BF->getExecutionMode(ExecutionModeInitializer)) {
36933701
funcInfo.IsInitializer = true;
36943702
}
36953703

36963704
// Generate metadata for finalizer
3697-
if (BF->getExecutionMode(ExecutionModeFinalizer)) {
3705+
if (auto EM = BF->getExecutionMode(ExecutionModeFinalizer)) {
36983706
funcInfo.IsFinalizer = true;
36993707
}
37003708

@@ -3973,7 +3981,7 @@ SPIRVToLLVM::transCompilerOption() {
39733981
return true;
39743982
}
39753983

3976-
__unused static void dumpSPIRVBC(const char* fname, const char* data, unsigned int size)
3984+
static void dumpSPIRVBC(const char* fname, const char* data, unsigned int size)
39773985
{
39783986
FILE* fp;
39793987
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-
__unused bool hoistMost(bool InvPred, BasicBlock* IfBB,
80+
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 Changed;
292+
return false;
293293
}

IGC/Compiler/CISACodeGen/CISACodeGen.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ 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"
3029

3130
namespace USC
3231
{
@@ -106,7 +105,7 @@ namespace IGC
106105

107106
#define DECLARE_CISA_OPCODE(opCode, name, visaname) \
108107
visaname,
109-
__unused static ISA_Opcode ConvertOpcode[] =
108+
static ISA_Opcode ConvertOpcode[] =
110109
{
111110
#include "isaDef.def"
112111
};

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 (dyn_cast<IntegerType>(CE1->getType())) {
1344+
if (IntegerType * ITy = 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 (llvm::dyn_cast<llvm::PHINode>(ScalarOp))
2759+
if (auto PN = 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 (I.getMetadata("igc.read_only_array"))
278+
if (auto md = 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 (GetValueCCTupleMapping(val))
1190+
if (CoalescingEngine::CCTuple * thisCCTuple = 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 (dyn_cast<Constant>(pVal))
250+
if (const Constant * pConstVal = dyn_cast<Constant>(pVal))
251251
{
252252
if (!isa<GlobalVariable>(pVal) && !isa<ConstantExpr>(pVal))
253253
{

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 46 additions & 3 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::dyn_cast<llvm::RTWritIntrinsic>(ccTuple->GetRoot()))
3995+
if (llvm::RTWritIntrinsic * rtwi = 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 (m_CE->GetValueCCTupleMapping(val))
4033+
if (CoalescingEngine::CCTuple * thisCCTuple = m_CE->GetValueCCTupleMapping(val))
40344034
{
40354035
src[index] = GetSymbol(val);
40364036
}
@@ -6150,7 +6150,7 @@ void EmitPass::interceptSamplePayloadCoalescing(
61506150
}
61516151
else
61526152
{
6153-
if (m_CE->GetValueCCTupleMapping(val))
6153+
if (CoalescingEngine::CCTuple * thisCCTuple = m_CE->GetValueCCTupleMapping(val))
61546154
{
61556155
src = GetSymbol(val);
61566156
}
@@ -8243,6 +8243,17 @@ 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+
82468257
void EmitPass::emitUAVSerialize()
82478258
{
82488259
m_encoder->Wait();
@@ -8470,6 +8481,38 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc
84708481
}
84718482
}
84728483

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+
84738516
void EmitPass::emitLoad(LoadInst* inst, Value* offset, ConstantInt* immOffset)
84748517
{
84758518
emitVectorLoad(inst, offset, immOffset);

IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp

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

137+
bool hasExpandedValues(Value* V) const;
137138
ValuePair getExpandedValues(Value* V);
138139
void setExpandedValues(Value* V, Value* Lo, Value* Hi);
139140

@@ -495,21 +496,25 @@ bool Emu64Ops::runOnFunction(Function& F) {
495496
return Changed;
496497
}
497498

499+
bool Emu64Ops::hasExpandedValues(Value* V) const {
500+
return ValueMap.find(V) != ValueMap.end();
501+
}
502+
498503
ValuePair Emu64Ops::getExpandedValues(Value* V) {
499504
ValueMapTy::iterator VMI;
500505
bool New;
501506
std::tie(VMI, New) = ValueMap.insert(std::make_pair(V, ValuePair()));
502507
if (!New)
503508
return VMI->second;
504509

505-
if (dyn_cast<ConstantInt>(V)) {
510+
if (ConstantInt * CI = dyn_cast<ConstantInt>(V)) {
506511
Value* Lo = IRB->CreateTrunc(V, IRB->getInt32Ty());
507512
Value* Hi = IRB->CreateTrunc(IRB->CreateLShr(V, 32), IRB->getInt32Ty());
508513
VMI->second = std::make_pair(Lo, Hi);
509514
return VMI->second;
510515
}
511516

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

IGC/Compiler/CISACodeGen/EstimateFunctionSize.cpp

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

168-
#if defined(_DEBUG)
169168
void print(raw_ostream& os);
170169

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

175175
} // namespace
176-
#if defined(_DEBUG)
177176

178177
void FunctionNode::print(raw_ostream& os) {
179178
os << "Function: " << F->getName() << ", " << Size << "\n";
@@ -182,7 +181,6 @@ void FunctionNode::print(raw_ostream& os) {
182181
for (auto G : CallerList)
183182
os << "<<<---" << G->getName() << "\n";
184183
}
185-
#endif
186184

187185
void EstimateFunctionSize::clear() {
188186
M = nullptr;

IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,45 @@ 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+
156195
} // end of unnamed namespace
157196

158197

0 commit comments

Comments
 (0)