Skip to content

Commit f6f4799

Browse files
committed
[CIR] Fix multiple warnings across CIR codebase
1 parent 7e36fad commit f6f4799

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

clang/lib/CIR/CodeGen/CIRGenBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ uint64_t CIRGenBuilderTy::computeOffsetFromGlobalViewIndices(
119119
llvm::ArrayRef<int64_t> indexes) {
120120

121121
int64_t offset = 0;
122-
for (auto idx : indexes) {
122+
for (int64_t idx : indexes) {
123123
if (auto sTy = dyn_cast<cir::StructType>(typ)) {
124124
offset += sTy.getElementOffset(layout.layout, idx);
125-
assert(idx < sTy.getMembers().size());
125+
assert(idx < (int64_t)sTy.getMembers().size());
126126
typ = sTy.getMembers()[idx];
127127
} else if (auto arTy = dyn_cast<cir::ArrayType>(typ)) {
128128
typ = arTy.getEltType();

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,7 @@ void CIRGenItaniumCXXABI::emitRethrow(CIRGenFunction &CGF, bool isNoReturn) {
22912291
builder.create<cir::BrOp>(loc, rethrowBlock);
22922292
}
22932293

2294-
mlir::Block *remBlock = builder.createBlock(region);
2294+
(void)builder.createBlock(region);
22952295
// This will be erased during codegen, it acts as a placeholder for the
22962296
// operations to be inserted (if any)
22972297
builder.create<cir::ScopeOp>(loc, /*scopeBuilder=*/

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ cir::FuncOp CIRGenModule::GetAddrOfFunction(clang::GlobalDecl gd, mlir::Type ty,
24572457
// stub. For HIP, it's something different.
24582458
if ((langOpts.HIP || langOpts.CUDA) && !langOpts.CUDAIsDevice &&
24592459
cast<FunctionDecl>(gd.getDecl())->hasAttr<CUDAGlobalAttr>()) {
2460-
auto *stubHandle = getCUDARuntime().getKernelHandle(f, gd);
2460+
(void)getCUDARuntime().getKernelHandle(f, gd);
24612461
if (isForDefinition)
24622462
return f;
24632463

@@ -2678,12 +2678,6 @@ cir::FuncOp CIRGenModule::createRuntimeFunction(cir::FuncType ty,
26782678
return entry;
26792679
}
26802680

2681-
static bool isDefaultedMethod(const clang::FunctionDecl *fd) {
2682-
return fd->isDefaulted() && isa<CXXMethodDecl>(fd) &&
2683-
(cast<CXXMethodDecl>(fd)->isCopyAssignmentOperator() ||
2684-
cast<CXXMethodDecl>(fd)->isMoveAssignmentOperator());
2685-
}
2686-
26872681
mlir::Location CIRGenModule::getLocForFunction(const clang::FunctionDecl *fd) {
26882682
bool invalidLoc = !fd || (fd->getSourceRange().getBegin().isInvalid() ||
26892683
fd->getSourceRange().getEnd().isInvalid());

clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ void LoweringPreparePass::buildCUDAModuleCtor() {
11091109
// Corresponding code:
11101110
// gpuBinaryHandle = __cudaRegisterFatBinary(&fatbinWrapper);
11111111
auto fatbinVoidPtr = builder.createBitcast(wrapper, voidPtrTy);
1112-
auto gpuBinaryHandle = builder.createCallOp(loc, regFunc, fatbinVoidPtr);
1112+
builder.createCallOp(loc, regFunc, fatbinVoidPtr);
11131113

11141114
// This is currently incomplete.
11151115
// TODO(cir): create __cuda_register_globals(), and call it here.

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,8 @@ mlir::LLVM::CConv convertCallingConv(cir::CallingConv callinvConv) {
775775
return LLVM::SPIR_KERNEL;
776776
case CIR::SpirFunction:
777777
return LLVM::SPIR_FUNC;
778+
case CIR::OpenCLKernel:
779+
llvm_unreachable("NYI");
778780
}
779781
llvm_unreachable("Unknown calling convention");
780782
}
@@ -2383,7 +2385,6 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
23832385
const auto isDsoLocal = op.getDsolocal();
23842386
const auto linkage = convertLinkage(op.getLinkage());
23852387
const auto symbol = op.getSymName();
2386-
const auto loc = op.getLoc();
23872388
std::optional<mlir::StringRef> section = op.getSection();
23882389
std::optional<mlir::Attribute> init = op.getInitialValue();
23892390
mlir::LLVM::VisibilityAttr visibility = mlir::LLVM::VisibilityAttr::get(

0 commit comments

Comments
 (0)