Skip to content

Commit 6d1b387

Browse files
committed
[CIR] Silence warnings introduced in the past few weeks
1 parent 95a497b commit 6d1b387

File tree

8 files changed

+62
-31
lines changed

8 files changed

+62
-31
lines changed

clang/lib/CIR/CodeGen/CIRGenAtomic.cpp

+26-16
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,13 @@ static void emitAtomicOp(CIRGenFunction &CGF, AtomicExpr *E, Address Dest,
737737
fetchAttr = cir::AtomicFetchKindAttr::get(builder.getContext(),
738738
cir::AtomicFetchKind::Nand);
739739
break;
740+
case AtomicExpr::AO__atomic_test_and_set: {
741+
llvm_unreachable("NYI");
742+
}
743+
744+
case AtomicExpr::AO__atomic_clear: {
745+
llvm_unreachable("NYI");
746+
}
740747
}
741748

742749
assert(Op.size() && "expected operation name to build");
@@ -854,6 +861,8 @@ RValue CIRGenFunction::emitAtomicExpr(AtomicExpr *E) {
854861
case AtomicExpr::AO__c11_atomic_load:
855862
case AtomicExpr::AO__opencl_atomic_load:
856863
case AtomicExpr::AO__hip_atomic_load:
864+
case AtomicExpr::AO__atomic_test_and_set:
865+
case AtomicExpr::AO__atomic_clear:
857866
break;
858867

859868
case AtomicExpr::AO__atomic_load:
@@ -1144,6 +1153,8 @@ RValue CIRGenFunction::emitAtomicExpr(AtomicExpr *E) {
11441153
case AtomicExpr::AO__opencl_atomic_fetch_max:
11451154
case AtomicExpr::AO__scoped_atomic_fetch_max:
11461155
case AtomicExpr::AO__scoped_atomic_max_fetch:
1156+
case AtomicExpr::AO__atomic_test_and_set:
1157+
case AtomicExpr::AO__atomic_clear:
11471158
llvm_unreachable("Integral atomic operations always become atomicrmw!");
11481159
}
11491160

@@ -1175,22 +1186,21 @@ RValue CIRGenFunction::emitAtomicExpr(AtomicExpr *E) {
11751186
llvm_unreachable("NYI");
11761187
}
11771188

1178-
[[maybe_unused]] bool IsStore =
1179-
E->getOp() == AtomicExpr::AO__c11_atomic_store ||
1180-
E->getOp() == AtomicExpr::AO__opencl_atomic_store ||
1181-
E->getOp() == AtomicExpr::AO__hip_atomic_store ||
1182-
E->getOp() == AtomicExpr::AO__atomic_store ||
1183-
E->getOp() == AtomicExpr::AO__atomic_store_n ||
1184-
E->getOp() == AtomicExpr::AO__scoped_atomic_store ||
1185-
E->getOp() == AtomicExpr::AO__scoped_atomic_store_n;
1186-
[[maybe_unused]] bool IsLoad =
1187-
E->getOp() == AtomicExpr::AO__c11_atomic_load ||
1188-
E->getOp() == AtomicExpr::AO__opencl_atomic_load ||
1189-
E->getOp() == AtomicExpr::AO__hip_atomic_load ||
1190-
E->getOp() == AtomicExpr::AO__atomic_load ||
1191-
E->getOp() == AtomicExpr::AO__atomic_load_n ||
1192-
E->getOp() == AtomicExpr::AO__scoped_atomic_load ||
1193-
E->getOp() == AtomicExpr::AO__scoped_atomic_load_n;
1189+
bool IsStore = E->getOp() == AtomicExpr::AO__c11_atomic_store ||
1190+
E->getOp() == AtomicExpr::AO__opencl_atomic_store ||
1191+
E->getOp() == AtomicExpr::AO__hip_atomic_store ||
1192+
E->getOp() == AtomicExpr::AO__atomic_store ||
1193+
E->getOp() == AtomicExpr::AO__atomic_store_n ||
1194+
E->getOp() == AtomicExpr::AO__scoped_atomic_store ||
1195+
E->getOp() == AtomicExpr::AO__scoped_atomic_store_n ||
1196+
E->getOp() == AtomicExpr::AO__atomic_clear;
1197+
bool IsLoad = E->getOp() == AtomicExpr::AO__c11_atomic_load ||
1198+
E->getOp() == AtomicExpr::AO__opencl_atomic_load ||
1199+
E->getOp() == AtomicExpr::AO__hip_atomic_load ||
1200+
E->getOp() == AtomicExpr::AO__atomic_load ||
1201+
E->getOp() == AtomicExpr::AO__atomic_load_n ||
1202+
E->getOp() == AtomicExpr::AO__scoped_atomic_load ||
1203+
E->getOp() == AtomicExpr::AO__scoped_atomic_load_n;
11941204

11951205
if (auto ordAttr = getConstOpIntAttr(Order)) {
11961206
// We should not ever get to a case where the ordering isn't a valid CABI

clang/lib/CIR/CodeGen/CIRGenBuilder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ uint64_t CIRGenBuilderTy::computeOffsetFromGlobalViewIndices(
118118
const cir::CIRDataLayout &layout, mlir::Type typ,
119119
llvm::ArrayRef<int64_t> indexes) {
120120

121-
uint64_t offset = 0;
121+
int64_t offset = 0;
122122
for (auto idx : indexes) {
123123
if (auto sTy = dyn_cast<cir::StructType>(typ)) {
124124
offset += sTy.getElementOffset(layout.layout, idx);

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ void CIRGenFunction::emitDecl(const Decl &D) {
813813
case Decl::Friend:
814814
case Decl::FriendTemplate:
815815
case Decl::Block:
816+
case Decl::OutlinedFunction:
816817
case Decl::Captured:
817818
case Decl::UsingShadow:
818819
case Decl::ConstructorUsingShadow:

clang/lib/CIR/CodeGen/CIRGenExprCXX.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,6 @@ void CIRGenFunction::emitNewArrayInitializer(
882882
CleanupDeactivationScope deactivation(*this);
883883

884884
CharUnits ElementSize = getContext().getTypeSizeInChars(ElementType);
885-
CharUnits ElementAlign =
886-
BeginPtr.getAlignment().alignmentOfArrayElement(ElementSize);
887885

888886
// Attempt to perform zero-initialization using memset.
889887
auto TryMemsetInitialization = [&]() -> bool {

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2751,7 +2751,6 @@ Address CIRGenARMCXXABI::initializeArrayCookie(CIRGenFunction &cgf,
27512751
Address cookie = Address(cookiePtr, cgf.SizeTy, newPtr.getAlignment());
27522752

27532753
ASTContext &ctx = getContext();
2754-
CharUnits sizeSize = cgf.getSizeSize();
27552754
mlir::Location loc = cgf.getLoc(expr->getSourceRange());
27562755

27572756
// The first element is the element size.

clang/lib/CIR/CodeGen/CIRGenStmt.cpp

+31-4
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *S,
107107
switch (S->getStmtClass()) {
108108
case Stmt::OMPScopeDirectiveClass:
109109
llvm_unreachable("NYI");
110-
case Stmt::OpenACCCombinedConstructClass:
111-
case Stmt::OpenACCComputeConstructClass:
112-
case Stmt::OpenACCLoopConstructClass:
113110
case Stmt::OMPErrorDirectiveClass:
114111
case Stmt::NoStmtClass:
115112
case Stmt::CXXCatchStmtClass:
@@ -128,6 +125,7 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *S,
128125
case Stmt::DefaultStmtClass:
129126
case Stmt::CaseStmtClass:
130127
case Stmt::SEHLeaveStmtClass:
128+
case Stmt::SYCLKernelCallStmtClass:
131129
llvm_unreachable("should have emitted these statements as simple");
132130

133131
#define STMT(Type, Base)
@@ -271,7 +269,19 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *S,
271269
case Stmt::OMPReverseDirectiveClass:
272270
case Stmt::OMPInterchangeDirectiveClass:
273271
case Stmt::OMPAssumeDirectiveClass:
274-
case Stmt::OMPMaskedDirectiveClass: {
272+
case Stmt::OMPMaskedDirectiveClass:
273+
case Stmt::OpenACCComputeConstructClass:
274+
case Stmt::OpenACCLoopConstructClass:
275+
case Stmt::OpenACCCombinedConstructClass:
276+
case Stmt::OpenACCDataConstructClass:
277+
case Stmt::OpenACCEnterDataConstructClass:
278+
case Stmt::OpenACCExitDataConstructClass:
279+
case Stmt::OpenACCHostDataConstructClass:
280+
case Stmt::OpenACCWaitConstructClass:
281+
case Stmt::OpenACCInitConstructClass:
282+
case Stmt::OpenACCShutdownConstructClass:
283+
case Stmt::OpenACCSetConstructClass:
284+
case Stmt::OpenACCUpdateConstructClass: {
275285
llvm::errs() << "CIR codegen for '" << S->getStmtClassName()
276286
<< "' not implemented\n";
277287
assert(0 && "not implemented");
@@ -328,6 +338,23 @@ mlir::LogicalResult CIRGenFunction::emitSimpleStmt(const Stmt *S,
328338
llvm::errs() << "CIR codegen for '" << S->getStmtClassName()
329339
<< "' not implemented\n";
330340
assert(0 && "not implemented");
341+
case Stmt::SYCLKernelCallStmtClass:
342+
// SYCL kernel call statements are generated as wrappers around the body
343+
// of functions declared with the sycl_kernel_entry_point attribute. Such
344+
// functions are used to specify how a SYCL kernel (a function object) is
345+
// to be invoked; the SYCL kernel call statement contains a transformed
346+
// variation of the function body and is used to generate a SYCL kernel
347+
// caller function; a function that serves as the device side entry point
348+
// used to execute the SYCL kernel. The sycl_kernel_entry_point attributed
349+
// function is invoked by host code in order to trigger emission of the
350+
// device side SYCL kernel caller function and to generate metadata needed
351+
// by SYCL run-time library implementations; the function is otherwise
352+
// intended to have no effect. As such, the function body is not evaluated
353+
// as part of the invocation during host compilation (and the function
354+
// should not be called or emitted during device compilation); the SYCL
355+
// kernel call statement is thus handled as a null statement for the
356+
// purpose of code generation.
357+
break;
331358
}
332359

333360
return mlir::success();

clang/lib/CIR/FrontendAction/CIRGenAction.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ class CIRGenConsumer : public clang::ASTConsumer {
111111

112112
CompilerInstance &compilerInstance;
113113
DiagnosticsEngine &diagnosticsEngine;
114-
const HeaderSearchOptions &headerSearchOptions;
114+
[[maybe_unused]] const HeaderSearchOptions &headerSearchOptions;
115115
CodeGenOptions &codeGenOptions;
116-
const TargetOptions &targetOptions;
117-
const LangOptions &langOptions;
116+
[[maybe_unused]] const TargetOptions &targetOptions;
117+
[[maybe_unused]] const LangOptions &langOptions;
118118
const FrontendOptions &feOptions;
119119

120120
std::unique_ptr<raw_pwrite_stream> outputStream;

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

-4
Original file line numberDiff line numberDiff line change
@@ -830,10 +830,6 @@ void convertSideEffectForCall(mlir::Operation *callOp,
830830
noUnwind = true;
831831
willReturn = true;
832832
break;
833-
834-
default:
835-
callOp->emitError("unknown side effect");
836-
break;
837833
}
838834
}
839835

0 commit comments

Comments
 (0)