Author: Konstantinos Parasyris Date: 2026-11-08T19:56:15-08:00 New Revision: 25dfe760a91eb5a62da11c3e031e87af6b2fca11
URL: https://github.com/llvm/llvm-project/commit/25dfe760a91eb5a62da11c3e031e87af6b2fca11 DIFF: https://github.com/llvm/llvm-project/commit/25dfe760a91eb5a62da11c3e031e87af6b2fca11.diff LOG: [CIR] Emit no-trapping-math and stack-protector-buffer-size function attribute (#234029) Mirror classic codegen's `getDefaultFunctionAttributes` by setting `"no-trapping-math"` (when FP exceptions are ignored) and `"stack-protector-buffer-size"` on function definitions and declarations. Both are lowered to LLVM IR through the `passthrough` attribute array, since `llvm.func` has no dedicated fields for them. Most changes are related to testing. --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Added: clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.c clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.cpp clang/test/CIR/CodeGen/no-trapping-math-strictfp.c clang/test/CIR/Lowering/no-trapping-math-ssp-buffer-size.cir Modified: clang/include/clang/CIR/Dialect/IR/CIRAttrs.td clang/include/clang/CIR/Dialect/IR/CIRDialect.td clang/lib/CIR/CodeGen/CIRGenCall.cpp clang/lib/CIR/CodeGen/CIRGenModule.cpp clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp clang/test/CIR/CodeGen/asm-label-inline-builtins.c clang/test/CIR/CodeGen/call-conv-lowering-x86_64-no-noundef.cpp clang/test/CIR/CodeGen/global-array-dtor.cpp clang/test/CIR/CodeGen/global-constant-storage.cpp clang/test/CIR/CodeGen/global-init.cpp clang/test/CIR/CodeGen/global-tls-dyn-init.cpp clang/test/CIR/CodeGen/global-tls-simple-init.cpp clang/test/CIR/CodeGen/global-tls-templates.cpp clang/test/CIR/CodeGen/lowering-lang-options.cpp clang/test/CIR/CodeGen/throws.cpp clang/test/CIR/CodeGenCUDA/vtable-host-device.cu clang/test/CIR/CodeGenCXX/typeid.cpp clang/test/CIR/CodeGenSYCL/kernel-caller-attributes.cpp clang/test/CIR/IR/lowering-lang-options.cir clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir clang/test/CIR/Transforms/lowering-prepare.cir Removed: ################################################################################ diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td index 38af2fbfae4b42..2fb7102b0ccf2c 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td @@ -2689,12 +2689,21 @@ def CIR_LoweringOptionsAttr `LangOptions::ClangABI`; it is an `i32` rather than a CIR enum because `ClangABI` gains an enumerator every Clang release (see `clang/Basic/ABIVersions.def`), and the ordinal round-trips fine within a - single toolchain. + single toolchain. `no_trapping_math` is true when + `LangOptions::getDefaultExceptionMode()` is `FPE_Ignore`. The following fields come from `CodeGenOptions`. `enable_noundef_attrs` mirrors `CodeGenOptions::EnableNoundefAttrs`, which calling convention lowering reads when it decides whether an - argument is `noundef`. + argument is `noundef`. `ssp_buffer_size` mirrors + `CodeGenOptions::SSPBufferSize`. + + `LowerToLLVM` turns `no_trapping_math` and `ssp_buffer_size` into the + `"no-trapping-math"` and `"stack-protector-buffer-size"` LLVM function + attributes of every function not marked `runtime_func`. A `strictfp` + function does not get `"no-trapping-math"`, since a pragma such as + `float_control(except, on)` can make its FP operations observe exceptions + even when the TU-wide default ignores them. Example: ``` @@ -2702,7 +2711,8 @@ def CIR_LoweringOptionsAttr exceptions = false, threadsafe_statics = true, cuda = false, cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 17, - enable_noundef_attrs = false>} { } + long_double_size = 0, enable_noundef_attrs = false, + no_trapping_math = true, ssp_buffer_size = 8>} { } ``` }]; @@ -2718,13 +2728,16 @@ def CIR_LoweringOptionsAttr "bool":$openmp_is_target_device, "int32_t":$clang_abi_compat, "int32_t":$long_double_size, - "bool":$enable_noundef_attrs + "bool":$enable_noundef_attrs, + "bool":$no_trapping_math, + "uint32_t":$ssp_buffer_size ); let assemblyFormat = [{ `<` struct($exceptions, $threadsafe_statics, $cuda, $cuda_is_device, $hip, $hlsl, $gpu_rdc, $openmp, $openmp_is_target_device, - $clang_abi_compat, $long_double_size, $enable_noundef_attrs) `>` + $clang_abi_compat, $long_double_size, $enable_noundef_attrs, + $no_trapping_math, $ssp_buffer_size) `>` }]; let canHaveIllegalCXXABIType = 0; diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td index 54d7370a7990fa..31283c32f0e44e 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td @@ -99,6 +99,11 @@ def CIR_Dialect : Dialect { static llvm::StringRef getTrapFuncNameAttrName() { return "trap_func_name"; } static llvm::StringRef getZeroCallUsedRegsAttrName() { return "zero_call_used_regs"; } static llvm::StringRef getSaveRegParamsAttrName() { return "save_reg_params"; } + // Marks a runtime library function (classic codegen's + // CreateRuntimeFunction). Unlike every other function, it does not get the + // TU-wide default function attributes recorded in + // #cir.lowering_options. + static llvm::StringRef getRuntimeFuncAttrName() { return "runtime_func"; } static llvm::StringRef getDefaultFuncAttrsAttrName() { return "default_func_attrs"; } static llvm::StringRef getUniformWorkGroupSizeAttrName() { return "uniform_work_group_size"; } static llvm::StringRef getResAttrsAttrName() { return "res_attrs"; } diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp index 0cdc128d13c388..22a7f909e9730a 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp @@ -259,12 +259,12 @@ static void addTrivialDefaultFunctionAttributes( // TODO(cir): a number of other attribute 1-offs based on codegen/lang opts // should be done here: less-recise-fpmad null-pointer-is-valid - // no-trapping-math // various inf/nan/nsz/etc work here. // - // TODO(cir): set stack-protector buffer size attribute (sorted oddly in - // classic compiler inside of the above region, but should be done on its - // own). + // no-trapping-math and stack-protector-buffer-size are TU-wide, so they + // live in #cir.lowering_options and LowerToLLVM adds them to every + // function not marked as a runtime function. + // TODO(cir): other attributes here: // reciprocal estimates, prefer-vector-width, stackrealign, backchain, // split-stack, speculative-load-hardening. diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 80822f17bec428..d7632b95309e8e 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -208,7 +208,10 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, /*clang_abi_compat=*/ static_cast<int32_t>(langOpts.getClangABICompat()), static_cast<int32_t>(langOpts.LongDoubleSize), - /*enable_noundef_attrs=*/cgo.EnableNoundefAttrs)); + /*enable_noundef_attrs=*/cgo.EnableNoundefAttrs, + /*no_trapping_math=*/langOpts.getDefaultExceptionMode() == + LangOptions::FPE_Ignore, + /*ssp_buffer_size=*/cgo.SSPBufferSize)); if (cgo.OptimizationLevel > 0 || cgo.OptimizeSize > 0) getModule()->setAttr(cir::CIRDialect::getOptInfoAttrName(), @@ -4060,6 +4063,8 @@ cir::FuncOp CIRGenModule::createRuntimeFunction(cir::FuncType ty, if (assumeConvergent) errorNYI("createRuntimeFunction: assumeConvergent"); + extraAttrs.set(cir::CIRDialect::getRuntimeFuncAttrName(), + mlir::UnitAttr::get(&getMLIRContext())); cir::FuncOp entry = getOrCreateCIRFunction(name, ty, GlobalDecl(), /*forVtable=*/false, extraAttrs); diff --git a/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp b/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp index 7540abab7b046b..c40983509864af 100644 --- a/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp +++ b/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp @@ -74,6 +74,8 @@ static cir::FuncOp getOrCreateRuntimeFuncDecl(mlir::ModuleOp mod, auto funcOp = cir::FuncOp::create(builder, loc, name, funcTy); funcOp.setLinkage(cir::GlobalLinkageKind::ExternalLinkage); funcOp.setPrivate(); + funcOp->setAttr(cir::CIRDialect::getRuntimeFuncAttrName(), + builder.getUnitAttr()); // This pass runs after CallConvLowering and builds the declaration in its // target ABI form already. funcOp.setRequiresCallConvLowering(false); diff --git a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp index 2271f7e3b200a6..8b0dc90575d163 100644 --- a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp +++ b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp @@ -176,10 +176,12 @@ struct LoweringPreparePass /// Materialize global ctor/dtor list void buildGlobalCtorDtorList(); + /// Init and cleanup functions pass \p hasDefaultFuncAttrs true. cir::FuncOp buildRuntimeFunction( mlir::OpBuilder &builder, llvm::StringRef name, mlir::Location loc, cir::FuncType type, - cir::GlobalLinkageKind linkage = cir::GlobalLinkageKind::ExternalLinkage); + cir::GlobalLinkageKind linkage = cir::GlobalLinkageKind::ExternalLinkage, + bool hasDefaultFuncAttrs = false); cir::GlobalOp getOrCreateRuntimeVariable( mlir::OpBuilder &builder, llvm::StringRef name, mlir::Location loc, @@ -656,7 +658,8 @@ cir::GlobalOp LoweringPreparePass::getOrCreateRuntimeVariable( cir::FuncOp LoweringPreparePass::buildRuntimeFunction( mlir::OpBuilder &builder, llvm::StringRef name, mlir::Location loc, - cir::FuncType type, cir::GlobalLinkageKind linkage) { + cir::FuncType type, cir::GlobalLinkageKind linkage, + bool hasDefaultFuncAttrs) { cir::FuncOp f = dyn_cast_or_null<FuncOp>(SymbolTable::lookupNearestSymbolFrom( mlirModule, StringAttr::get(mlirModule->getContext(), name))); if (!f) { @@ -665,6 +668,9 @@ cir::FuncOp LoweringPreparePass::buildRuntimeFunction( cir::GlobalLinkageKindAttr::get(builder.getContext(), linkage)); mlir::SymbolTable::setSymbolVisibility( f, mlir::SymbolTable::Visibility::Private); + if (!hasDefaultFuncAttrs) + f->setAttr(cir::CIRDialect::getRuntimeFuncAttrName(), + builder.getUnitAttr()); assert(!cir::MissingFeatures::opFuncExtraAttrs()); } @@ -1247,7 +1253,8 @@ LoweringPreparePass::buildGlobalArrayDtorFunc(CIRBaseBuilderTy &builder, cir::FuncType::get({builder.getVoidPtrTy()}, builder.getVoidTy()); cir::FuncOp dtorFunc = buildRuntimeFunction(builder, fnName, op->getLoc(), fnType, - cir::GlobalLinkageKind::InternalLinkage); + cir::GlobalLinkageKind::InternalLinkage, + /*hasDefaultFuncAttrs=*/true); SmallVector<mlir::NamedAttribute> paramAttrs; paramAttrs.push_back( @@ -1416,7 +1423,8 @@ LoweringPreparePass::buildCXXGlobalVarDeclInitFunc(cir::GlobalOp op) { cir::VoidType voidTy = builder.getVoidTy(); auto fnType = cir::FuncType::get({}, voidTy); FuncOp f = buildRuntimeFunction(builder, fnName, op.getLoc(), fnType, - cir::GlobalLinkageKind::InternalLinkage); + cir::GlobalLinkageKind::InternalLinkage, + /*hasDefaultFuncAttrs=*/true); // Forward the constrained floating-point marker recorded on the global by // CodeGen onto the generated initializer function. The marker on the global @@ -1555,7 +1563,8 @@ cir::FuncOp LoweringPreparePass::getTlsInitFn() { mlir::Location loc = mlirModule.getLoc(); auto fnType = builder.getVoidFnTy(); return buildRuntimeFunction(builder, "__tls_init", loc, fnType, - cir::GlobalLinkageKind::InternalLinkage); + cir::GlobalLinkageKind::InternalLinkage, + /*hasDefaultFuncAttrs=*/true); } cir::GlobalOp LoweringPreparePass::createGuardGlobalOp( @@ -2250,8 +2259,9 @@ cir::FuncOp LoweringPreparePass::buildGlobalInitCallerFunc( CIRBaseBuilderTy builder(getContext()); builder.setInsertionPointToEnd(&mlirModule.getBodyRegion().back()); auto fnType = cir::FuncType::get({}, builder.getVoidTy()); - cir::FuncOp fn = buildRuntimeFunction(builder, fnName, mlirModule.getLoc(), - fnType, linkage); + cir::FuncOp fn = + buildRuntimeFunction(builder, fnName, mlirModule.getLoc(), fnType, + linkage, /*hasDefaultFuncAttrs=*/true); builder.setInsertionPointToStart(fn.addEntryBlock()); mlir::Location loc = fn.getLoc(); auto emitCalls = [&] { diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp index 3836c3f6103157..3360f3dd2b1f32 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp @@ -3132,7 +3132,8 @@ static bool isHandledDiscardableFuncAttr(mlir::NamedAttribute attr) { attr.getName() == CIRDialect::getNakedAttrName() || attr.getName() == CIRDialect::getSYCLModuleIdAttrName() || attr.getName() == CIRDialect::getDontCallErrorAttrName() || - attr.getName() == CIRDialect::getDontCallWarnAttrName(); + attr.getName() == CIRDialect::getDontCallWarnAttrName() || + attr.getName() == CIRDialect::getRuntimeFuncAttrName(); } /// Lower `cir.func` attributes for an `LLVMFuncOp` or `LLVM::AliasOp`. @@ -3329,6 +3330,24 @@ mlir::LogicalResult CIRToLLVMFuncOpLowering::matchAndRewrite( passthrough.push_back(rewriter.getArrayAttr( {rewriter.getStringAttr(dontCallAttr), diagnostic})); + // Every function but a runtime function gets the TU-wide default function + // attributes. + if (!op->hasAttr(CIRDialect::getRuntimeFuncAttrName())) { + if (auto langOpts = op->getParentOfType<mlir::ModuleOp>() + ->getAttrOfType<cir::LoweringOptionsAttr>( + CIRDialect::getLoweringOptionsAttrName())) { + // A strictfp function may use a pragma to observe FP exceptions locally, + // so the TU-wide default does not apply to it. + if (langOpts.getNoTrappingMath() && + !op->hasAttr(CIRDialect::getStrictFPAttrName())) + passthrough.push_back( + rewriter.getStrArrayAttr({"no-trapping-math", "true"})); + passthrough.push_back(rewriter.getStrArrayAttr( + {"stack-protector-buffer-size", + llvm::utostr(langOpts.getSspBufferSize())})); + } + } + if (!passthrough.empty()) fn.setPassthroughAttr(rewriter.getArrayAttr(passthrough)); diff --git a/clang/test/CIR/CodeGen/asm-label-inline-builtins.c b/clang/test/CIR/CodeGen/asm-label-inline-builtins.c index f3ff4c5a0c2bae..39af4bdf1d1b0f 100644 --- a/clang/test/CIR/CodeGen/asm-label-inline-builtins.c +++ b/clang/test/CIR/CodeGen/asm-label-inline-builtins.c @@ -44,7 +44,7 @@ void test(const char *fmt, __builtin_va_list ap) { // LLVM: define {{.*}} void @test{{.*}} // LLVM: call i32 @__vprintfieee128.inline(ptr {{.*}} %{{.*}}, ptr {{.*}} %{{.*}}) // -// LLVM: attributes #[[ALWAYS_INLINE_ATTR]] = { alwaysinline } +// LLVM: attributes #[[ALWAYS_INLINE_ATTR]] = { alwaysinline "no-trapping-math"="true" "stack-protector-buffer-size"="8" } // Note: OGCG emits these in the opposite order, but the content is the same. diff --git a/clang/test/CIR/CodeGen/call-conv-lowering-x86_64-no-noundef.cpp b/clang/test/CIR/CodeGen/call-conv-lowering-x86_64-no-noundef.cpp index 97fdd23c2b454b..70392831bb2460 100644 --- a/clang/test/CIR/CodeGen/call-conv-lowering-x86_64-no-noundef.cpp +++ b/clang/test/CIR/CodeGen/call-conv-lowering-x86_64-no-noundef.cpp @@ -17,7 +17,7 @@ // reads the setting from the module's #cir.lowering_options. // NONOUNDEF-CIR: cir.lowering_options = #cir.lowering_options< -// NONOUNDEF-CIR-SAME: enable_noundef_attrs = false> +// NONOUNDEF-CIR-SAME: enable_noundef_attrs = false, struct Big { long a, b, c; diff --git a/clang/test/CIR/CodeGen/global-array-dtor.cpp b/clang/test/CIR/CodeGen/global-array-dtor.cpp index 62824733766fa8..335125f90ce11a 100644 --- a/clang/test/CIR/CodeGen/global-array-dtor.cpp +++ b/clang/test/CIR/CodeGen/global-array-dtor.cpp @@ -56,7 +56,7 @@ ArrayDtor arrDtor[16]; // CIR: %[[HANDLE:.*]] = cir.get_global @__dso_handle : !cir.ptr<!u8i> // CIR: cir.call @__cxa_atexit(%[[DTOR_CAST]], %[[ARR_CAST]], %[[HANDLE]]) : (!cir.ptr<!cir.func<(!cir.ptr<!void>)>>, !cir.ptr<!void>, !cir.ptr<!u8i>) -> !s32i -// LLVM: define internal void @__cxx_global_array_dtor(ptr noundef %[[ARR_ARG:.*]]) { +// LLVM: define internal void @__cxx_global_array_dtor(ptr noundef %[[ARR_ARG:.*]]) #{{[0-9]+}} { // LLVM: %[[BEGIN:.*]] = getelementptr %struct.ArrayDtor, ptr %[[ARR_ARG]], i32 0 // LLVM: %[[END:.*]] = getelementptr %struct.ArrayDtor, ptr %[[BEGIN]], i64 16 // LLVM: %[[CUR_ADDR:.*]] = alloca ptr @@ -76,7 +76,7 @@ ArrayDtor arrDtor[16]; // LLVM: ret void // LLVM: } // -// LLVM: define internal void @__cxx_global_var_init() { +// LLVM: define internal void @__cxx_global_var_init() #{{[0-9]+}} { // LLVM: call i32 @__cxa_atexit(ptr @__cxx_global_array_dtor, ptr @arrDtor, ptr @__dso_handle) // Note: OGCG defines these functions in reverse order of CIR->LLVM. @@ -106,7 +106,7 @@ ArrayDtor arrDtor[16]; // CIR: cir.func internal private @_GLOBAL__sub_I_[[FILENAME:.*]]() { // CIR: cir.call @__cxx_global_var_init() : () -> () -// LLVM: define internal void @_GLOBAL__sub_I_[[FILENAME:.*]]() +// LLVM: define internal void @_GLOBAL__sub_I_[[FILENAME:.*]]() #{{[0-9]+}} // LLVM: call void @__cxx_global_var_init() // OGCG: define internal void @_GLOBAL__sub_I_[[FILENAME:.*]]() {{.*}} section ".text.startup" { diff --git a/clang/test/CIR/CodeGen/global-constant-storage.cpp b/clang/test/CIR/CodeGen/global-constant-storage.cpp index e9ae3151401dd3..d2768f45d5ff71 100644 --- a/clang/test/CIR/CodeGen/global-constant-storage.cpp +++ b/clang/test/CIR/CodeGen/global-constant-storage.cpp @@ -99,7 +99,7 @@ const C c; // CIR: } // LLVM checks for 'a' (no optimization) -// LLVM: define internal void @__cxx_global_var_init() { +// LLVM: define internal void @__cxx_global_var_init() #{{[0-9]+}} { // LLVM: call void @_ZN1AC1Ev(ptr noundef nonnull align 4 dereferenceable(4) @a) // LLVM: ret void // LLVM: } @@ -120,7 +120,7 @@ const C c; // CIR: } // LLVM checks for 'a2' (no optimization) -// LLVM: define internal void @__cxx_global_var_init.1() { +// LLVM: define internal void @__cxx_global_var_init.1() #{{[0-9]+}} { // LLVM: call void @_ZN2A2C1Ev(ptr noundef nonnull align 4 dereferenceable(4) @a2) // LLVM: ret void // LLVM: } @@ -141,7 +141,7 @@ const C c; // CIR: } // LLVM checks for 'b' (no optimization) -// LLVM: define internal void @__cxx_global_var_init.2() { +// LLVM: define internal void @__cxx_global_var_init.2() #{{[0-9]+}} { // LLVM: call void @_ZN1BC1Ev(ptr noundef nonnull align 4 dereferenceable(4) @b) // LLVM: ret void // LLVM: } @@ -162,7 +162,7 @@ const C c; // CIR: } // LLVM checks for 'c' (no optimization) -// LLVM: define internal void @__cxx_global_var_init.3() { +// LLVM: define internal void @__cxx_global_var_init.3() #{{[0-9]+}} { // LLVM: call void @_ZN1CC1Ev(ptr noundef nonnull align 4 dereferenceable(8) @_ZL1c) // LLVM: ret void // LLVM: } @@ -187,7 +187,7 @@ const C c; // OGCG-OPT: @_ZL1c ={{.*}} global {{.*}} zeroinitializer // Test case 'a' - optimized checks -// LLVM-OPT: define internal void @__cxx_global_var_init() { +// LLVM-OPT: define internal void @__cxx_global_var_init() #{{[0-9]+}} { // LLVM-OPT: call void @_ZN1AC1Ev(ptr noundef nonnull align 4 dereferenceable(4) @a) // LLVM-OPT: call {{.*}}@llvm.invariant.start.p0(i64 4, ptr @a) // LLVM-OPT: ret void @@ -200,7 +200,7 @@ const C c; // OGCG-OPT: } // Test case 'a2' - optimized checks -// LLVM-OPT: define internal void @__cxx_global_var_init.1() { +// LLVM-OPT: define internal void @__cxx_global_var_init.1() #{{[0-9]+}} { // LLVM-OPT: call void @_ZN2A2C1Ev(ptr noundef nonnull align 4 dereferenceable(4) @a2) // LLVM-OPT: call {{.*}}@llvm.invariant.start.p0(i64 4, ptr @a2) // LLVM-OPT: ret void @@ -213,7 +213,7 @@ const C c; // OGCG-OPT: } // Test case 'b' - optimized checks (should NOT emit invariant.start) -// LLVM-OPT: define internal void @__cxx_global_var_init.2() { +// LLVM-OPT: define internal void @__cxx_global_var_init.2() #{{[0-9]+}} { // LLVM-OPT: call void @_ZN1BC1Ev(ptr noundef nonnull align 4 dereferenceable(4) @b) // LLVM-OPT-NOT: call {{.*}}@llvm.invariant.start.p0(i64 {{.*}}, ptr @b) // LLVM-OPT: ret void @@ -226,7 +226,7 @@ const C c; // OGCG-OPT: } // Test case 'c' - optimized checks -// LLVM-OPT: define internal void @__cxx_global_var_init.3() { +// LLVM-OPT: define internal void @__cxx_global_var_init.3() #{{[0-9]+}} { // LLVM-OPT: call void @_ZN1CC1Ev(ptr noundef nonnull align 4 dereferenceable(8) @_ZL1c) // LLVM-OPT: call {{.*}}@llvm.invariant.start.p0(i64 8, ptr @_ZL1c) // LLVM-OPT: ret void diff --git a/clang/test/CIR/CodeGen/global-init.cpp b/clang/test/CIR/CodeGen/global-init.cpp index 6696e73f5b1f5e..65c8aa5ae898a3 100644 --- a/clang/test/CIR/CodeGen/global-init.cpp +++ b/clang/test/CIR/CodeGen/global-init.cpp @@ -46,7 +46,7 @@ NeedsCtor needsCtor; // CIR: %0 = cir.get_global @needsCtor : !cir.ptr<!rec_NeedsCtor> // CIR: cir.call @_ZN9NeedsCtorC1Ev(%0) : (!cir.ptr<!rec_NeedsCtor> {{.*}}) -> () -// LLVM: define internal void @__cxx_global_var_init() +// LLVM: define internal void @__cxx_global_var_init() #{{[0-9]+}} // LLVM: call void @_ZN9NeedsCtorC1Ev(ptr noundef nonnull align 1 dereferenceable(1) @needsCtor) // OGCG: define internal void @__cxx_global_var_init() {{.*}} section ".text.startup" { @@ -72,7 +72,7 @@ NeedsDtor needsDtor; // CIR: %[[HANDLE:.*]] = cir.get_global @__dso_handle : !cir.ptr<!u8i> // CIR: cir.call @__cxa_atexit(%[[DTOR_CAST]], %[[OBJ_CAST]], %[[HANDLE]]) : (!cir.ptr<!cir.func<(!cir.ptr<!void>)>>, !cir.ptr<!void>, !cir.ptr<!u8i>) -> !s32i -// LLVM: define internal void @__cxx_global_var_init.1() { +// LLVM: define internal void @__cxx_global_var_init.1() #{{[0-9]+}} { // LLVM: call i32 @__cxa_atexit(ptr @_ZN9NeedsDtorD1Ev, ptr @needsDtor, ptr @__dso_handle) // OGCG: define internal void @__cxx_global_var_init.1() {{.*}} section ".text.startup" { @@ -103,7 +103,7 @@ NeedsCtorDtor needsCtorDtor; // CIR: %[[HANDLE:.*]] = cir.get_global @__dso_handle : !cir.ptr<!u8i> // CIR: cir.call @__cxa_atexit(%[[DTOR_CAST]], %[[OBJ_CAST]], %[[HANDLE]]) : (!cir.ptr<!cir.func<(!cir.ptr<!void>)>>, !cir.ptr<!void>, !cir.ptr<!u8i>) -> !s32i -// LLVM: define internal void @__cxx_global_var_init.2() { +// LLVM: define internal void @__cxx_global_var_init.2() #{{[0-9]+}} { // LLVM: call void @_ZN13NeedsCtorDtorC1Ev(ptr noundef nonnull align 1 dereferenceable(1) @needsCtorDtor) // LLVM: call i32 @__cxa_atexit(ptr @_ZN13NeedsCtorDtorD1Ev, ptr @needsCtorDtor, ptr @__dso_handle) @@ -136,7 +136,7 @@ float _Complex a = {num, num}; // CIR: %[[COMPLEX_VAL:.*]] = cir.complex.create %[[REAL]], %[[IMAG]] : !cir.float -> !cir.complex<!cir.float> // CIR: cir.store{{.*}} %[[COMPLEX_VAL]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> -// LLVM: define internal void @__cxx_global_var_init.3() +// LLVM: define internal void @__cxx_global_var_init.3() #{{[0-9]+}} // LLVM: %[[REAL:.*]] = load float, ptr @num, align 4 // LLVM: %[[IMAG:.*]] = load float, ptr @num, align 4 // LLVM: %[[TMP_COMPLEX_VAL:.*]] = insertvalue { float, float } {{.*}}, float %[[REAL]], 0 @@ -167,7 +167,7 @@ int i = (int)fp; // CIR: %[[FP_I32:.*]] = cir.cast float_to_int %[[TMP_FP]] : !cir.float -> !s32i // CIR: cir.store{{.*}} %[[FP_I32]], %[[I_ADDR]] : !s32i, !cir.ptr<!s32i> -// LLVM: define internal void @__cxx_global_var_init.4() +// LLVM: define internal void @__cxx_global_var_init.4() #{{[0-9]+}} // LLVM: %[[TMP_FP:.*]] = load float, ptr @fp, align 4 // LLVM: %[[FP_I32:.*]] = fptosi float %[[TMP_FP]] to i32 // LLVM: store i32 %[[FP_I32]], ptr @i, align 4 @@ -223,7 +223,7 @@ ArrayDtor arrDtor[16]; // CIR: %[[HANDLE:.*]] = cir.get_global @__dso_handle : !cir.ptr<!u8i> // CIR: cir.call @__cxa_atexit(%[[DTOR_CAST]], %[[ARR_CAST]], %[[HANDLE]]) : (!cir.ptr<!cir.func<(!cir.ptr<!void>)>>, !cir.ptr<!void>, !cir.ptr<!u8i>) -> !s32i -// LLVM: define internal void @__cxx_global_array_dtor(ptr noundef %[[ARR_ARG:.*]]) { +// LLVM: define internal void @__cxx_global_array_dtor(ptr noundef %[[ARR_ARG:.*]]) #{{[0-9]+}} { // LLVM: %[[BEGIN:.*]] = getelementptr %struct.ArrayDtor, ptr %[[ARR_ARG]], i32 0 // LLVM: %[[END:.*]] = getelementptr %struct.ArrayDtor, ptr %[[BEGIN]], i64 16 // LLVM: %[[CUR_ADDR:.*]] = alloca ptr @@ -243,7 +243,7 @@ ArrayDtor arrDtor[16]; // LLVM: ret void // LLVM: } // -// LLVM: define internal void @__cxx_global_var_init.5() { +// LLVM: define internal void @__cxx_global_var_init.5() #{{[0-9]+}} { // LLVM: call i32 @__cxa_atexit(ptr @__cxx_global_array_dtor, ptr @arrDtor, ptr @__dso_handle) // Note: OGCG defines these functions in reverse order of CIR->LLVM. @@ -293,7 +293,7 @@ double &&globalDoubleRef = static_cast<double &&>(globalInt); // CIR: cir.store align(8) %[[GET_BACKING_VAR]], %[[GET_SELF]] : !cir.ptr<!cir.double>, !cir.ptr<!cir.ptr<!cir.double>> // CIR: cir.global "private" internal @_ZGR15globalDoubleRef_ = #cir.fp<0.000000e+00> : !cir.double -// LLVM-LABEL: define internal void @__cxx_global_var_init.6() +// LLVM-LABEL: define internal void @__cxx_global_var_init.6() #{{[0-9]+}} // LLVM: %[[GET_INT_VAR:.*]] = load i32, ptr @globalInt, align 4 // LLVM: %[[CAST:.*]] = sitofp i32 %[[GET_INT_VAR]] to double // LLVM: store double %[[CAST]], ptr @_ZGR15globalDoubleRef_, align 8 @@ -316,7 +316,7 @@ double &&globalDoubleRef = static_cast<double &&>(globalInt); // CIR: cir.call @__cxx_global_var_init.5() : () -> () // CIR: cir.call @__cxx_global_var_init.6() : () -> () -// LLVM: define internal void @_GLOBAL__sub_I_[[FILENAME]]() +// LLVM: define internal void @_GLOBAL__sub_I_[[FILENAME]]() #{{[0-9]+}} // LLVM: call void @__cxx_global_var_init() // LLVM: call void @__cxx_global_var_init.1() // LLVM: call void @__cxx_global_var_init.2() diff --git a/clang/test/CIR/CodeGen/global-tls-dyn-init.cpp b/clang/test/CIR/CodeGen/global-tls-dyn-init.cpp index 9fe2a5873eaa09..62aee6085bc5a2 100644 --- a/clang/test/CIR/CodeGen/global-tls-dyn-init.cpp +++ b/clang/test/CIR/CodeGen/global-tls-dyn-init.cpp @@ -63,31 +63,31 @@ struct CtorDtor { // CIR: } // CIR: cir.return -// LLVM: define weak_odr hidden ptr @_ZTW19tls_cd_dyn_not_used() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW19tls_cd_dyn_not_used() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH19tls_cd_dyn_not_used() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd_dyn_not_used) // LLVM: ret ptr %[[GET_GLOB]] // LLVM: } // -// LLVM: define weak_odr hidden ptr @_ZTW10tls_cd_ref() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW10tls_cd_ref() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH10tls_cd_ref() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd_ref) // LLVM: ret ptr %[[GET_GLOB]] // LLVM: } // -// LLVM: define weak_odr hidden ptr @_ZTW10tls_cd_dyn() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW10tls_cd_dyn() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH10tls_cd_dyn() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd_dyn) // LLVM: ret ptr %[[GET_GLOB]] // LLVM: } // -// LLVM: define weak_odr hidden ptr @_ZTW6tls_cd() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW6tls_cd() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH6tls_cd() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd) // LLVM: ret ptr %[[GET_GLOB]] // LLVM: } // -// LLVM: define internal void @__tls_init() { +// LLVM: define internal void @__tls_init() #{{[0-9]+}} { // LLVM: %[[GET_GUARD:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @__tls_guard) // LLVM: %[[LOAD_GUARD:.*]] = load i8, ptr %[[GET_GUARD]], align 1 // LLVM: %[[IS_UNINIT:.*]] = icmp eq i8 %[[LOAD_GUARD]], 0 @@ -114,7 +114,7 @@ thread_local CtorDtor tls_cd = 5; // CIR: cir.call @__cxa_thread_atexit(%[[DTOR_DECAY]], %[[GLOB_DECAY]], %[[DSOHANDLE]]) : (!cir.ptr<!cir.func<(!cir.ptr<!void>)>>, !cir.ptr<!void>, !cir.ptr<!u8i>) -> !s32i // CIR: cir.return // -// LLVM: define internal void @[[TLS_CD_INIT]]() { +// LLVM: define internal void @[[TLS_CD_INIT]]() #{{[0-9]+}} { // OGCG: define internal void @[[TLS_CD_INIT:.*]]() {{.*}}{ // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd) // LLVM: call i32 @__cxa_thread_atexit(ptr @_ZN8CtorDtorD1Ev, ptr %[[GET_GLOB]], ptr @__dso_handle) @@ -143,7 +143,7 @@ thread_local CtorDtor tls_cd_dyn = get_i(); // CIR: cir.call @__cxa_thread_atexit(%[[DTOR_DECAY]], %[[GLOB_DECAY]], %[[DSOHANDLE]]) : (!cir.ptr<!cir.func<(!cir.ptr<!void>)>>, !cir.ptr<!void>, !cir.ptr<!u8i>) -> !s32i // CIR: cir.return // -// LLVM: define internal void @[[TLS_CD_DYN_INIT]]() { +// LLVM: define internal void @[[TLS_CD_DYN_INIT]]() #{{[0-9]+}} { // OGCG: define internal void @[[TLS_CD_DYN_INIT:.*]]() {{.*}} { // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd_dyn) // LLVM-BOTH: %[[CALL:.*]] = call noundef i32 @_Z5get_iv() @@ -167,7 +167,7 @@ thread_local CtorDtor &tls_cd_ref = tls_cd_dyn; // CIR: cir.store align(8) %[[GET_DYN]], %[[GET_GLOB]] : !cir.ptr<!rec_CtorDtor>, !cir.ptr<!cir.ptr<!rec_CtorDtor>> // CIR: cir.return // -// LLVM: define internal void @[[TLS_CD_REF_INIT]]() { +// LLVM: define internal void @[[TLS_CD_REF_INIT]]() #{{[0-9]+}} { // OGCG: define internal void @[[TLS_CD_REF_INIT:.*]]() {{.*}} { // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd_ref) // LLVM-BOTH: %[[CALL:.*]] = call ptr @_ZTW10tls_cd_dyn() @@ -203,7 +203,7 @@ thread_local CtorDtor tls_cd_dyn_not_used = get_i(); // CIR: cir.call @__cxa_thread_atexit(%[[DTOR_DECAY]], %[[GLOB_DECAY]], %[[DSOHANDLE]]) : (!cir.ptr<!cir.func<(!cir.ptr<!void>)>>, !cir.ptr<!void>, !cir.ptr<!u8i>) -> !s32i // CIR: cir.return // -// LLVM: define internal void @[[TLS_CD_DYN_NOT_USED_INIT]]() { +// LLVM: define internal void @[[TLS_CD_DYN_NOT_USED_INIT]]() #{{[0-9]+}} { // OGCG: define internal void @[[TLS_CD_DYN_NOT_USED_INIT:.*]]() {{.*}} { // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_cd_dyn_not_used) // LLVM-BOTH: %[[CALL:.*]] = call noundef i32 @_Z5get_iv() diff --git a/clang/test/CIR/CodeGen/global-tls-simple-init.cpp b/clang/test/CIR/CodeGen/global-tls-simple-init.cpp index 1b753b1fad2cf8..e0dfe20884e2fd 100644 --- a/clang/test/CIR/CodeGen/global-tls-simple-init.cpp +++ b/clang/test/CIR/CodeGen/global-tls-simple-init.cpp @@ -87,39 +87,39 @@ struct CtorDtor { // LLVM-BOTH-DAG: @_ZTH11tls_int_dyn = alias void (), ptr @__tls_init // Wrappers: -// LLVM: define linkonce_odr hidden ptr @_ZTW12maybe_inited() comdat { +// LLVM: define linkonce_odr hidden ptr @_ZTW12maybe_inited() #{{[0-9]+}} comdat { // LLVM: %[[HAS_INIT_FUNC:.*]] = icmp ne ptr @_ZTH12maybe_inited, null // LLVM: br i1 %[[HAS_INIT_FUNC]] // LLVM: call void @_ZTH12maybe_inited() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @maybe_inited) // LLVM: ret ptr %[[GET_GLOB]] // -// LLVM: define weak_odr hidden ptr @_ZTW21definitely_inited_dyn() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW21definitely_inited_dyn() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH21definitely_inited_dyn() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @definitely_inited_dyn) // LLVM: ret ptr %[[GET_GLOB]] // -// LLVM: define weak_odr hidden ptr @_ZTW17definitely_inited() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW17definitely_inited() #{{[0-9]+}} comdat { // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @definitely_inited) // LLVM: ret ptr %[[GET_GLOB]] // LLVM: } // -// LLVM: define weak_odr hidden ptr @_ZTW17tls_int_self_init() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW17tls_int_self_init() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH17tls_int_self_init() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_int_self_init) // LLVM: ret ptr %[[GET_GLOB]] // -// LLVM: define weak_odr hidden ptr @_ZTW11tls_int_ref() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW11tls_int_ref() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH11tls_int_ref() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_int_ref) // LLVM: ret ptr %[[GET_GLOB]] // -// LLVM: define weak_odr hidden ptr @_ZTW11tls_int_dyn() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW11tls_int_dyn() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH11tls_int_dyn() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_int_dyn) // LLVM: ret ptr %[[GET_GLOB]] -// LLVM: define internal void @__tls_init() { +// LLVM: define internal void @__tls_init() #{{[0-9]+}} { // LLVM: %[[GET_GUARD:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @__tls_guard) // LLVM: %[[LOAD_GUARD:.*]] = load i8, ptr %[[GET_GUARD]], align 1 // LLVM: %[[IS_UNINIT:.*]] = icmp eq i8 %[[LOAD_GUARD]], 0 @@ -133,7 +133,7 @@ struct CtorDtor { // LLVM: br label // LLVM: ret void -// LLVM: define weak_odr hidden ptr @_ZTW7tls_int() comdat { +// LLVM: define weak_odr hidden ptr @_ZTW7tls_int() #{{[0-9]+}} comdat { // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @tls_int) // LLVM: ret ptr %[[GET_GLOB]] // LLVM: } @@ -155,7 +155,7 @@ thread_local int tls_int_dyn = get_i(); // CIR: %[[CALL:.*]] = cir.call @_Z5get_iv() : () -> (!s32i {llvm.noundef}) // CIR: cir.store {{.*}}%[[CALL]], %[[GET_GLOB]] : !s32i, !cir.ptr<!s32i> // CIR: cir.return -// LLVM: define internal void @[[TLS_INT_DYN_INIT]]() { +// LLVM: define internal void @[[TLS_INT_DYN_INIT]]() #{{[0-9]+}} { // OGCG: define internal void @[[TLS_INT_DYN_INIT:.*]]() // OGCG: %[[CALL:.*]] = call noundef i32 @_Z5get_iv() // LLVM-BOTH: %[[GET_GLOB:.*]] = call {{.*}}ptr @llvm.threadlocal.address.p0(ptr {{.*}}@tls_int_dyn) @@ -175,7 +175,7 @@ thread_local int &tls_int_ref = tls_int_dyn; // CIR: %[[GET_REF:.*]] = cir.call @_ZTW11tls_int_dyn() : () -> !cir.ptr<!s32i> // CIR: cir.store {{.*}}%[[GET_REF]], %[[GET_GLOB]] : !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>> // CIR: cir.return -// LLVM: define internal void @[[TLS_INT_REF_INIT]]() { +// LLVM: define internal void @[[TLS_INT_REF_INIT]]() #{{[0-9]+}} { // OGCG: define internal void @[[TLS_INT_REF_INIT:.*]]() // OGCG: %[[GET_REF:.*]] = call ptr @_ZTW11tls_int_dyn() // LLVM-BOTH: %[[GET_GLOB:.*]] = call {{.*}}ptr @llvm.threadlocal.address.p0(ptr {{.*}}@tls_int_ref) @@ -206,7 +206,7 @@ thread_local int tls_int_self_init = tls_int_self_init + get_i(); // CIR: %[[ADD:.*]] = cir.add nsw %[[SELF_LOAD]], %[[CALL]] : !s32i // CIR: cir.store{{.*}} %[[ADD]], %[[GET_GLOB]] : !s32i, !cir.ptr<!s32i> // CIR: cir.return -// LLVM: define internal void @[[TLS_INT_SELF_REF_INIT]]() { +// LLVM: define internal void @[[TLS_INT_SELF_REF_INIT]]() #{{[0-9]+}} { // OGCG: define internal void @[[TLS_INT_SELF_REF_INIT:.*]]() // LLVM: %[[GET_GLOB:.*]] = call {{.*}}ptr @llvm.threadlocal.address.p0(ptr {{.*}}@tls_int_self_init) // LLVM-BOTH: %[[GET_SELF_FROM_WRAPPER:.*]] = call ptr @_ZTW17tls_int_self_init() @@ -238,7 +238,7 @@ extern thread_local int definitely_inited_dyn = get_i(); // CIR: %[[CALL:.*]] = cir.call @_Z5get_iv() : () -> (!s32i {llvm.noundef}) // CIR: cir.store align(4) %[[CALL]], %[[GET_GLOB]] : !s32i, !cir.ptr<!s32i> // CIR: cir.return -// LLVM: define internal void @[[DEF_INITED_DYN]]() { +// LLVM: define internal void @[[DEF_INITED_DYN]]() #{{[0-9]+}} { // OGCG: define internal void @[[DEF_INITED_DYN:.*]]() // LLVM: %[[GET_GLOB:.*]] = call ptr @llvm.threadlocal.address.p0(ptr @definitely_inited_dyn) // LLVM-BOTH: %[[CALL:.*]] = call noundef i32 @_Z5get_iv() diff --git a/clang/test/CIR/CodeGen/global-tls-templates.cpp b/clang/test/CIR/CodeGen/global-tls-templates.cpp index 1225b13c0e0a30..1e911e7740a236 100644 --- a/clang/test/CIR/CodeGen/global-tls-templates.cpp +++ b/clang/test/CIR/CodeGen/global-tls-templates.cpp @@ -118,12 +118,12 @@ thread_local T tls_templ = {get_i()}; // Wrappers: Just opposite ordering, same check lines as LLVM. // FIXME: OGCG has these set as 'comdat'. However, CIR doesn't lower comdat to // LLVM, so it doesn't show up in the IR here. -// LLVM-LABEL: define weak_odr hidden {{.*}}ptr @_ZTW9tls_templI8CtorDtorE() comdat { +// LLVM-LABEL: define weak_odr hidden {{.*}}ptr @_ZTW9tls_templI8CtorDtorE() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH9tls_templI8CtorDtorE() // LLVM: call {{.*}}ptr @llvm.threadlocal.address.p0(ptr {{.*}}@_Z9tls_templI8CtorDtorE) // LLVM: } -// LLVM-LABEL: define weak_odr hidden {{.*}}ptr @_ZTW9tls_templIiE() comdat { +// LLVM-LABEL: define weak_odr hidden {{.*}}ptr @_ZTW9tls_templIiE() #{{[0-9]+}} comdat { // LLVM: call void @_ZTH9tls_templIiE() // LLVM: call {{.*}}ptr @llvm.threadlocal.address.p0(ptr {{.*}}@_Z9tls_templIiE) // LLVM: } diff --git a/clang/test/CIR/CodeGen/lowering-lang-options.cpp b/clang/test/CIR/CodeGen/lowering-lang-options.cpp index 83e8d8f71aabf8..1f4dac33d82ebc 100644 --- a/clang/test/CIR/CodeGen/lowering-lang-options.cpp +++ b/clang/test/CIR/CodeGen/lowering-lang-options.cpp @@ -32,7 +32,9 @@ int x; // PLAIN-SAME: openmp_is_target_device = false // PLAIN-SAME: clang_abi_compat = {{[0-9]+}} // PLAIN-SAME: long_double_size = 0 -// PLAIN-SAME: enable_noundef_attrs = true> +// PLAIN-SAME: enable_noundef_attrs = true +// PLAIN-SAME: no_trapping_math = true +// PLAIN-SAME: ssp_buffer_size = 8> // -fexceptions -fcxx-exceptions flips exceptions. (OpenMP is exercised in the // #cir.lowering_options round-trip test, since -fopenmp on a global here hits @@ -43,7 +45,7 @@ int x; // EXC-SAME: openmp = false // EXC-SAME: openmp_is_target_device = false // EXC-SAME: clang_abi_compat = {{[0-9]+}} -// EXC-SAME: enable_noundef_attrs = true> +// EXC-SAME: enable_noundef_attrs = true, // LD: cir.lowering_options = #cir.lowering_options< // LD-SAME: long_double_size = 128 @@ -51,4 +53,4 @@ int x; // -no-enable-noundef-analysis clears enable_noundef_attrs. // NONOUNDEF: cir.lowering_options = #cir.lowering_options< // NONOUNDEF-SAME: exceptions = false -// NONOUNDEF-SAME: enable_noundef_attrs = false> +// NONOUNDEF-SAME: enable_noundef_attrs = false, diff --git a/clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.c b/clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.c new file mode 100644 index 00000000000000..838bc333095872 --- /dev/null +++ b/clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.c @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM + +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ffp-exception-behavior=strict -stack-protector-buffer-size 16 -fclangir -emit-cir %s -o %t-strict.cir +// RUN: FileCheck --input-file=%t-strict.cir %s -check-prefix=CIR-STRICT +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ffp-exception-behavior=strict -stack-protector-buffer-size 16 -fclangir -emit-llvm %s -o %t-strict-cir.ll +// RUN: FileCheck --input-file=%t-strict-cir.ll %s -check-prefix=LLVM-STRICT +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ffp-exception-behavior=strict -stack-protector-buffer-size 16 -emit-llvm %s -o %t-strict.ll +// RUN: FileCheck --input-file=%t-strict.ll %s -check-prefix=LLVM-STRICT + +// Both the definition and the declaration get "no-trapping-math" (unless FP +// exceptions are not ignored) and "stack-protector-buffer-size". Their values +// are TU-wide and live in #cir.lowering_options, and LowerToLLVM adds them +// to every function that is not marked runtime_func. + +int decl(int); + +int def(int x) { return decl(x); } + +// CIR: cir.lowering_options = #cir.lowering_options<{{.*}}no_trapping_math = true, ssp_buffer_size = 8> +// CIR-NOT: runtime_func + +// CIR-STRICT: cir.lowering_options = #cir.lowering_options<{{.*}}no_trapping_math = false, ssp_buffer_size = 16> + +// LLVM: define{{.*}} i32 @def(i32 {{.*}}) #[[DEF_ATTR:[0-9]+]] +// LLVM: declare{{.*}} i32 @decl(i32 {{.*}}) #[[DECL_ATTR:[0-9]+]] +// LLVM: attributes #[[DEF_ATTR]] = {{{.*}}"no-trapping-math"="true" "stack-protector-buffer-size"="8" +// LLVM: attributes #[[DECL_ATTR]] = {{{.*}}"no-trapping-math"="true" "stack-protector-buffer-size"="8" + +// LLVM-STRICT: define{{.*}} i32 @def(i32 {{.*}}) #[[DEF_ATTR:[0-9]+]] +// LLVM-STRICT: declare{{.*}} i32 @decl(i32 {{.*}}) #[[DECL_ATTR:[0-9]+]] +// String attributes are sorted, so "no-trapping-math" would precede +// "stack-protector-buffer-size". +// LLVM-STRICT: attributes #[[DEF_ATTR]] = { {{[^"]*}}{{("min-legal-vector-width"="0" )?}}"stack-protector-buffer-size"="16" +// LLVM-STRICT: attributes #[[DECL_ATTR]] = { "stack-protector-buffer-size"="16" diff --git a/clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.cpp b/clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.cpp new file mode 100644 index 00000000000000..23efb24bca92b9 --- /dev/null +++ b/clang/test/CIR/CodeGen/no-trapping-math-ssp-buffer-size.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefixes=LLVM,CIRLLVM +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions -fexceptions -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll %s -check-prefixes=LLVM,OGCG + +// Runtime library functions do not get "no-trapping-math" and +// "stack-protector-buffer-size", while user functions and compiler-generated +// init functions do, matching classic codegen. + +struct S { + S(); +}; + +int f(); + +int g() { + static int x = f(); + return x; +} + +S s; + +void h() { throw 1; } + +// CIR: cir.func private @__cxa_guard_acquire({{.*}}) -> !s32i attributes {runtime_func} +// CIR: cir.func internal private @__cxx_global_var_init() { + +// Classic codegen gives some runtime functions nounwind, which CIR does not +// do yet. +// CIRLLVM-DAG: declare i32 @__cxa_guard_acquire(ptr){{$}} +// CIRLLVM-DAG: declare ptr @__cxa_allocate_exception(i64){{$}} +// CIRLLVM-DAG: declare void @__cxa_throw(ptr, ptr, ptr){{$}} +// OGCG-DAG: declare i32 @__cxa_guard_acquire(ptr) #[[RT:[0-9]+]] +// OGCG-DAG: declare ptr @__cxa_allocate_exception(i64){{$}} +// OGCG-DAG: declare void @__cxa_throw(ptr, ptr, ptr){{$}} +// OGCG-DAG: attributes #[[RT]] = { nounwind } + +// LLVM-DAG: define {{.*}}i32 @_Z1gv() #[[USER:[0-9]+]] +// LLVM-DAG: declare {{.*}}i32 @_Z1fv() #[[DECL:[0-9]+]] +// LLVM-DAG: define internal void @__cxx_global_var_init() #[[INIT:[0-9]+]] +// LLVM-DAG: define internal void @_GLOBAL__sub_I_{{.*}}() #[[INIT]] + +// LLVM-DAG: attributes #[[USER]] = { {{.*}}"no-trapping-math"="true" "stack-protector-buffer-size"="8" +// LLVM-DAG: attributes #[[DECL]] = { {{.*}}"no-trapping-math"="true" "stack-protector-buffer-size"="8" +// LLVM-DAG: attributes #[[INIT]] = { {{.*}}"no-trapping-math"="true" "stack-protector-buffer-size"="8" diff --git a/clang/test/CIR/CodeGen/no-trapping-math-strictfp.c b/clang/test/CIR/CodeGen/no-trapping-math-strictfp.c new file mode 100644 index 00000000000000..1d453a9dd6724e --- /dev/null +++ b/clang/test/CIR/CodeGen/no-trapping-math-strictfp.c @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG + +// A pragma can make a function observe FP exceptions even though the TU-wide +// default ignores them. Such a function is strictfp and does not get +// "no-trapping-math". Classic codegen still adds "no-trapping-math"="true" +// from the TU-wide default, which contradicts the strict constrained +// intrinsics in the function body. + +float plain(float a, float b) { return a + b; } + +float except_on(float a, float b) { +#pragma float_control(except, on) + return a + b; +} + +#pragma STDC FENV_ACCESS ON +float fenv_access(float a, float b) { return a + b; } + +// CIR: cir.lowering_options = #cir.lowering_options<{{.*}}no_trapping_math = true +// CIR: cir.func {{.*}}@except_on({{.*}}) -> {{.*}} attributes {{{.*}}strictfp} +// CIR: cir.func {{.*}}@fenv_access({{.*}}) -> {{.*}} attributes {{{.*}}strictfp} + +// LLVM: define {{.*}}float @plain({{.*}}) #[[PLAIN:[0-9]+]] +// LLVM: define {{.*}}float @except_on({{.*}}) #[[STRICT:[0-9]+]] +// LLVM: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"fpexcept.strict") +// LLVM: define {{.*}}float @fenv_access({{.*}}) #[[STRICT]] +// LLVM: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"fpexcept.strict") +// LLVM: attributes #[[PLAIN]] = { {{.*}}"no-trapping-math"="true" +// String attributes are sorted, so "no-trapping-math" would precede +// "stack-protector-buffer-size". +// LLVM: attributes #[[STRICT]] = { {{[^"]*}}strictfp "stack-protector-buffer-size"="8" + +// OGCG: define {{.*}}float @plain({{.*}}) #[[PLAIN:[0-9]+]] +// OGCG: define {{.*}}float @except_on({{.*}}) #[[STRICT:[0-9]+]] +// OGCG: define {{.*}}float @fenv_access({{.*}}) #[[STRICT]] +// OGCG: attributes #[[PLAIN]] = { {{.*}}"no-trapping-math"="true" +// OGCG: attributes #[[STRICT]] = { {{.*}}strictfp {{.*}}"no-trapping-math"="true" diff --git a/clang/test/CIR/CodeGen/throws.cpp b/clang/test/CIR/CodeGen/throws.cpp index c217b2e872bcc7..c430c161eb1e82 100644 --- a/clang/test/CIR/CodeGen/throws.cpp +++ b/clang/test/CIR/CodeGen/throws.cpp @@ -17,7 +17,7 @@ int throw_in_global_init = (throw 1, 0); // CIR-NEXT: } // CIR-NEXT: cir.return -// LLVM-LABEL: define internal void @__cxx_global_var_init() +// LLVM-LABEL: define internal void @__cxx_global_var_init() #{{[0-9]+}} // LLVM: call void @__cxa_throw // LLVM-NEXT: unreachable // LLVM: store i32 0, ptr @throw_in_global_init @@ -39,7 +39,7 @@ int trap_in_global_init = (__builtin_trap(), 1); // CIR-NEXT: } // CIR-NEXT: cir.return -// LLVM-LABEL: define internal void @__cxx_global_var_init.1() +// LLVM-LABEL: define internal void @__cxx_global_var_init.1() #{{[0-9]+}} // LLVM: call void @llvm.trap() // LLVM-NEXT: unreachable // LLVM: store i32 1, ptr @trap_in_global_init @@ -66,7 +66,7 @@ ThrowInGlobalCtorArg throw_in_global_ctor_arg = ThrowInGlobalCtorArg((throw 1, 0 // CIR-NEXT: } // CIR-NEXT: cir.return -// LLVM-LABEL: define internal void @__cxx_global_var_init.2() +// LLVM-LABEL: define internal void @__cxx_global_var_init.2() #{{[0-9]+}} // LLVM: call void @__cxa_throw // LLVM-NEXT: unreachable // LLVM: call void @_ZN20ThrowInGlobalCtorArgC1Ei @@ -95,7 +95,7 @@ int use_throw_in_inline_global() { return throw_in_inline_global; } // CIR-NEXT: } cleanup eh { // CIR-NEXT: cir.call @__cxa_guard_abort -// LLVM-LABEL: define internal void @__cxx_global_var_init.3() comdat($throw_in_inline_global) +// LLVM-LABEL: define internal void @__cxx_global_var_init.3() #{{[0-9]+}} comdat($throw_in_inline_global) // LLVM: call i32 @__cxa_guard_acquire // LLVM: invoke void @__cxa_throw // LLVM: call void @__cxa_guard_abort @@ -117,7 +117,7 @@ int use_throw_in_template_static() { return ThrowInTemplateStatic<int>::w; } // CIR-NEXT: } // CIR-NEXT: cir.return -// LLVM-LABEL: define internal void @__cxx_global_var_init.4() comdat($_ZN21ThrowInTemplateStaticIiE1wE) +// LLVM-LABEL: define internal void @__cxx_global_var_init.4() #{{[0-9]+}} comdat($_ZN21ThrowInTemplateStaticIiE1wE) // LLVM: call void @__cxa_throw // LLVM-NEXT: unreachable // LLVM: store i32 0, ptr @_ZN21ThrowInTemplateStaticIiE1wE diff --git a/clang/test/CIR/CodeGenCUDA/vtable-host-device.cu b/clang/test/CIR/CodeGenCUDA/vtable-host-device.cu index 06c87e19da7d95..e7cb421ecfbbf6 100644 --- a/clang/test/CIR/CodeGenCUDA/vtable-host-device.cu +++ b/clang/test/CIR/CodeGenCUDA/vtable-host-device.cu @@ -53,10 +53,10 @@ const char *host_name() { return Square(3.0f).name(); } // HOST-DAG: declare {{.*}}void @__cxa_pure_virtual() // HOST-DAG: declare {{.*}}void @__cxa_deleted_virtual() -// CIR-DEV: cir.func weak {{.*}}@__cxa_deleted_virtual() requires_call_conv_lowering { +// CIR-DEV: cir.func weak {{.*}}@__cxa_deleted_virtual() requires_call_conv_lowering attributes {runtime_func} { // CIR-DEV-NEXT: cir.trap // CIR-DEV-NEXT: } -// CIR-DEV: cir.func weak {{.*}}@__cxa_pure_virtual() requires_call_conv_lowering { +// CIR-DEV: cir.func weak {{.*}}@__cxa_pure_virtual() requires_call_conv_lowering attributes {runtime_func} { // CIR-DEV-NEXT: cir.trap // CIR-DEV-NEXT: } diff --git a/clang/test/CIR/CodeGenCXX/typeid.cpp b/clang/test/CIR/CodeGenCXX/typeid.cpp index 72faab8bcd74c5..18c895e4a25ff7 100644 --- a/clang/test/CIR/CodeGenCXX/typeid.cpp +++ b/clang/test/CIR/CodeGenCXX/typeid.cpp @@ -99,6 +99,6 @@ const char *f(void *arg) { return 0; } -// CIR: cir.func private dso_local @__cxa_bad_typeid(){{.*}} attributes {noreturn} +// CIR: cir.func private dso_local @__cxa_bad_typeid(){{.*}} attributes {noreturn, runtime_func} } diff --git a/clang/test/CIR/CodeGenSYCL/kernel-caller-attributes.cpp b/clang/test/CIR/CodeGenSYCL/kernel-caller-attributes.cpp index 9df1b9f98b2b50..e6e85385c5eec0 100644 --- a/clang/test/CIR/CodeGenSYCL/kernel-caller-attributes.cpp +++ b/clang/test/CIR/CodeGenSYCL/kernel-caller-attributes.cpp @@ -44,4 +44,4 @@ void test(int *p) { // caller must not carry mustprogress; norecurse and sycl-module-id remain. The // exact attribute set (which omits mustprogress) is verified here. // LLVM-NOMP: define spir_kernel void @_ZTS2KN({{.*}}) #[[KATTR:[0-9]+]] -// LLVM-NOMP: attributes #[[KATTR]] = { convergent noinline norecurse nounwind optnone "sycl-module-id"="{{.*}}kernel-caller-attributes.cpp" } +// LLVM-NOMP: attributes #[[KATTR]] = { convergent noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="{{.*}}kernel-caller-attributes.cpp" } diff --git a/clang/test/CIR/IR/lowering-lang-options.cir b/clang/test/CIR/IR/lowering-lang-options.cir index dc49d5b4f62c67..eccb09d646289d 100644 --- a/clang/test/CIR/IR/lowering-lang-options.cir +++ b/clang/test/CIR/IR/lowering-lang-options.cir @@ -8,11 +8,11 @@ module attributes {cir.lowering_options = #cir.lowering_options< exceptions = true, threadsafe_statics = false, cuda = true, cuda_is_device = true, hip = true, hlsl = true, gpu_rdc = true, openmp = true, openmp_is_target_device = true, clang_abi_compat = 9, long_double_size = 80, - enable_noundef_attrs = false>} { + enable_noundef_attrs = false, no_trapping_math = true, ssp_buffer_size = 4>} { } // CHECK: cir.lowering_options = #cir.lowering_options< // CHECK-SAME: exceptions = true, threadsafe_statics = false, cuda = true, // CHECK-SAME: cuda_is_device = true, hip = true, hlsl = true, gpu_rdc = true, openmp = true, // CHECK-SAME: openmp_is_target_device = true, clang_abi_compat = 9, long_double_size = 80, -// CHECK-SAME: enable_noundef_attrs = false> +// CHECK-SAME: enable_noundef_attrs = false, no_trapping_math = true, ssp_buffer_size = 4> diff --git a/clang/test/CIR/Lowering/no-trapping-math-ssp-buffer-size.cir b/clang/test/CIR/Lowering/no-trapping-math-ssp-buffer-size.cir new file mode 100644 index 00000000000000..c1474f792f3501 --- /dev/null +++ b/clang/test/CIR/Lowering/no-trapping-math-ssp-buffer-size.cir @@ -0,0 +1,44 @@ +// RUN: cir-opt %s -cir-to-llvm -o - | FileCheck %s -check-prefix=MLIR +// RUN: cir-translate %s -cir-to-llvmir --disable-cc-lowering | FileCheck %s -check-prefix=LLVM + +// A `cir.func` gets the `no_trapping_math` and `ssp_buffer_size` values of the +// module's #cir.lowering_options as `llvm.func` `passthrough` entries, +// translated to the "no-trapping-math" and "stack-protector-buffer-size" LLVM +// IR string attributes. A `strictfp` function does not get "no-trapping-math", +// and a function marked `runtime_func` gets neither. + +module attributes { + cir.triple = "x86_64-unknown-linux-gnu", + cir.lowering_options = #cir.lowering_options< + exceptions = false, threadsafe_statics = true, cuda = false, + cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, + openmp = false, openmp_is_target_device = false, clang_abi_compat = 0, + long_double_size = 0, enable_noundef_attrs = true, no_trapping_math = true, + ssp_buffer_size = 16> +} { + cir.func @def_fn() { + cir.return + } + + cir.func private @decl_fn() + + cir.func private @strictfp_fn() attributes {strictfp} + + cir.func private @runtime_fn() attributes {runtime_func} +} + +// MLIR-LABEL: llvm.func @def_fn() +// MLIR-SAME: passthrough = {{\[}}["no-trapping-math", "true"], ["stack-protector-buffer-size", "16"]] +// MLIR-LABEL: llvm.func @decl_fn() +// MLIR-SAME: passthrough = {{\[}}["no-trapping-math", "true"], ["stack-protector-buffer-size", "16"]] +// MLIR-LABEL: llvm.func @strictfp_fn() +// MLIR-SAME: passthrough = {{\[}}"strictfp", ["stack-protector-buffer-size", "16"]] +// MLIR-LABEL: llvm.func @runtime_fn() +// MLIR-NOT: passthrough + +// LLVM: define void @def_fn() #[[ATTRS:[0-9]+]] +// LLVM: declare void @decl_fn() #[[ATTRS]] +// LLVM: declare void @strictfp_fn() #[[STRICT:[0-9]+]] +// LLVM: declare void @runtime_fn(){{$}} +// LLVM: attributes #[[ATTRS]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="16" } +// LLVM: attributes #[[STRICT]] = { strictfp "stack-protector-buffer-size"="16" } diff --git a/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir b/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir index 8e876439135869..b2427b02afb321 100644 --- a/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir +++ b/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir @@ -14,7 +14,8 @@ module attributes { exceptions = false, threadsafe_statics = true, cuda = true, cuda_is_device = true, hip = true, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 17, - long_double_size = 0, enable_noundef_attrs = true> + long_double_size = 0, enable_noundef_attrs = true, no_trapping_math = true, + ssp_buffer_size = 8> } { // The kernel casts the incoming global pointer back to generic before the diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir index 49fab72ee123f6..64d0d393bcd003 100644 --- a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir +++ b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir @@ -221,7 +221,8 @@ module attributes { exceptions = false, threadsafe_statics = true, cuda = false, cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 17, - long_double_size = 0, enable_noundef_attrs = false> + long_double_size = 0, enable_noundef_attrs = false, no_trapping_math = true, + ssp_buffer_size = 8> } { cir.func private @takes_big_no_noundef(%arg0: !rec_Big) requires_call_conv_lowering diff --git a/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir b/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir index 3b69501d332fc3..21037004b1df51 100644 --- a/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir +++ b/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir @@ -19,7 +19,7 @@ !s32i = !cir.int<s, 32> !u8i = !cir.int<u, 8> -module attributes {cir.lowering_options = #cir.lowering_options<exceptions = false, threadsafe_statics = true, cuda = true, cuda_is_device = false, hip = true, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 16, long_double_size = 0, enable_noundef_attrs = true>, cir.triple = "x86_64-unknown-linux-gnu"} { +module attributes {cir.lowering_options = #cir.lowering_options<exceptions = false, threadsafe_statics = true, cuda = true, cuda_is_device = false, hip = true, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 16, long_double_size = 0, enable_noundef_attrs = true, no_trapping_math = true, ssp_buffer_size = 8>, cir.triple = "x86_64-unknown-linux-gnu"} { cir.global "private" internal dso_local @dv = #cir.undef : !s32i align(4) {cu.var_registration = #cir.cu.var_registration<dv, Variable>} cir.global constant external @_Z1kv = #cir.global_view<@_Z16__device_stub__kv> : !cir.ptr<!cir.func<()>> align(8) cir.func @_Z16__device_stub__kv() attributes {cu.kernel_name = #cir.cu.kernel_name<"_Z1kv">} { diff --git a/clang/test/CIR/Transforms/lowering-prepare.cir b/clang/test/CIR/Transforms/lowering-prepare.cir index 4cf9206e5700f4..dad215c0269f5a 100644 --- a/clang/test/CIR/Transforms/lowering-prepare.cir +++ b/clang/test/CIR/Transforms/lowering-prepare.cir @@ -13,7 +13,8 @@ module attributes { exceptions = false, threadsafe_statics = true, cuda = false, cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 16, long_double_size = 0, - enable_noundef_attrs = true> + enable_noundef_attrs = true, no_trapping_math = true, + ssp_buffer_size = 8> } { cir.global "private" internal dso_local dynamic_init_guard<"_ZGVZ1gvE1x"> @_ZZ1gvE1x = #cir.int<0> : !s32i align(4) dynamic_init_info<local = true, tls = none, is_inline = false, tsk = undeclared> _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
