Skip to content

Commit

Permalink
[NFC] Remove uses of supportsTypedPointers() (KhronosGroup#2106)
Browse files Browse the repository at this point in the history
Also fix 'unused variable' warning.

Signed-off-by: Sidorov, Dmitry <[email protected]>
  • Loading branch information
MrSidims authored Jul 31, 2023
1 parent 42d7c59 commit b0142af
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3204,7 +3204,7 @@ SPIRVToLLVM::SPIRVToLLVM(Module *LLVMModule, SPIRVModule *TheSPIRVModule)
initialize(*M);
Context = &M->getContext();
if (BM->getDesiredBIsRepresentation() == BIsRepresentation::SPIRVFriendlyIR)
UseTargetTypes = !Context->supportsTypedPointers();
UseTargetTypes = true;
DbgTran.reset(new SPIRVToLLVMDbgTran(TheSPIRVModule, LLVMModule, this));
}

Expand Down
9 changes: 0 additions & 9 deletions lib/SPIRV/SPIRVTypeScavenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,6 @@ bool SPIRVTypeScavenger::unifyType(Type *T1, Type *T2) {
}

void SPIRVTypeScavenger::typeModule(Module &M) {
// If typed pointers are in effect, we need to do nothing here.
if (M.getContext().supportsTypedPointers())
return;

// Generate corrected function types for all functions in the module.
for (auto &F : M.functions()) {
deduceFunctionType(F);
Expand Down Expand Up @@ -1049,11 +1045,6 @@ FunctionType *SPIRVTypeScavenger::getFunctionType(Function *F) {

Type *SPIRVTypeScavenger::getScavengedType(Value *V) {
Type *Ty = V->getType();
// If we're called in a typed pointer context, the real type is always the
// correct type.
if (Ty->getContext().supportsTypedPointers())
return Ty;

if (!hasPointerType(Ty))
return Ty;

Expand Down
9 changes: 2 additions & 7 deletions lib/SPIRV/SPIRVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
auto BV = transConstant(Init);
assert(BV);
return mapValue(V, BV);
} else if (ConstantExpr *ConstUE = dyn_cast_or_null<ConstantExpr>(Init)) {
}
if (isa_and_nonnull<ConstantExpr>(Init)) {
BVarInit = transValue(Init, nullptr);
} else if (ST && isa<UndefValue>(Init)) {
// Undef initializer for LLVM structure be can translated to
Expand Down Expand Up @@ -2766,13 +2767,7 @@ bool LLVMToSPIRVBase::transBuiltinSet() {
SPIRVValue *LLVMToSPIRVBase::oclTransSpvcCastSampler(CallInst *CI,
SPIRVBasicBlock *BB) {
assert(CI->getCalledFunction() && "Unexpected indirect call");
llvm::Function *F = CI->getCalledFunction();
auto FT = F->getFunctionType();
auto RT = FT->getReturnType();
assert(FT->getNumParams() == 1);
assert(FT->getParamType(0)->isIntegerTy() && "Invalid sampler type");
auto Arg = CI->getArgOperand(0);

auto *TransRT = transType(getSPIRVType(OpTypeSampler));

auto GetSamplerConstant = [&](uint64_t SamplerValue) {
Expand Down

0 comments on commit b0142af

Please sign in to comment.