[clang] 104238f - [CIR] Calling convention add tagging marker (#237433)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 15:54:34 PST 2026
Author: Konstantinos Parasyris
Date: 2026-11-04T23:54:27Z
New Revision: 104238fbb1b323aae88bf699412e2b2e590b7c8e
URL: https://github.com/llvm/llvm-project/commit/104238fbb1b323aae88bf699412e2b2e590b7c8e
DIFF: https://github.com/llvm/llvm-project/commit/104238fbb1b323aae88bf699412e2b2e590b7c8e.diff
LOG: [CIR] Calling convention add tagging marker (#237433)
[CIR] Make CallConvLowering safe to rerun on its own output
A signature lowered by CallConvLowering uses ordinary CIR types, so the
pass cannot tell it apart from one that still needs lowering. Running
it again on its own output, e.g. on an emitted .cir file, lowers it a
second time: on x86_64 a struct of two floats lowers to
vector<2 x float>, which a second run turns into double, the lowering
of a source-level float vector_size(8). Nothing errors and the code is
wrong.
Record what the pass has lowered with a 'call_conv_lowered' marker and
skip it on later runs:
- cir.func gets a unit attribute, printed as a keyword at the end of
the function header, when the pass rewrites its signature.
- An indirect call gets the marker when its rewrite changes anything.
- A call that passes arguments through an ellipsis is classified on its
own, so it can need a rewrite its callee does not; it gets its own
marker.
This relates to: https://github.com/llvm/llvm-project/pull/234013
Added:
clang/test/CIR/CodeGen/call-conv-lowering-x86_64-rerun.c
Modified:
clang/include/clang/CIR/Dialect/IR/CIROps.td
clang/lib/CIR/Dialect/IR/CIRDialect.cpp
clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
clang/test/CIR/CodeGen/pointer-to-data-member.cpp
clang/test/CIR/CodeGen/pointer-to-member-func.cpp
clang/test/CIR/CodeGenCUDA/kernel-stub-name.cu
clang/test/CIR/CodeGenCUDA/vtable-host-device.cu
clang/test/CIR/CodeGenCXX/typeid.cpp
clang/test/CIR/Transforms/abi-lowering/amdgpu-byref.cir
clang/test/CIR/Transforms/abi-lowering/amdgpu-calling-conv.cir
clang/test/CIR/Transforms/abi-lowering/amdgpu-indirect-nyi.cir
clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir
clang/test/CIR/Transforms/abi-lowering/byval-sret-arg-attr-lowering.cir
clang/test/CIR/Transforms/abi-lowering/coerce-alloca-addrspace.cir
clang/test/CIR/Transforms/abi-lowering/coerce-int-to-record.cir
clang/test/CIR/Transforms/abi-lowering/coerce-record-return-from-memory.cir
clang/test/CIR/Transforms/abi-lowering/coerce-record-return-larger.cir
clang/test/CIR/Transforms/abi-lowering/coerce-record-to-int.cir
clang/test/CIR/Transforms/abi-lowering/coerce-record-to-record-via-memory.cir
clang/test/CIR/Transforms/abi-lowering/coerce-vector-to-complex.cir
clang/test/CIR/Transforms/abi-lowering/datalayout-missing-error.cir
clang/test/CIR/Transforms/abi-lowering/declaration-rewrite.cir
clang/test/CIR/Transforms/abi-lowering/direct-flatten.cir
clang/test/CIR/Transforms/abi-lowering/direct-passthrough-injection.cir
clang/test/CIR/Transforms/abi-lowering/direct-passthrough-test-target.cir
clang/test/CIR/Transforms/abi-lowering/dropped-return-res-attrs.cir
clang/test/CIR/Transforms/abi-lowering/expand-struct-arg.cir
clang/test/CIR/Transforms/abi-lowering/extend-after-ignore.cir
clang/test/CIR/Transforms/abi-lowering/extend-return.cir
clang/test/CIR/Transforms/abi-lowering/extend-signed-arg.cir
clang/test/CIR/Transforms/abi-lowering/extend-unsigned-arg.cir
clang/test/CIR/Transforms/abi-lowering/ignore-arg.cir
clang/test/CIR/Transforms/abi-lowering/ignore-return.cir
clang/test/CIR/Transforms/abi-lowering/indirect-aliased-nyi.cir
clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir
clang/test/CIR/Transforms/abi-lowering/indirect-byval.cir
clang/test/CIR/Transforms/abi-lowering/indirect-call-classification-attr.cir
clang/test/CIR/Transforms/abi-lowering/indirect-call-test-target.cir
clang/test/CIR/Transforms/abi-lowering/indirect-call.cir
clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-forward-param.cir
clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-nyi.cir
clang/test/CIR/Transforms/abi-lowering/indirect-return-sret.cir
clang/test/CIR/Transforms/abi-lowering/indirect-variadic-call-test-target-nyi.cir
clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem-indirect.cir
clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem.cir
clang/test/CIR/Transforms/abi-lowering/try-call-nyi.cir
clang/test/CIR/Transforms/abi-lowering/variadic-call-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-aggregate-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-bitfield.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-bitint.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-complex.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-empty-class.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-empty-record.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-get-global.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-incomplete-record-declaration.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-variadic.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-int-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-lang-addrspace-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-record-copy.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-volatile.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-record-packed.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-scalars.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct-offset.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-struct-indirect.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-struct-padded.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-union-coerce-shapes.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-union.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-vaarg-valist-shape-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-call.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-nyi.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-vector.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-vptr.cir
clang/test/CIR/Transforms/abi-lowering/x86_64-wide-floats.cir
Removed:
################################################################################
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index bd762aae3e1d7e..4ffde906be3937 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -4351,6 +4351,13 @@ def CIR_FuncOp : CIR_Op<"func", [
without a prototype and, consequently, may contain calls with invalid
arguments and undefined behavior.
+ The `requires_call_conv_lowering` keyword marks a function whose signature
+ and call sites still have to be rewritten to match the target ABI by
+ CallConvLowering. Every function built in C++ starts out with it, and the
+ pass drops it once the function is lowered. A lowered signature uses
+ ordinary CIR types and cannot be told apart from one that still needs
+ lowering, so the pass works only on functions that carry the keyword.
+
The `global_ctor` keyword indicates whether a function should execute before
`main()` function, as specified by `__attribute__((constructor))`. An
execution priority can also be specified `global_ctor(<priority>)`.
@@ -4411,6 +4418,7 @@ def CIR_FuncOp : CIR_Op<"func", [
OptionalAttr<CIR_InlineKindAttr>:$inline_kind,
UnitAttr:$lambda,
UnitAttr:$no_proto,
+ UnitAttr:$requires_call_conv_lowering,
UnitAttr:$dso_local,
DefaultValuedAttr<
CIR_GlobalLinkageKindAttr,
diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index dae8005f870d75..7ebcedff6db775 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -2854,6 +2854,10 @@ void cir::FuncOp::build(OpBuilder &builder, OperationState &result,
GlobalLinkageKindAttr::get(builder.getContext(), linkage));
result.addAttribute(getCallingConvAttrName(result.name),
CallingConvAttr::get(builder.getContext(), callingConv));
+ // A function starts out written in source-level types, and CallConvLowering
+ // rewrites it to the target ABI later.
+ result.addAttribute(getRequiresCallConvLoweringAttrName(result.name),
+ builder.getUnitAttr());
}
//===----------------------------------------------------------------------===//
@@ -2882,6 +2886,8 @@ ParseResult cir::FuncOp::parse(OpAsmParser &parser, OperationState &state) {
mlir::StringAttr inlineKindNameAttr = getInlineKindAttrName(state.name);
mlir::StringAttr lambdaNameAttr = getLambdaAttrName(state.name);
mlir::StringAttr noProtoNameAttr = getNoProtoAttrName(state.name);
+ mlir::StringAttr requiresCallConvLoweringNameAttr =
+ getRequiresCallConvLoweringAttrName(state.name);
mlir::StringAttr comdatNameAttr = getComdatAttrName(state.name);
mlir::StringAttr alignmentNameAttr = getAlignmentAttrName(state.name);
mlir::StringAttr preferredAlignmentNameAttr =
@@ -3129,6 +3135,10 @@ ParseResult cir::FuncOp::parse(OpAsmParser &parser, OperationState &state) {
annotationsAttr)
state.addAttribute(annotationsNameAttr, annotationsAttr);
+ if (parser.parseOptionalKeyword(requiresCallConvLoweringNameAttr).succeeded())
+ state.addAttribute(requiresCallConvLoweringNameAttr,
+ parser.getBuilder().getUnitAttr());
+
// Parse the rest of the attributes.
NamedAttrList parsedAttrs;
llvm::SMLoc attrsLoc = parser.getCurrentLocation();
@@ -3329,6 +3339,9 @@ void cir::FuncOp::print(OpAsmPrinter &p) {
p.printAttribute(annotations);
}
+ if (getRequiresCallConvLowering())
+ p << ' ' << getRequiresCallConvLoweringAttrName().getValue();
+
// Every other declared attribute is printed by the syntax above.
llvm::SmallVector<llvm::StringRef> elidedAttrs;
for (llvm::StringRef name : cir::FuncOp::getAttributeNames())
diff --git a/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp b/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
index e20a6c1fd1d8ff..58665b754e6056 100644
--- a/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
@@ -225,6 +225,11 @@ void CallConvLoweringPass::runOnOperation() {
llvm::MapVector<cir::FuncOp, FunctionClassification> classifications;
bool anyFailed = false;
moduleOp.walk([&](cir::FuncOp f) {
+ // A lowered signature uses ordinary CIR types and cannot be told apart
+ // from one that still needs lowering, so only a function that says it
+ // needs lowering is lowered.
+ if (!f.getRequiresCallConvLowering())
+ return;
// A complete type is required at any call or definition, so only a
// declaration can carry an incomplete-by-value parameter or return type,
// and no translation unit can ever call or define it with real argument
@@ -265,7 +270,7 @@ void CallConvLoweringPass::runOnOperation() {
if (!call)
return;
cir::FuncOp callee = lookupCallee(op, symbolTable);
- if (!callee)
+ if (!callee || !callee.getRequiresCallConvLowering())
return;
callers[callee].push_back(op);
@@ -381,8 +386,14 @@ void CallConvLoweringPass::runOnOperation() {
// slot it erases that store, which is the operation a live walk has already
// cached as the next one to visit.
SmallVector<cir::CIRCallOpInterface> indirectCalls;
+ // An indirect call has no callee to say whether it is lowered, but it is
+ // lowered together with the function it is in.
+ auto inFunctionToLower = [](Operation *op) {
+ auto func = op->getParentOfType<cir::FuncOp>();
+ return func && func.getRequiresCallConvLowering();
+ };
moduleOp.walk([&](cir::CIRCallOpInterface c) {
- if (c.isIndirect())
+ if (c.isIndirect() && inFunctionToLower(c))
indirectCalls.push_back(c);
});
for (cir::CIRCallOpInterface c : indirectCalls) {
@@ -403,7 +414,10 @@ void CallConvLoweringPass::runOnOperation() {
// Collect the fetches before rewriting any, because rewriting one erases
// it, and a live walk holds the op it is about to visit next.
SmallVector<cir::VAArgOp> vaArgs;
- moduleOp.walk([&](cir::VAArgOp v) { vaArgs.push_back(v); });
+ moduleOp.walk([&](cir::VAArgOp v) {
+ if (inFunctionToLower(v))
+ vaArgs.push_back(v);
+ });
for (cir::VAArgOp v : vaArgs) {
std::optional<ArgClassification> ac = classifier->classifyVAArg(v);
if (!ac) {
@@ -415,6 +429,10 @@ void CallConvLoweringPass::runOnOperation() {
return;
}
}
+
+ // Everything in and around these functions now uses the target ABI.
+ for (auto &kv : classifications)
+ kv.first.setRequiresCallConvLowering(false);
}
} // namespace
diff --git a/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp b/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
index 93102e9f91bf48..7540abab7b046b 100644
--- a/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/EHABILowering.cpp
@@ -74,6 +74,9 @@ static cir::FuncOp getOrCreateRuntimeFuncDecl(mlir::ModuleOp mod,
auto funcOp = cir::FuncOp::create(builder, loc, name, funcTy);
funcOp.setLinkage(cir::GlobalLinkageKind::ExternalLinkage);
funcOp.setPrivate();
+ // This pass runs after CallConvLowering and builds the declaration in its
+ // target ABI form already.
+ funcOp.setRequiresCallConvLowering(false);
return funcOp;
}
@@ -249,6 +252,9 @@ void ItaniumEHLowering::ensureClangCallTerminate(mlir::Location loc) {
cir::FuncOp::create(builder, loc, "__clang_call_terminate", funcTy);
funcOp.setLinkage(cir::GlobalLinkageKind::LinkOnceODRLinkage);
funcOp.setGlobalVisibility(cir::VisibilityKind::Hidden);
+ // This pass runs after CallConvLowering and builds the function in its
+ // target ABI form already.
+ funcOp.setRequiresCallConvLowering(false);
mlir::Block *entryBlock = funcOp.addEntryBlock();
builder.setInsertionPointToStart(entryBlock);
diff --git a/clang/test/CIR/CodeGen/call-conv-lowering-x86_64-rerun.c b/clang/test/CIR/CodeGen/call-conv-lowering-x86_64-rerun.c
new file mode 100644
index 00000000000000..19012c7b453780
--- /dev/null
+++ b/clang/test/CIR/CodeGen/call-conv-lowering-x86_64-rerun.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir \
+// RUN: -mmlir --mlir-print-ir-before=cir-call-conv-lowering %s -o %t.cir 2> %t-before.cir
+// RUN: FileCheck %s --input-file=%t-before.cir --check-prefix=BEFORE
+// RUN: cir-opt %t.cir -o %t.once.cir
+// RUN: cir-opt %t.once.cir --cir-call-conv-lowering=target=x86_64 -o %t.twice.cir
+// RUN:
diff %t.once.cir %t.twice.cir
+// RUN: FileCheck %s --input-file=%t.once.cir --check-prefix=AFTER \
+// RUN: --implicit-check-not=requires_call_conv_lowering
+
+// A lowered signature uses ordinary CIR types, so CallConvLowering cannot tell
+// it apart from one that still needs lowering: struct V2 lowers to
+// vector<2 x float>, which the pass would lower again to double, as it does
+// for the source-level vector v2f. A function says it still needs lowering,
+// the pass drops that once it is lowered, and a second run on the pass's own
+// output finds nothing left to do.
+
+struct V2 { float x, y; };
+typedef float v2f __attribute__((vector_size(8)));
+
+struct V2 mk(float a) { struct V2 v = {a, a}; return v; }
+v2f vec(v2f a) { return a; }
+struct V2 call_indirect(struct V2 (*fp)(float)) { return fp(1.0f); }
+
+// BEFORE: cir.func {{.*}}@mk(%arg0: !cir.float {{.*}}) -> !rec_V2 requires_call_conv_lowering attributes
+// BEFORE: cir.func {{.*}}@vec(%arg0: !cir.vector<2 x !cir.float> {{.*}}) -> !cir.vector<2 x !cir.float> requires_call_conv_lowering attributes
+// BEFORE: cir.func {{.*}}@call_indirect(%arg0: !cir.ptr<!cir.func<(!cir.float) -> !rec_V2>> {{.*}}) -> !rec_V2 requires_call_conv_lowering attributes
+
+// AFTER: cir.func {{.*}}@mk(%arg0: !cir.float {{.*}}) -> !cir.vector<2 x !cir.float> attributes
+// AFTER: cir.func {{.*}}@vec(%arg0: !cir.double {{.*}}) -> !cir.double attributes
+// AFTER: cir.func {{.*}}@call_indirect(%arg0: !cir.ptr<!cir.func<(!cir.float) -> !rec_V2>> {{.*}}) -> !cir.vector<2 x !cir.float> attributes
+// AFTER: cir.call %{{.*}}(%{{.*}}) : (!cir.ptr<!cir.func<(!cir.float) -> !cir.vector<2 x !cir.float>>>, !cir.float {{.*}}) -> !cir.vector<2 x !cir.float>
diff --git a/clang/test/CIR/CodeGen/pointer-to-data-member.cpp b/clang/test/CIR/CodeGen/pointer-to-data-member.cpp
index c8df9e4a523b7c..c0dd470e4a66e5 100644
--- a/clang/test/CIR/CodeGen/pointer-to-data-member.cpp
+++ b/clang/test/CIR/CodeGen/pointer-to-data-member.cpp
@@ -111,7 +111,7 @@ int Diamond::*p_vbase_sibling_direct = &Diamond::d;
// Checks for test1()
-// CIR-BEFORE: cir.func {{.*}} @_Z5test1v() -> !cir.data_member<!s32i in !rec_Point> attributes {{{.*}}nothrow, optnone} {
+// CIR-BEFORE: cir.func {{.*}} @_Z5test1v() -> !cir.data_member<!s32i in !rec_Point> requires_call_conv_lowering attributes {{{.*}}nothrow, optnone} {
// CIR-BEFORE: %[[RETVAL:.*]] = cir.alloca "__retval" {{.*}} : !cir.ptr<!cir.data_member<!s32i in !rec_Point>>
// CIR-BEFORE: %[[MEMBER:.*]] = cir.const #cir.data_member<[1]> : !cir.data_member<!s32i in !rec_Point>
// CIR-BEFORE: cir.store %[[MEMBER]], %[[RETVAL]] : !cir.data_member<!s32i in !rec_Point>, !cir.ptr<!cir.data_member<!s32i in !rec_Point>>
diff --git a/clang/test/CIR/CodeGen/pointer-to-member-func.cpp b/clang/test/CIR/CodeGen/pointer-to-member-func.cpp
index bd450918ccd828..188cdfa0b64049 100644
--- a/clang/test/CIR/CodeGen/pointer-to-member-func.cpp
+++ b/clang/test/CIR/CodeGen/pointer-to-member-func.cpp
@@ -68,7 +68,7 @@ auto make_non_virtual() -> void (Foo::*)(int) {
// CIR-BEFORE: %[[RET:.*]] = cir.load %[[RETVAL]]
// CIR-BEFORE: cir.return %[[RET]] : !cir.method<!cir.func<(!cir.ptr<!rec_Foo>, !s32i)> in !rec_Foo>
-// CIR-AFTER: cir.func {{.*}} @_Z16make_non_virtualv() -> !rec_anon_struct attributes {{{.*}}nothrow, optnone} {
+// CIR-AFTER: cir.func {{.*}} @_Z16make_non_virtualv() -> !rec_anon_struct{{.*}} attributes {{{.*}}nothrow, optnone} {
// CIR-AFTER: %[[RETVAL:.*]] = cir.alloca "__retval" {{.*}} : !cir.ptr<!rec_anon_struct>
// CIR-AFTER: %[[METHOD_PTR:.*]] = cir.get_global @[[NONVIRT_RET]] : !cir.ptr<!rec_anon_struct>
// CIR-AFTER: cir.copy %[[METHOD_PTR]] to %[[RETVAL]] : !cir.ptr<!rec_anon_struct>
diff --git a/clang/test/CIR/CodeGenCUDA/kernel-stub-name.cu b/clang/test/CIR/CodeGenCUDA/kernel-stub-name.cu
index 865f3f779c620b..ddba96d973138f 100644
--- a/clang/test/CIR/CodeGenCUDA/kernel-stub-name.cu
+++ b/clang/test/CIR/CodeGenCUDA/kernel-stub-name.cu
@@ -8,19 +8,19 @@
#include "Inputs/cuda.h"
// CHECK: cir.func {{.*}} @[[CSTUB:__device_stub__ckernel]]()
-// CIR-BEFORE-LPP: cir.func {{.*}} @[[CSTUB:__device_stub__ckernel]]() attributes {{{.*}}cu.kernel_name = #cir.cu.kernel_name<"ckernel">{{.*}}}
+// CIR-BEFORE-LPP: cir.func {{.*}} @[[CSTUB:__device_stub__ckernel]]() requires_call_conv_lowering attributes {{{.*}}cu.kernel_name = #cir.cu.kernel_name<"ckernel">{{.*}}}
// CHECK: cir.return
// CHECK-NEXT: }
extern "C" __global__ void ckernel() {}
// CHECK: cir.func {{.*}} @_ZN2ns23__device_stub__nskernelEv()
-// CIR-BEFORE-LPP: cir.func {{.*}} @_ZN2ns23__device_stub__nskernelEv() attributes {{{.*}}cu.kernel_name = #cir.cu.kernel_name<"_ZN2ns8nskernelEv">{{.*}}}
+// CIR-BEFORE-LPP: cir.func {{.*}} @_ZN2ns23__device_stub__nskernelEv() requires_call_conv_lowering attributes {{{.*}}cu.kernel_name = #cir.cu.kernel_name<"_ZN2ns8nskernelEv">{{.*}}}
namespace ns {
__global__ void nskernel() {}
} // namespace ns
// CHECK: cir.func {{.*}} @_Z25__device_stub__kernelfuncIiEvv()
-// CIR-BEFORE-LPP: cir.func {{.*}} @_Z25__device_stub__kernelfuncIiEvv() attributes {{{.*}}cu.kernel_name = #cir.cu.kernel_name<"_Z10kernelfuncIiEvv">{{.*}}}
+// CIR-BEFORE-LPP: cir.func {{.*}} @_Z25__device_stub__kernelfuncIiEvv() requires_call_conv_lowering attributes {{{.*}}cu.kernel_name = #cir.cu.kernel_name<"_Z10kernelfuncIiEvv">{{.*}}}
template <class T>
__global__ void kernelfunc() {}
template __global__ void kernelfunc<int>();
diff --git a/clang/test/CIR/CodeGenCUDA/vtable-host-device.cu b/clang/test/CIR/CodeGenCUDA/vtable-host-device.cu
index bb13a0cf184489..06c87e19da7d95 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() {
+// CIR-DEV: cir.func weak {{.*}}@__cxa_deleted_virtual() requires_call_conv_lowering {
// CIR-DEV-NEXT: cir.trap
// CIR-DEV-NEXT: }
-// CIR-DEV: cir.func weak {{.*}}@__cxa_pure_virtual() {
+// CIR-DEV: cir.func weak {{.*}}@__cxa_pure_virtual() requires_call_conv_lowering {
// 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 ec1c0e4f81cd0a..72faab8bcd74c5 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}
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/amdgpu-byref.cir b/clang/test/CIR/Transforms/abi-lowering/amdgpu-byref.cir
index b2b23a8c4158b1..45a4886a33ee5a 100644
--- a/clang/test/CIR/Transforms/abi-lowering/amdgpu-byref.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/amdgpu-byref.cir
@@ -16,7 +16,7 @@ module attributes {
} {
// The CIRGen slot for a kernel argument is filled by a copy from addrspace(4).
- cir.func @kern_pair(%arg0: !rec_Pair) -> !s32i cc(amdgpu_kernel) {
+ cir.func @kern_pair(%arg0: !rec_Pair) -> !s32i cc(amdgpu_kernel) requires_call_conv_lowering {
%0 = cir.alloca "p" align(4) init : !cir.ptr<!rec_Pair, target_address_space(5)>
cir.store %arg0, %0 : !rec_Pair, !cir.ptr<!rec_Pair, target_address_space(5)>
%1 = cir.get_member %0[1] {name = "b"}
@@ -34,14 +34,14 @@ module attributes {
// CHECK-NEXT: cir.return %[[B]] : !s32i
// A device-function argument past the register budget.
- cir.func @take_big(%arg0: !rec_Big) {
+ cir.func @take_big(%arg0: !rec_Big) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_big(%{{.*}}: !cir.ptr<!rec_Big, target_address_space(5)> {llvm.align = 4 : i64, llvm.byref = !rec_Big, llvm.noundef}) {
// The caller hands its own addrspace(5) storage to the callee.
- cir.func @call_big() {
+ cir.func @call_big() requires_call_conv_lowering {
%0 = cir.alloca "b" align(4) : !cir.ptr<!rec_Big, target_address_space(5)>
%1 = cir.load %0 : !cir.ptr<!rec_Big, target_address_space(5)>, !rec_Big
cir.call @take_big(%1) : (!rec_Big) -> ()
diff --git a/clang/test/CIR/Transforms/abi-lowering/amdgpu-calling-conv.cir b/clang/test/CIR/Transforms/abi-lowering/amdgpu-calling-conv.cir
index 89913b8b6f10d7..fcff3e00cbc336 100644
--- a/clang/test/CIR/Transforms/abi-lowering/amdgpu-calling-conv.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/amdgpu-calling-conv.cir
@@ -24,14 +24,14 @@ module attributes {
} {
// Signed sub-register integer is sign-extended.
- cir.func @take_s8(%arg0: !s8i) {
+ cir.func @take_s8(%arg0: !s8i) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_s8(%arg0: !s8i {llvm.noundef, llvm.signext})
// Call site picks up the same extension attribute on the operand.
- cir.func @call_s8(%arg0: !s8i) {
+ cir.func @call_s8(%arg0: !s8i) requires_call_conv_lowering {
cir.call @take_s8(%arg0) : (!s8i) -> ()
cir.return
}
@@ -40,7 +40,7 @@ module attributes {
// A zero-field record classifies as Ignore: the empty argument is dropped
// and the real argument shifts down to the first slot.
- cir.func @take_empty(%arg0: !rec_E0, %arg1: !s32i) -> !s32i {
+ cir.func @take_empty(%arg0: !rec_E0, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg1 : !s32i
}
@@ -49,7 +49,7 @@ module attributes {
// A 33-64 bit aggregate is packed into a pair of i32 registers, coerced on
// the wire to a [2 x i32] array.
- cir.func @takes_pair32(%arg0: !rec_Pair32) {
+ cir.func @takes_pair32(%arg0: !rec_Pair32) requires_call_conv_lowering {
%0 = cir.alloca "p" align(4) : !cir.ptr<!rec_Pair32>
cir.store %arg0, %0 : !rec_Pair32, !cir.ptr<!rec_Pair32>
cir.return
@@ -63,7 +63,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[TMP_REC]] align(4) to %[[P]] align(4) : !cir.ptr<!rec_Pair32>
// A 33-64 bit aggregate return is coerced to [2 x i32] as well.
- cir.func @ret_pair32(%arg0: !cir.ptr<!rec_Pair32>) -> !rec_Pair32 {
+ cir.func @ret_pair32(%arg0: !cir.ptr<!rec_Pair32>) -> !rec_Pair32 requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_Pair32>, !rec_Pair32
cir.return %0 : !rec_Pair32
}
@@ -76,7 +76,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[RET]] : !cir.array<!u32i x 2>
// The call site coerces both the operand and the result.
- cir.func @call_pair32() {
+ cir.func @call_pair32() requires_call_conv_lowering {
%0 = cir.alloca "p" align(4) : !cir.ptr<!rec_Pair32>
%1 = cir.load %0 : !cir.ptr<!rec_Pair32>, !rec_Pair32
cir.call @takes_pair32(%1) : (!rec_Pair32) -> ()
@@ -98,7 +98,7 @@ module attributes {
// A larger aggregate that still fits the register budget is passed directly,
// one argument per field, as classic codegen does.
- cir.func @takes_triple(%arg0: !rec_Triple) -> !s32i {
+ cir.func @takes_triple(%arg0: !rec_Triple) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "t" align(4) : !cir.ptr<!rec_Triple>
cir.store %arg0, %0 : !rec_Triple, !cir.ptr<!rec_Triple>
%1 = cir.get_member %0[1] {name = "b"} : !cir.ptr<!rec_Triple> -> !cir.ptr<!s32i>
@@ -121,7 +121,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[B]] : !s32i
// A direct aggregate return is not split.
- cir.func @ret_triple(%arg0: !cir.ptr<!rec_Triple>) -> !rec_Triple {
+ cir.func @ret_triple(%arg0: !cir.ptr<!rec_Triple>) -> !rec_Triple requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_Triple>, !rec_Triple
cir.return %0 : !rec_Triple
}
@@ -131,7 +131,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[V]] : !rec_Triple
// The call site passes each field of the operand as its own argument.
- cir.func @call_triple() -> !s32i {
+ cir.func @call_triple() -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "t" align(4) : !cir.ptr<!rec_Triple>
%1 = cir.load %0 : !cir.ptr<!rec_Triple>, !rec_Triple
%2 = cir.call @takes_triple(%1) : (!rec_Triple) -> !s32i
@@ -154,7 +154,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[R]] : !s32i
// Only the top level is split, so a nested struct stays one argument.
- cir.func @takes_outer(%arg0: !rec_Outer) {
+ cir.func @takes_outer(%arg0: !rec_Outer) requires_call_conv_lowering {
cir.return
}
@@ -168,14 +168,14 @@ module attributes {
// A kernel scalar argument stays Direct: the AMDGPU_KERNEL convention is
// routed to the kernel classifier and the signature is unchanged.
- cir.func @kernel_scalar(%arg0: !s32i) cc(amdgpu_kernel) {
+ cir.func @kernel_scalar(%arg0: !s32i) cc(amdgpu_kernel) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @kernel_scalar(%arg0: !s32i){{.*}}cc(amdgpu_kernel)
// Without HIP in the module's lang options, a kernel pointer stays generic.
- cir.func @kernel_ptr(%arg0: !cir.ptr<!s32i>) cc(amdgpu_kernel) {
+ cir.func @kernel_ptr(%arg0: !cir.ptr<!s32i>) cc(amdgpu_kernel) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/amdgpu-indirect-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/amdgpu-indirect-nyi.cir
index 00fdbe8bba5237..c0521d18a08bda 100644
--- a/clang/test/CIR/Transforms/abi-lowering/amdgpu-indirect-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/amdgpu-indirect-nyi.cir
@@ -13,7 +13,7 @@ module attributes {
} {
// A return past the register budget goes through an sret in addrspace(5).
- cir.func @ret_big(%arg0: !cir.ptr<!rec_Big>) -> !rec_Big {
+ cir.func @ret_big(%arg0: !cir.ptr<!rec_Big>) -> !rec_Big requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_Big>, !rec_Big
cir.return %0 : !rec_Big
}
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 ba808ae6bed380..8e876439135869 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
@@ -19,7 +19,7 @@ module attributes {
// The kernel casts the incoming global pointer back to generic before the
// body's spill reads it.
- cir.func @kernel_ptr(%arg0: !cir.ptr<!s32i>) cc(amdgpu_kernel) {
+ cir.func @kernel_ptr(%arg0: !cir.ptr<!s32i>) cc(amdgpu_kernel) requires_call_conv_lowering {
%0 = cir.alloca "p" align(8) init : !cir.ptr<!cir.ptr<!s32i>>
cir.store %arg0, %0 : !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>
cir.return
@@ -31,7 +31,7 @@ module attributes {
// A pointer already outside the generic address space is left alone.
cir.func @kernel_global_ptr(%arg0: !cir.ptr<!s32i, target_address_space(1)>)
- cc(amdgpu_kernel) {
+ cc(amdgpu_kernel) requires_call_conv_lowering {
cir.return
}
@@ -39,14 +39,14 @@ module attributes {
// CHECK-NOT: cir.cast
// A struct holding only a pointer is unwrapped to it, then coerced.
- cir.func @kernel_ptr_wrap(%arg0: !rec_PtrWrap) cc(amdgpu_kernel) {
+ cir.func @kernel_ptr_wrap(%arg0: !rec_PtrWrap) cc(amdgpu_kernel) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @kernel_ptr_wrap(%{{.*}}: !cir.ptr<{{.*}}, target_address_space(1)>){{.*}}cc(amdgpu_kernel)
// Only kernels are coerced.
- cir.func @device_ptr(%arg0: !cir.ptr<!s32i>) {
+ cir.func @device_ptr(%arg0: !cir.ptr<!s32i>) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/byval-sret-arg-attr-lowering.cir b/clang/test/CIR/Transforms/abi-lowering/byval-sret-arg-attr-lowering.cir
index edff27f74c6062..25f245cc214cec 100644
--- a/clang/test/CIR/Transforms/abi-lowering/byval-sret-arg-attr-lowering.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/byval-sret-arg-attr-lowering.cir
@@ -49,7 +49,7 @@ module attributes {
// The byval argument attribute carries the record type. cir-to-llvm must
// convert that type to the LLVM struct so translation emits byval(%struct).
- cir.func @takes_big(%arg0: !rec_Big) attributes { test_classify = #byval_arg } {
+ cir.func @takes_big(%arg0: !rec_Big) requires_call_conv_lowering attributes { test_classify = #byval_arg } {
cir.return
}
@@ -57,7 +57,7 @@ module attributes {
// LLVM: define void @takes_big(ptr noundef byval(%struct.Big) align 8 %{{.+}})
// The sret return attribute is converted the same way.
- cir.func @ret_big() -> !rec_Big attributes { test_classify = #sret_ret } {
+ cir.func @ret_big() -> !rec_Big requires_call_conv_lowering attributes { test_classify = #sret_ret } {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.store %z, %0 : !rec_Big, !cir.ptr<!rec_Big>
@@ -69,7 +69,7 @@ module attributes {
// LLVM: define void @ret_big(ptr dead_on_unwind noalias writable sret(%struct.Big) align 8 %{{.+}})
// The non-byval form has no typed attribute, so there is nothing to remap.
- cir.func @takes_non_byval(%arg0: !rec_Big) attributes { test_classify = #non_byval_arg } {
+ cir.func @takes_non_byval(%arg0: !rec_Big) requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
cir.return
}
@@ -77,7 +77,7 @@ module attributes {
// LLVM: define void @takes_non_byval(ptr nofreeobj noundef align 8 dead_on_return dereferenceable(24) %{{.+}})
// A three-element vector holds 12 bytes, and its allocation is padded to 16.
- cir.func @takes_vec3_non_byval(%arg0: !cir.vector<3 x !s32i>)
+ cir.func @takes_vec3_non_byval(%arg0: !cir.vector<3 x !s32i>) requires_call_conv_lowering
attributes { test_classify = #non_byval_vec_arg } {
cir.return
}
@@ -87,7 +87,7 @@ module attributes {
// The byref argument attribute is converted like byval, on a pointer in its
// own address space.
- cir.func @takes_big_byref(%arg0: !rec_Big) attributes { test_classify = #byref_as4_arg } {
+ cir.func @takes_big_byref(%arg0: !rec_Big) requires_call_conv_lowering attributes { test_classify = #byref_as4_arg } {
cir.return
}
@@ -95,7 +95,7 @@ module attributes {
// LLVM: define void @takes_big_byref(ptr addrspace(4) noundef byref(%struct.Big) align 8 %{{.+}})
// The call site's byval operand attribute is converted too.
- cir.func @caller(%s: !rec_Big) attributes { test_classify = #passthrough } {
+ cir.func @caller(%s: !rec_Big) requires_call_conv_lowering attributes { test_classify = #passthrough } {
cir.call @takes_big(%s) : (!rec_Big) -> ()
cir.return
}
@@ -105,7 +105,7 @@ module attributes {
// A caller of an sret function carries the sret attribute on the call
// operand; its type payload is converted as well.
- cir.func @caller_sret() attributes { test_classify = #passthrough } {
+ cir.func @caller_sret() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%r = cir.call @ret_big() : () -> !rec_Big
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/coerce-alloca-addrspace.cir b/clang/test/CIR/Transforms/abi-lowering/coerce-alloca-addrspace.cir
index 3f84f83179a9e7..6feeb6a2c287ba 100644
--- a/clang/test/CIR/Transforms/abi-lowering/coerce-alloca-addrspace.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/coerce-alloca-addrspace.cir
@@ -45,7 +45,7 @@ module attributes {
} {
cir.func @takes_pair(%arg0: !rec_Pair)
- attributes { test_classify = #coerce_pair_to_i64 } {
+ requires_call_conv_lowering attributes { test_classify = #coerce_pair_to_i64 } {
%0 = cir.alloca "p" align(4) : !cir.ptr<!rec_Pair, target_address_space(5)>
cir.store %arg0, %0 : !rec_Pair, !cir.ptr<!rec_Pair, target_address_space(5)>
cir.return
@@ -56,7 +56,7 @@ cir.func @takes_pair(%arg0: !rec_Pair)
// CHECK: cir.store %[[ARG]], %[[SLOT]] : !s64i, !cir.ptr<!s64i, target_address_space(5)>
// CHECK: cir.cast bitcast %[[SLOT]] : !cir.ptr<!s64i, target_address_space(5)> -> !cir.ptr<!rec_Pair, target_address_space(5)>
-cir.func @call_pair() attributes { test_classify = #passthrough } {
+cir.func @call_pair() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.const #cir.zero : !rec_Pair
cir.call @takes_pair(%0) : (!rec_Pair) -> ()
cir.return
@@ -69,7 +69,7 @@ cir.func @call_pair() attributes { test_classify = #passthrough } {
// CHECK: cir.call @takes_pair(%[[INT]]) : (!s64i) -> ()
cir.func @ret_pair() -> !rec_Pair
- attributes { test_classify = #ret_pair_as_i64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_pair_as_i64 } {
%0 = cir.const #cir.zero : !rec_Pair
cir.return %0 : !rec_Pair
}
@@ -83,7 +83,7 @@ cir.func @ret_pair() -> !rec_Pair
// The flattened fields go through a slot of the coerced struct, and their
// member pointers keep its address space.
cir.func @takes_dim3(%arg0: !rec_Dim3)
- attributes { test_classify = #flatten_dim3 } {
+ requires_call_conv_lowering attributes { test_classify = #flatten_dim3 } {
cir.return
}
@@ -97,7 +97,7 @@ cir.func @takes_dim3(%arg0: !rec_Dim3)
// CHECK-NOT: cir.load {{.*}}!rec_Dim3
// CHECK: cir.return
-cir.func @call_dim3() attributes { test_classify = #passthrough } {
+cir.func @call_dim3() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.const #cir.zero : !rec_Dim3
cir.call @takes_dim3(%0) : (!rec_Dim3) -> ()
cir.return
@@ -114,7 +114,7 @@ cir.func @call_dim3() attributes { test_classify = #passthrough } {
// Expanded fields are stored straight into the parameter's own slot, so their
// member pointers take that slot's address space.
cir.func @takes_two_long(%arg0: !rec_TwoLong)
- attributes { test_classify = #expand_two } {
+ requires_call_conv_lowering attributes { test_classify = #expand_two } {
%0 = cir.alloca "p" align(8) init : !cir.ptr<!rec_TwoLong, target_address_space(5)>
cir.store %arg0, %0 : !rec_TwoLong, !cir.ptr<!rec_TwoLong, target_address_space(5)>
cir.return
diff --git a/clang/test/CIR/Transforms/abi-lowering/coerce-int-to-record.cir b/clang/test/CIR/Transforms/abi-lowering/coerce-int-to-record.cir
index 71f129399eec1c..23c38700d5415e 100644
--- a/clang/test/CIR/Transforms/abi-lowering/coerce-int-to-record.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/coerce-int-to-record.cir
@@ -22,7 +22,7 @@ module attributes {
} {
cir.func @returns_pair() -> !rec_Pair
- attributes { test_classify = #coerce_pair_return_to_i64 } {
+ requires_call_conv_lowering attributes { test_classify = #coerce_pair_return_to_i64 } {
%0 = cir.const #cir.zero : !rec_Pair
cir.return %0 : !rec_Pair
}
@@ -37,7 +37,7 @@ module attributes {
// CHECK: cir.return %[[COERCED]] : !s64i
cir.func @caller() -> !s32i
- attributes { test_classify = #caller_ret_i32 } {
+ requires_call_conv_lowering attributes { test_classify = #caller_ret_i32 } {
%0 = cir.call @returns_pair() : () -> !rec_Pair
%1 = cir.alloca "r" align(4) : !cir.ptr<!rec_Pair>
cir.store %0, %1 : !rec_Pair, !cir.ptr<!rec_Pair>
diff --git a/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-from-memory.cir b/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-from-memory.cir
index a947627c3bfabb..9b455969dedaff 100644
--- a/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-from-memory.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-from-memory.cir
@@ -46,7 +46,7 @@ module attributes {
// The alloca is big enough for the coerced type, so it is read in place.
cir.func @returns_pair64() -> !rec_Pair64
- attributes { test_classify = #ret_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_twoi64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64>
%1 = cir.const #cir.zero : !rec_Pair64
cir.store %1, %0 : !rec_Pair64, !cir.ptr<!rec_Pair64>
@@ -64,7 +64,7 @@ module attributes {
// The read keeps the alloca's alignment when the coerced type wants more.
cir.func @returns_pair32() -> !rec_Pair32
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "__retval" align(4) : !cir.ptr<!rec_Pair32>
%1 = cir.const #cir.zero : !rec_Pair32
cir.store %1, %0 : !rec_Pair32, !cir.ptr<!rec_Pair32>
@@ -82,7 +82,7 @@ module attributes {
// An over-aligned alloca passes its alignment on to the read.
cir.func @returns_pair64_align16() -> !rec_Pair64
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "__retval" align(16) : !cir.ptr<!rec_Pair64>
%1 = cir.load %0 : !cir.ptr<!rec_Pair64>, !rec_Pair64
cir.return %1 : !rec_Pair64
@@ -96,7 +96,7 @@ module attributes {
// The alloca is written after the load, so the read goes at the load.
cir.func @returns_before_overwrite() -> !rec_Pair64
- attributes { test_classify = #ret_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_twoi64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64>
%1 = cir.const #cir.zero : !rec_Pair64
cir.store %1, %0 : !rec_Pair64, !cir.ptr<!rec_Pair64>
@@ -118,7 +118,7 @@ module attributes {
// The record load has another user, so it stays.
cir.func @returns_and_stores(%arg0: !cir.ptr<!rec_Pair64>) -> !rec_Pair64
- attributes { test_classify = #ret_s64_one_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64_one_arg } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64>
%1 = cir.load %0 : !cir.ptr<!rec_Pair64>, !rec_Pair64
cir.store %1, %arg0 : !rec_Pair64, !cir.ptr<!rec_Pair64>
@@ -135,7 +135,7 @@ module attributes {
// Each return gets its own read at the shared load, which then goes away.
cir.func @returns_twice(%arg0: !cir.bool) -> !rec_Pair64
- attributes { test_classify = #ret_s64_one_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64_one_arg } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64>
%1 = cir.load %0 : !cir.ptr<!rec_Pair64>, !rec_Pair64
cir.brcond %arg0 ^bb1, ^bb2
@@ -159,7 +159,7 @@ module attributes {
// A load that reaches its alloca through a bitcast is still read in place.
cir.func @returns_through_bitcast() -> !rec_Pair64
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "buf" align(8) : !cir.ptr<!cir.array<!s64i x 2>>
%1 = cir.cast bitcast %0 : !cir.ptr<!cir.array<!s64i x 2>> -> !cir.ptr<!rec_Pair64>
%2 = cir.load %1 : !cir.ptr<!rec_Pair64>, !rec_Pair64
@@ -175,7 +175,7 @@ module attributes {
// The view stays in the alloca's address space.
cir.func @returns_from_addrspace() -> !rec_Pair64
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64, target_address_space(5)>
%1 = cir.load %0 : !cir.ptr<!rec_Pair64, target_address_space(5)>, !rec_Pair64
cir.return %1 : !rec_Pair64
@@ -189,7 +189,7 @@ module attributes {
// Through an address space cast the load is still read in place.
cir.func @returns_through_addrspace_cast() -> !rec_Pair64
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64, target_address_space(5)>
%1 = cir.cast address_space %0 : !cir.ptr<!rec_Pair64, target_address_space(5)> -> !cir.ptr<!rec_Pair64>
%2 = cir.load %1 : !cir.ptr<!rec_Pair64>, !rec_Pair64
@@ -205,7 +205,7 @@ module attributes {
// A 16-byte read does not fit the 12-byte record, so its bytes are copied.
cir.func @returns_vec3() -> !rec_Vec3
- attributes { test_classify = #ret_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_twoi64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Vec3>
%1 = cir.load %0 : !cir.ptr<!rec_Vec3>, !rec_Vec3
cir.return %1 : !rec_Vec3
@@ -221,7 +221,7 @@ module attributes {
// The alloca is written after the load, so the copy goes at the load.
cir.func @returns_vec3_before_overwrite() -> !rec_Vec3
- attributes { test_classify = #ret_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_twoi64 } {
%0 = cir.alloca "__retval" align(4) : !cir.ptr<!rec_Vec3>
%1 = cir.load %0 : !cir.ptr<!rec_Vec3>, !rec_Vec3
%2 = cir.const #cir.zero : !rec_Vec3
@@ -241,7 +241,7 @@ module attributes {
// The coercion slot is raised to the alignment of the storage copied from.
cir.func @returns_vec3_overaligned() -> !rec_Vec3
- attributes { test_classify = #ret_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_twoi64 } {
%0 = cir.alloca "__retval" align(32) : !cir.ptr<!rec_Vec3>
%1 = cir.load %0 : !cir.ptr<!rec_Vec3>, !rec_Vec3
cir.return %1 : !rec_Vec3
@@ -257,7 +257,7 @@ module attributes {
// The bytes are copied from the alloca's address space into a default one.
cir.func @returns_vec3_from_addrspace() -> !rec_Vec3
- attributes { test_classify = #ret_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_twoi64 } {
%0 = cir.alloca "__retval" align(4) : !cir.ptr<!rec_Vec3, target_address_space(5)>
%1 = cir.load %0 : !cir.ptr<!rec_Vec3, target_address_space(5)>, !rec_Vec3
cir.return %1 : !rec_Vec3
@@ -273,7 +273,7 @@ module attributes {
// A u24's 4-byte alloc size exceeds the 3-byte record, so it is copied.
cir.func @returns_three() -> !rec_Three
- attributes { test_classify = #ret_u24 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_u24 } {
%0 = cir.alloca "__retval" align(1) : !cir.ptr<!rec_Three>
%1 = cir.load %0 : !cir.ptr<!rec_Three>, !rec_Three
cir.return %1 : !rec_Three
@@ -289,7 +289,7 @@ module attributes {
// A _BitInt is not a record, so its value is stored into the slot.
cir.func @returns_bitint() -> !b33i
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!b33i>
%1 = cir.load %0 : !cir.ptr<!b33i>, !b33i
cir.return %1 : !b33i
@@ -307,7 +307,7 @@ module attributes {
// A volatile load stays volatile as a volatile copy into the slot, even
// from an alloca that could otherwise be read in place.
cir.func @returns_volatile() -> !rec_Pair64
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64>
%1 = cir.load volatile %0 : !cir.ptr<!rec_Pair64>, !rec_Pair64
cir.return %1 : !rec_Pair64
@@ -323,7 +323,7 @@ module attributes {
// A record read through a non-alloca pointer has its bytes copied.
cir.func @returns_from_pointer(%arg0: !cir.ptr<!rec_Pair64>) -> !rec_Pair64
- attributes { test_classify = #ret_s64_one_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64_one_arg } {
%0 = cir.load %arg0 : !cir.ptr<!rec_Pair64>, !rec_Pair64
cir.return %0 : !rec_Pair64
}
@@ -337,7 +337,7 @@ module attributes {
// Without an alloca, the slot takes the alignment the record load carries.
cir.func @returns_vec3_from_aligned_pointer(%arg0: !cir.ptr<!rec_Vec3>) -> !rec_Vec3
- attributes { test_classify = #ret_twoi64_one_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ret_twoi64_one_arg } {
%0 = cir.load align(32) %arg0 : !cir.ptr<!rec_Vec3>, !rec_Vec3
cir.return %0 : !rec_Vec3
}
@@ -370,7 +370,7 @@ module attributes {
// An atomic load has to happen as written, and a copy cannot keep it
// atomic.
cir.func @returns_atomic() -> !rec_Pair64
- attributes { test_classify = #ret_s64 } {
+ requires_call_conv_lowering attributes { test_classify = #ret_s64 } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Pair64>
%1 = cir.load atomic(seq_cst) %0 : !cir.ptr<!rec_Pair64>, !rec_Pair64
// expected-error @below {{atomic load of a record operand not yet implemented in CallConvLowering}}
diff --git a/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-larger.cir b/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-larger.cir
index f080569a409fa4..9c00be7c6c4885 100644
--- a/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-larger.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/coerce-record-return-larger.cir
@@ -23,7 +23,7 @@ module attributes {
} {
cir.func @returns_vec3() -> !rec_Vec3
- attributes { test_classify = #coerce_vec3_return_to_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #coerce_vec3_return_to_twoi64 } {
%0 = cir.const #cir.zero : !rec_Vec3
cir.return %0 : !rec_Vec3
}
@@ -41,7 +41,7 @@ module attributes {
// CHECK: cir.return %[[COERCED]] : !rec_TwoI64
cir.func @caller() -> !s32i
- attributes { test_classify = #caller_ret_i32 } {
+ requires_call_conv_lowering attributes { test_classify = #caller_ret_i32 } {
%0 = cir.call @returns_vec3() : () -> !rec_Vec3
%1 = cir.alloca "r" align(4) : !cir.ptr<!rec_Vec3>
cir.store %0, %1 : !rec_Vec3, !cir.ptr<!rec_Vec3>
diff --git a/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-int.cir b/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-int.cir
index bca69d3a89bad3..4cc6e18d548a6f 100644
--- a/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-int.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-int.cir
@@ -22,7 +22,7 @@ module attributes {
} {
cir.func @takes_pair(%arg0: !rec_Pair)
- attributes { test_classify = #coerce_pair_to_i64 } {
+ requires_call_conv_lowering attributes { test_classify = #coerce_pair_to_i64 } {
%0 = cir.alloca "p" align(4) : !cir.ptr<!rec_Pair>
cir.store %arg0, %0 : !rec_Pair, !cir.ptr<!rec_Pair>
cir.return
@@ -37,7 +37,7 @@ module attributes {
// CHECK: cir.copy %[[CAST]] align(8) to %[[P]] align(4) : !cir.ptr<!rec_Pair>
cir.func @caller()
- attributes { test_classify = #caller_no_args } {
+ requires_call_conv_lowering attributes { test_classify = #caller_no_args } {
%0 = cir.alloca "p" align(4) : !cir.ptr<!rec_Pair>
%1 = cir.load %0 : !cir.ptr<!rec_Pair>, !rec_Pair
cir.call @takes_pair(%1) : (!rec_Pair) -> ()
diff --git a/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-record-via-memory.cir b/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-record-via-memory.cir
index 830e973d940300..d9c2e86b2fbb35 100644
--- a/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-record-via-memory.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/coerce-record-to-record-via-memory.cir
@@ -23,7 +23,7 @@ module attributes {
} {
cir.func @takes_vec(%arg0: !rec_Vec4)
- attributes { test_classify = #coerce_vec4_to_twoi64 } {
+ requires_call_conv_lowering attributes { test_classify = #coerce_vec4_to_twoi64 } {
%0 = cir.alloca "v" align(4) : !cir.ptr<!rec_Vec4>
cir.store %arg0, %0 : !rec_Vec4, !cir.ptr<!rec_Vec4>
cir.return
@@ -38,7 +38,7 @@ module attributes {
// CHECK: cir.copy %[[CAST]] align(8) to %[[V]] align(4) : !cir.ptr<!rec_Vec4>
cir.func @caller()
- attributes { test_classify = #caller_no_args } {
+ requires_call_conv_lowering attributes { test_classify = #caller_no_args } {
%0 = cir.alloca "v" align(4) : !cir.ptr<!rec_Vec4>
%1 = cir.load %0 : !cir.ptr<!rec_Vec4>, !rec_Vec4
cir.call @takes_vec(%1) : (!rec_Vec4) -> ()
diff --git a/clang/test/CIR/Transforms/abi-lowering/coerce-vector-to-complex.cir b/clang/test/CIR/Transforms/abi-lowering/coerce-vector-to-complex.cir
index a1eebacd7af8c2..70cfc6a0c58d66 100644
--- a/clang/test/CIR/Transforms/abi-lowering/coerce-vector-to-complex.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/coerce-vector-to-complex.cir
@@ -13,7 +13,7 @@ module attributes {
} {
cir.func @takes_complex(%arg0: !cir.complex<!cir.float>)
- attributes { test_classify = #coerce_complex_to_vec2 } {
+ requires_call_conv_lowering attributes { test_classify = #coerce_complex_to_vec2 } {
cir.return
}
@@ -25,7 +25,7 @@ module attributes {
// CHECK: %{{.*}} = cir.load %[[CAST]] : !cir.ptr<!cir.complex<!cir.float>>, !cir.complex<!cir.float>
cir.func @caller(%arg0: !cir.complex<!cir.float>)
- attributes { test_classify = #coerce_complex_to_vec2 } {
+ requires_call_conv_lowering attributes { test_classify = #coerce_complex_to_vec2 } {
cir.call @takes_complex(%arg0) : (!cir.complex<!cir.float>) -> ()
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/datalayout-missing-error.cir b/clang/test/CIR/Transforms/abi-lowering/datalayout-missing-error.cir
index 644f9ec714e492..cabe5bc9df48d6 100644
--- a/clang/test/CIR/Transforms/abi-lowering/datalayout-missing-error.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/datalayout-missing-error.cir
@@ -8,7 +8,7 @@
module {
- cir.func @passthrough(%arg0: !s32i) -> !s32i {
+ cir.func @passthrough(%arg0: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/declaration-rewrite.cir b/clang/test/CIR/Transforms/abi-lowering/declaration-rewrite.cir
index 1e6acf7e01dc15..d9165379f89f6d 100644
--- a/clang/test/CIR/Transforms/abi-lowering/declaration-rewrite.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/declaration-rewrite.cir
@@ -23,13 +23,13 @@ module attributes {
} {
cir.func private @ext_decl(!s32i, !s32i) -> !s32i
- attributes { test_classify = #ignore_first_arg }
+ requires_call_conv_lowering attributes { test_classify = #ignore_first_arg }
// The first argument type is dropped from the declaration's signature.
// CHECK: cir.func{{.*}} @ext_decl(!s32i) -> !s32i
cir.func @caller(%arg0: !s32i, %arg1: !s32i) -> !s32i
- attributes { test_classify = #ignore_first_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_first_arg } {
%0 = cir.call @ext_decl(%arg0, %arg1) : (!s32i, !s32i) -> !s32i
cir.return %0 : !s32i
}
@@ -39,7 +39,7 @@ module attributes {
// "ignore" would drop the argument, but an incomplete one is left alone.
cir.func private @incomplete_decl(!rec_Incomplete)
- attributes { test_classify = #ignore_only_arg }
+ requires_call_conv_lowering attributes { test_classify = #ignore_only_arg }
// CHECK: cir.func private @incomplete_decl(!rec_Incomplete)
diff --git a/clang/test/CIR/Transforms/abi-lowering/direct-flatten.cir b/clang/test/CIR/Transforms/abi-lowering/direct-flatten.cir
index 87bc751ab8e755..53caf8a2291f32 100644
--- a/clang/test/CIR/Transforms/abi-lowering/direct-flatten.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/direct-flatten.cir
@@ -70,7 +70,7 @@ module attributes {
// TwoLong.
cir.func @takes_two_long(%arg0: !rec_TwoLong)
- attributes { test_classify = #flatten_two } {
+ requires_call_conv_lowering attributes { test_classify = #flatten_two } {
%0 = cir.alloca "p" align(8) : !cir.ptr<!rec_TwoLong>
cir.store %arg0, %0 : !rec_TwoLong, !cir.ptr<!rec_TwoLong>
cir.return
@@ -93,7 +93,7 @@ cir.func @takes_two_long(%arg0: !rec_TwoLong)
// Forward declaration: two i64 wire args, no body.
cir.func private @takes_two_long_decl(!rec_TwoLong)
- attributes { test_classify = #flatten_two }
+ requires_call_conv_lowering attributes { test_classify = #flatten_two }
// CHECK: cir.func{{.*}} @takes_two_long_decl(!s64i, !s64i)
// CHECK-NOT: !rec_TwoLong
@@ -102,7 +102,7 @@ cir.func private @takes_two_long_decl(!rec_TwoLong)
// each field is read in place through a coerced-struct view of it with
// get_member + load and passed as a separate call argument.
-cir.func @caller_two_long() attributes { test_classify = #passthrough } {
+cir.func @caller_two_long() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_TwoLong>
%1 = cir.load %0 : !cir.ptr<!rec_TwoLong>, !rec_TwoLong
cir.call @takes_two_long(%1) : (!rec_TwoLong) -> ()
@@ -123,7 +123,7 @@ cir.func @caller_two_long() attributes { test_classify = #passthrough } {
// Covers the numFields == 3 path in insertArgCoercion.
cir.func @takes_three_int(%arg0: !rec_ThreeInt)
- attributes { test_classify = #flatten_three } {
+ requires_call_conv_lowering attributes { test_classify = #flatten_three } {
cir.return
}
@@ -137,7 +137,7 @@ cir.func @takes_three_int(%arg0: !rec_ThreeInt)
// CHECK: %[[PC:.*]] = cir.get_member %{{.*}}[2]
// CHECK: cir.store %[[C]], %[[PC]] : !s32i, !cir.ptr<!s32i>
-cir.func @caller_three_int() attributes { test_classify = #passthrough } {
+cir.func @caller_three_int() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.alloca "s" align(4) : !cir.ptr<!rec_ThreeInt>
%1 = cir.load %0 : !cir.ptr<!rec_ThreeInt>, !rec_ThreeInt
cir.call @takes_three_int(%1) : (!rec_ThreeInt) -> ()
@@ -161,7 +161,7 @@ cir.func @caller_three_int() attributes { test_classify = #passthrough } {
// producing 2 wire arguments from a 3-field source struct.
cir.func @takes_dim3(%arg0: !rec_Dim3)
- attributes { test_classify = #flatten_dim3 } {
+ requires_call_conv_lowering attributes { test_classify = #flatten_dim3 } {
cir.return
}
@@ -173,7 +173,7 @@ cir.func @takes_dim3(%arg0: !rec_Dim3)
// CHECK: %{{.*}} = cir.get_member %{{.*}}[1]
// CHECK: cir.store %[[D1]], %{{.*}} : !s32i
-cir.func @caller_dim3() attributes { test_classify = #passthrough } {
+cir.func @caller_dim3() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.alloca "d" align(4) : !cir.ptr<!rec_Dim3>
%1 = cir.load %0 : !cir.ptr<!rec_Dim3>, !rec_Dim3
cir.call @takes_dim3(%1) : (!rec_Dim3) -> ()
@@ -199,7 +199,7 @@ cir.func @caller_dim3() attributes { test_classify = #passthrough } {
cir.func @flatten_ignore_flatten_callee(
%a: !rec_TwoLong, %b: !rec_TwoLong, %c: !rec_TwoLong)
- attributes { test_classify = #flatten_ignore_flatten } {
+ requires_call_conv_lowering attributes { test_classify = #flatten_ignore_flatten } {
cir.return
}
@@ -215,7 +215,7 @@ cir.func @flatten_ignore_flatten_callee(
// no coerce-slot round-trip.
cir.func @takes_self_flat(%arg0: !rec_coerced_two)
- attributes { test_classify = #flatten_self } {
+ requires_call_conv_lowering attributes { test_classify = #flatten_self } {
%0 = cir.alloca "p" align(8) : !cir.ptr<!rec_coerced_two>
cir.store %arg0, %0 : !rec_coerced_two, !cir.ptr<!rec_coerced_two>
cir.return
@@ -233,7 +233,7 @@ cir.func @takes_self_flat(%arg0: !rec_coerced_two)
// CHECK: %[[P:.*]] = cir.alloca "p"
// CHECK: cir.copy %[[SLOT]] align(8) to %[[P]] align(8) : !cir.ptr<!rec_anon_struct>
-cir.func @caller_self_flat() attributes { test_classify = #passthrough } {
+cir.func @caller_self_flat() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_coerced_two>
%1 = cir.load %0 : !cir.ptr<!rec_coerced_two>, !rec_coerced_two
cir.call @takes_self_flat(%1) : (!rec_coerced_two) -> ()
@@ -255,7 +255,7 @@ cir.func @caller_self_flat() attributes { test_classify = #passthrough } {
// Same origTy == flatTy case, but the operand is a struct value with no source
// alloca (a constant): each field is extracted from the value directly.
-cir.func @caller_self_flat_const() attributes { test_classify = #passthrough } {
+cir.func @caller_self_flat_const() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%v = cir.const #cir.zero : !rec_coerced_two
cir.call @takes_self_flat(%v) : (!rec_coerced_two) -> ()
cir.return
diff --git a/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-injection.cir b/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-injection.cir
index 859398eff7d251..67ad5cc87fbee8 100644
--- a/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-injection.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-injection.cir
@@ -22,7 +22,7 @@ module attributes {
} {
cir.func @passthrough(%arg0: !s32i, %arg1: !s64i) -> !s32i
- attributes { test_classify = #all_direct_two_args } {
+ requires_call_conv_lowering attributes { test_classify = #all_direct_two_args } {
cir.return %arg0 : !s32i
}
@@ -30,7 +30,7 @@ module attributes {
// CHECK: cir.return %arg0 : !s32i
cir.func @caller(%arg0: !s32i, %arg1: !s64i) -> !s32i
- attributes { test_classify = #all_direct_two_args } {
+ requires_call_conv_lowering attributes { test_classify = #all_direct_two_args } {
%0 = cir.call @passthrough(%arg0, %arg1) : (!s32i, !s64i) -> !s32i
cir.return %0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-test-target.cir b/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-test-target.cir
index 7b363cd84f9fd9..53ff86e8a32455 100644
--- a/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-test-target.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/direct-passthrough-test-target.cir
@@ -16,14 +16,14 @@ module attributes {
// Direct (without coercion) is a true pass-through — function signature
// and call sites are unchanged.
- cir.func @passthrough(%arg0: !s32i, %arg1: !s64i) -> !s32i {
+ cir.func @passthrough(%arg0: !s32i, %arg1: !s64i) -> !s32i requires_call_conv_lowering {
cir.return %arg0 : !s32i
}
// CHECK: cir.func{{.*}} @passthrough(%arg0: !s32i, %arg1: !s64i) -> !s32i
// CHECK-NEXT: cir.return %arg0 : !s32i
- cir.func @caller(%arg0: !s32i, %arg1: !s64i) -> !s32i {
+ cir.func @caller(%arg0: !s32i, %arg1: !s64i) -> !s32i requires_call_conv_lowering {
%0 = cir.call @passthrough(%arg0, %arg1) : (!s32i, !s64i) -> !s32i
cir.return %0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/dropped-return-res-attrs.cir b/clang/test/CIR/Transforms/abi-lowering/dropped-return-res-attrs.cir
index 3c9438db7d8b33..c6a241b692741e 100644
--- a/clang/test/CIR/Transforms/abi-lowering/dropped-return-res-attrs.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/dropped-return-res-attrs.cir
@@ -32,7 +32,7 @@ module attributes {
// The llvm.noundef on this return has nowhere to go once the result count
// drops to zero, and a stale res_attrs fails the func verifier.
cir.func @returns_big_res_attr() -> (!rec_Big {llvm.noundef})
- attributes { test_classify = #indirect_return } {
+ requires_call_conv_lowering attributes { test_classify = #indirect_return } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.store %z, %0 : !rec_Big, !cir.ptr<!rec_Big>
@@ -48,12 +48,12 @@ module attributes {
// GENERIC: sym_name = "returns_big_res_attr"
cir.func private @returns_big() -> !rec_Big
- attributes { test_classify = #indirect_return }
+ requires_call_conv_lowering attributes { test_classify = #indirect_return }
// cir.call prints res_attrs through its result list, which is empty once
// the call returns void, so only the generic form catches a stale one.
cir.func @caller_res_attr() -> !s32i
- attributes { test_classify = #caller_cls } {
+ requires_call_conv_lowering attributes { test_classify = #caller_cls } {
%a = cir.alloca "a" align(8) : !cir.ptr<!rec_Big>
%b = cir.alloca "b" align(8) : !cir.ptr<!rec_Big>
%0 = cir.call @returns_big() : () -> (!rec_Big {llvm.noundef})
@@ -71,7 +71,7 @@ module attributes {
// An Ignore return empties the result list without an sret pointer, so it
// reaches the same state by a
diff erent route.
cir.func @ignored_res_attr() -> (!s32i {llvm.noundef})
- attributes { test_classify = #ignore_return } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_return } {
%0 = cir.const #cir.int<0> : !s32i
cir.return %0 : !s32i
}
@@ -82,10 +82,10 @@ module attributes {
// GENERIC: sym_name = "ignored_res_attr"
cir.func private @ignored_ret() -> !s32i
- attributes { test_classify = #ignore_return }
+ requires_call_conv_lowering attributes { test_classify = #ignore_return }
cir.func @caller_ignored_res_attr() -> !s32i
- attributes { test_classify = #caller_cls } {
+ requires_call_conv_lowering attributes { test_classify = #caller_cls } {
%0 = cir.call @ignored_ret() : () -> (!s32i {llvm.noundef})
%z = cir.const #cir.int<0> : !s32i
cir.return %z : !s32i
diff --git a/clang/test/CIR/Transforms/abi-lowering/expand-struct-arg.cir b/clang/test/CIR/Transforms/abi-lowering/expand-struct-arg.cir
index 0c21a5d052ce72..599f9e3b382958 100644
--- a/clang/test/CIR/Transforms/abi-lowering/expand-struct-arg.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/expand-struct-arg.cir
@@ -56,7 +56,7 @@ module attributes {
// is gone and no scratch alloca/reload is introduced.
cir.func @takes_two_long(%arg0: !rec_TwoLong)
- attributes { test_classify = #expand_two } {
+ requires_call_conv_lowering attributes { test_classify = #expand_two } {
%0 = cir.alloca "p" align(8) init : !cir.ptr<!rec_TwoLong>
cir.store %arg0, %0 : !rec_TwoLong, !cir.ptr<!rec_TwoLong>
cir.return
@@ -76,7 +76,7 @@ cir.func @takes_two_long(%arg0: !rec_TwoLong)
// stays; only the original arg store is replaced.
cir.func @returns_expanded(%arg0: !rec_TwoLong) -> !rec_TwoLong
- attributes { test_classify = #expand_two } {
+ requires_call_conv_lowering attributes { test_classify = #expand_two } {
%0 = cir.alloca "s" align(8) init : !cir.ptr<!rec_TwoLong>
cir.store %arg0, %0 : !rec_TwoLong, !cir.ptr<!rec_TwoLong>
%1 = cir.load %0 : !cir.ptr<!rec_TwoLong>, !rec_TwoLong
@@ -96,7 +96,7 @@ cir.func @returns_expanded(%arg0: !rec_TwoLong) -> !rec_TwoLong
// Three-field expansion.
cir.func @takes_three_int(%arg0: !rec_ThreeInt)
- attributes { test_classify = #expand_three } {
+ requires_call_conv_lowering attributes { test_classify = #expand_three } {
%0 = cir.alloca "s" align(4) init : !cir.ptr<!rec_ThreeInt>
cir.store %arg0, %0 : !rec_ThreeInt, !cir.ptr<!rec_ThreeInt>
cir.return
@@ -115,7 +115,7 @@ cir.func @takes_three_int(%arg0: !rec_ThreeInt)
// Forward declaration: signature is flattened, no body to instrument.
cir.func private @takes_two_long_decl(!rec_TwoLong)
- attributes { test_classify = #expand_two }
+ requires_call_conv_lowering attributes { test_classify = #expand_two }
// CHECK-LABEL: cir.func{{.*}} @takes_two_long_decl(!s64i, !s64i)
// CHECK-NOT: !rec_TwoLong
@@ -123,7 +123,7 @@ cir.func private @takes_two_long_decl(!rec_TwoLong)
// Caller whose operand is a load of an alloca: read each member directly
// from that alloca (get_member + load); the whole-struct load is dropped.
-cir.func @caller_two_long() attributes { test_classify = #passthrough } {
+cir.func @caller_two_long() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_TwoLong>
%1 = cir.load %0 : !cir.ptr<!rec_TwoLong>, !rec_TwoLong
cir.call @takes_two_long(%1) : (!rec_TwoLong) -> ()
@@ -143,7 +143,7 @@ cir.func @caller_two_long() attributes { test_classify = #passthrough } {
// the members are read from the address the load used.
cir.func @caller_two_long_through_cast()
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%raw = cir.alloca "raw" align(8) : !cir.ptr<!cir.array<!s8i x 16>>
%s = cir.cast bitcast %raw
: !cir.ptr<!cir.array<!s8i x 16>> -> !cir.ptr<!rec_TwoLong>
@@ -166,7 +166,7 @@ cir.func @caller_two_long_through_cast()
// address space from the address the load used.
cir.func @caller_two_long_addrspace()
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%raw = cir.alloca "raw" align(8) : !cir.ptr<!rec_TwoLong>
%s = cir.cast address_space %raw
: !cir.ptr<!rec_TwoLong> -> !cir.ptr<!rec_TwoLong, target_address_space(5)>
@@ -189,7 +189,7 @@ cir.func @caller_two_long_addrspace()
cir.func @expand_ignore_expand_callee(
%a: !rec_TwoLong, %b: !rec_TwoLong, %c: !rec_TwoLong)
- attributes { test_classify = #expand_ignore_expand } {
+ requires_call_conv_lowering attributes { test_classify = #expand_ignore_expand } {
%0 = cir.alloca "a" align(8) init : !cir.ptr<!rec_TwoLong>
%1 = cir.alloca "c" align(8) init : !cir.ptr<!rec_TwoLong>
cir.store %a, %0 : !rec_TwoLong, !cir.ptr<!rec_TwoLong>
@@ -213,7 +213,7 @@ cir.func @expand_ignore_expand_callee(
// One-field expansion: the single block arg is retyped in place.
cir.func @takes_one_int(%arg0: !rec_OneInt)
- attributes { test_classify = #expand_one } {
+ requires_call_conv_lowering attributes { test_classify = #expand_one } {
%0 = cir.alloca "s" align(4) init : !cir.ptr<!rec_OneInt>
cir.store %arg0, %0 : !rec_OneInt, !cir.ptr<!rec_OneInt>
cir.return
@@ -230,7 +230,7 @@ cir.func @takes_one_int(%arg0: !rec_OneInt)
// store position, so the field-store ordering is deterministic.
cir.func @two_expand_args(%a: !rec_TwoLong, %b: !rec_ThreeInt)
- attributes { test_classify = #expand_expand } {
+ requires_call_conv_lowering attributes { test_classify = #expand_expand } {
%0 = cir.alloca "a" align(8) init : !cir.ptr<!rec_TwoLong>
%1 = cir.alloca "b" align(4) init : !cir.ptr<!rec_ThreeInt>
cir.store %a, %0 : !rec_TwoLong, !cir.ptr<!rec_TwoLong>
@@ -249,7 +249,7 @@ cir.func @two_expand_args(%a: !rec_TwoLong, %b: !rec_ThreeInt)
// Caller with two Expand operands, both loads of allocas.
-cir.func @caller_two_expand() attributes { test_classify = #passthrough } {
+cir.func @caller_two_expand() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.alloca "a" align(8) : !cir.ptr<!rec_TwoLong>
%1 = cir.alloca "b" align(4) : !cir.ptr<!rec_ThreeInt>
%a = cir.load %0 : !cir.ptr<!rec_TwoLong>, !rec_TwoLong
@@ -273,7 +273,7 @@ cir.func @caller_two_expand() attributes { test_classify = #passthrough } {
// Fallback: the operand is not a load of an alloca (here a struct constant),
// so members are taken with cir.extract_member on the value.
-cir.func @caller_const() attributes { test_classify = #passthrough } {
+cir.func @caller_const() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%v = cir.const #cir.zero : !rec_TwoLong
cir.call @takes_two_long(%v) : (!rec_TwoLong) -> ()
cir.return
@@ -289,7 +289,7 @@ cir.func @caller_const() attributes { test_classify = #passthrough } {
// and the Expand arg's two scalar block args follow at slots 1 and 2.
cir.func @sret_and_expand(%arg0: !rec_TwoLong) -> !rec_TwoLong
- attributes { test_classify = #sret_expand } {
+ requires_call_conv_lowering attributes { test_classify = #sret_expand } {
%0 = cir.alloca "s" align(8) init : !cir.ptr<!rec_TwoLong>
cir.store %arg0, %0 : !rec_TwoLong, !cir.ptr<!rec_TwoLong>
%1 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_TwoLong>
@@ -313,7 +313,7 @@ cir.func @sret_and_expand(%arg0: !rec_TwoLong) -> !rec_TwoLong
// still flattened to scalar field args, but no get_member/store is emitted.
cir.func @takes_two_long_unused(%arg0: !rec_TwoLong)
- attributes { test_classify = #expand_two } {
+ requires_call_conv_lowering attributes { test_classify = #expand_two } {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/extend-after-ignore.cir b/clang/test/CIR/Transforms/abi-lowering/extend-after-ignore.cir
index a5a4a9fb9ca1da..1d1ea765c34d86 100644
--- a/clang/test/CIR/Transforms/abi-lowering/extend-after-ignore.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/extend-after-ignore.cir
@@ -23,7 +23,7 @@ module attributes {
} {
cir.func @callee(%arg0: !s32i, %arg1: !s32i, %arg2: !s8i) -> !s32i
- attributes { test_classify = #direct_ignore_extend } {
+ requires_call_conv_lowering attributes { test_classify = #direct_ignore_extend } {
cir.return %arg0 : !s32i
}
@@ -32,7 +32,7 @@ module attributes {
// CHECK-NEXT: cir.return %arg0 : !s32i
cir.func @caller(%arg0: !s32i, %arg1: !s32i, %arg2: !s8i) -> !s32i
- attributes { test_classify = #direct_ignore_extend } {
+ requires_call_conv_lowering attributes { test_classify = #direct_ignore_extend } {
%0 = cir.call @callee(%arg0, %arg1, %arg2) : (!s32i, !s32i, !s8i) -> !s32i
cir.return %0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/extend-return.cir b/clang/test/CIR/Transforms/abi-lowering/extend-return.cir
index 1d07ec14688094..9fdc28f6701b4f 100644
--- a/clang/test/CIR/Transforms/abi-lowering/extend-return.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/extend-return.cir
@@ -17,7 +17,7 @@ module attributes {
} {
cir.func @returns_s8() -> !s8i
- attributes { test_classify = #extend_signed_return } {
+ requires_call_conv_lowering attributes { test_classify = #extend_signed_return } {
%0 = cir.const #cir.int<7> : !s8i
cir.return %0 : !s8i
}
@@ -26,7 +26,7 @@ module attributes {
// CHECK: cir.return %{{.*}} : !s8i
cir.func @caller() -> !s8i
- attributes { test_classify = #extend_signed_return } {
+ requires_call_conv_lowering attributes { test_classify = #extend_signed_return } {
%0 = cir.call @returns_s8() : () -> !s8i
cir.return %0 : !s8i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/extend-signed-arg.cir b/clang/test/CIR/Transforms/abi-lowering/extend-signed-arg.cir
index b7d9e15d496a28..8b583e0d969e1e 100644
--- a/clang/test/CIR/Transforms/abi-lowering/extend-signed-arg.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/extend-signed-arg.cir
@@ -21,14 +21,14 @@ module attributes {
} {
cir.func @takes_s8(%arg0: !s8i)
- attributes { test_classify = #extend_signed_arg } {
+ requires_call_conv_lowering attributes { test_classify = #extend_signed_arg } {
cir.return
}
// CHECK: cir.func{{.*}} @takes_s8(%arg0: !s8i {llvm.noundef, llvm.signext})
cir.func @caller(%arg0: !s8i)
- attributes { test_classify = #extend_signed_arg } {
+ requires_call_conv_lowering attributes { test_classify = #extend_signed_arg } {
cir.call @takes_s8(%arg0) : (!s8i) -> ()
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/extend-unsigned-arg.cir b/clang/test/CIR/Transforms/abi-lowering/extend-unsigned-arg.cir
index 168d77bdf10c02..bb885e50b91efc 100644
--- a/clang/test/CIR/Transforms/abi-lowering/extend-unsigned-arg.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/extend-unsigned-arg.cir
@@ -17,14 +17,14 @@ module attributes {
} {
cir.func @takes_u16(%arg0: !u16i)
- attributes { test_classify = #extend_unsigned_arg } {
+ requires_call_conv_lowering attributes { test_classify = #extend_unsigned_arg } {
cir.return
}
// CHECK: cir.func{{.*}} @takes_u16(%arg0: !u16i {llvm.noundef, llvm.zeroext})
cir.func @caller(%arg0: !u16i)
- attributes { test_classify = #extend_unsigned_arg } {
+ requires_call_conv_lowering attributes { test_classify = #extend_unsigned_arg } {
cir.call @takes_u16(%arg0) : (!u16i) -> ()
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/ignore-arg.cir b/clang/test/CIR/Transforms/abi-lowering/ignore-arg.cir
index ef698b0ee6039a..9e5e5520574cfc 100644
--- a/clang/test/CIR/Transforms/abi-lowering/ignore-arg.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/ignore-arg.cir
@@ -18,7 +18,7 @@ module attributes {
} {
cir.func @callee(%arg0: !s32i, %arg1: !s32i) -> !s32i
- attributes { test_classify = #ignore_first_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_first_arg } {
cir.return %arg1 : !s32i
}
@@ -27,7 +27,7 @@ module attributes {
// CHECK-NEXT: cir.return %arg0 : !s32i
cir.func @caller(%arg0: !s32i, %arg1: !s32i) -> !s32i
- attributes { test_classify = #ignore_first_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_first_arg } {
%0 = cir.call @callee(%arg0, %arg1) : (!s32i, !s32i) -> !s32i
cir.return %0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/ignore-return.cir b/clang/test/CIR/Transforms/abi-lowering/ignore-return.cir
index 169d24fddcffc8..f13196224d20db 100644
--- a/clang/test/CIR/Transforms/abi-lowering/ignore-return.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/ignore-return.cir
@@ -20,7 +20,7 @@ module attributes {
} {
cir.func @callee() -> !s32i
- attributes { test_classify = #ignore_return } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_return } {
%0 = cir.const #cir.int<42> : !s32i
cir.return %0 : !s32i
}
@@ -33,7 +33,7 @@ module attributes {
// CHECK-NOT: : !s32i
cir.func @caller_uses_result() -> !s32i
- attributes { test_classify = #ignore_return } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_return } {
%0 = cir.call @callee() : () -> !s32i
cir.return %0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased-nyi.cir
index ddab1815735524..e99e37e94c4326 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased-nyi.cir
@@ -15,7 +15,7 @@ module attributes {
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @ret_big() -> !rec_Big
+ cir.func private @ret_big() -> !rec_Big requires_call_conv_lowering
attributes { test_classify = #byref_return }
// CHECK: error: 'cir.func' op IndirectAliased return is not supported
@@ -44,12 +44,12 @@ module attributes {
#dlti.dl_entry<"dlti.alloca_memory_space", 5 : ui64>>
} {
- cir.func private @takes_big_as4(%arg0: !rec_Big)
+ cir.func private @takes_big_as4(%arg0: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #byref_as4 }
// A slot for the copy would be an alloca, which cannot live in address
// space 4.
- cir.func @caller_as4_no_storage(%novalue: !rec_Big)
+ cir.func @caller_as4_no_storage(%novalue: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #passthrough } {
cir.call @takes_big_as4(%novalue) : (!rec_Big) -> ()
cir.return
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir
index 5568b42c87b74a..49fab72ee123f6 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir
@@ -34,7 +34,7 @@ module attributes {
// The callee must not write through a byref pointer, so the CIRGen slot is
// filled by a copy across address spaces.
- cir.func @kernel_field(%arg0: !rec_Big) -> !s64i
+ cir.func @kernel_field(%arg0: !rec_Big) -> !s64i requires_call_conv_lowering
attributes { test_classify = #byref_as4 } {
%0 = cir.alloca "arg0" align(8) init
: !cir.ptr<!rec_Big, target_address_space(5)>
@@ -55,7 +55,7 @@ module attributes {
// CHECK: cir.get_member %[[SLOT]][0]
// A parameter the body never reads gets nothing at entry.
- cir.func @kernel_unused(%arg0: !rec_Big) -> !s32i
+ cir.func @kernel_unused(%arg0: !rec_Big) -> !s32i requires_call_conv_lowering
attributes { test_classify = #byref_as4 } {
%r = cir.const #cir.int<0> : !s32i
cir.return %r : !s32i
@@ -66,7 +66,7 @@ module attributes {
// CHECK-NEXT: %{{.*}} = cir.const #cir.int<0> : !s32i
// A body that reads the value with no spill loads it at entry.
- cir.func @kernel_uses_arg(%arg0: !rec_Big) -> !rec_Big
+ cir.func @kernel_uses_arg(%arg0: !rec_Big) -> !rec_Big requires_call_conv_lowering
attributes { test_classify = #byref_as4 } {
cir.return %arg0 : !rec_Big
}
@@ -76,20 +76,20 @@ module attributes {
// CHECK-NEXT: cir.return %[[V]] : !rec_Big
// A byref pointer drops llvm.nofpclass, which only describes FP values.
- cir.func private @kernel_nofpclass(%arg0: !rec_Big {llvm.nofpclass = 3 : i64})
+ cir.func private @kernel_nofpclass(%arg0: !rec_Big {llvm.nofpclass = 3 : i64}) requires_call_conv_lowering
attributes { test_classify = #byref_as4 }
// CHECK: cir.func private @kernel_nofpclass(!cir.ptr<!rec_Big, target_address_space(4)>
// CHECK-SAME: {llvm.align = 8 : i64, llvm.byref = !rec_Big, llvm.noundef})
- cir.func private @takes_big_as5(%arg0: !rec_Big)
+ cir.func private @takes_big_as5(%arg0: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #byref_as5 }
// CHECK: cir.func{{.*}} @takes_big_as5(!cir.ptr<!rec_Big, target_address_space(5)>
// CHECK-SAME: {llvm.align = 8 : i64, llvm.byref = !rec_Big, llvm.noundef})
// Storage in the parameter's own address space is handed on.
- cir.func @caller_forward(%s: !rec_Big)
+ cir.func @caller_forward(%s: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8)
: !cir.ptr<!rec_Big, target_address_space(5)>
@@ -108,7 +108,7 @@ module attributes {
// An operand that names no storage is stored into a slot in the alloca
// address space.
- cir.func @caller_no_storage(%s: !rec_Big)
+ cir.func @caller_no_storage(%s: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #passthrough } {
cir.call @takes_big_as5(%s) : (!rec_Big) -> ()
cir.return
@@ -121,7 +121,7 @@ module attributes {
// A store between the load and the call stops the storage from being handed
// on, so the copy is taken where the load was.
- cir.func @caller_store_between(%s: !rec_Big, %t: !rec_Big)
+ cir.func @caller_store_between(%s: !rec_Big, %t: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8)
: !cir.ptr<!rec_Big, target_address_space(5)>
@@ -164,13 +164,13 @@ module attributes {
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @takes_big(%arg0: !rec_Big)
+ cir.func private @takes_big(%arg0: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #byref_as0 }
// CHECK: cir.func{{.*}} @takes_big(!cir.ptr<!rec_Big>
// CHECK-SAME: {llvm.align = 8 : i64, llvm.byref = !rec_Big, llvm.noundef})
- cir.func @caller_forward(%s: !rec_Big)
+ cir.func @caller_forward(%s: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
@@ -185,7 +185,7 @@ module attributes {
// CHECK: cir.call @takes_big(%[[TMP]]) : (!cir.ptr<!rec_Big>
// Storage aligned below what the callee expects gets a slot of its own.
- cir.func @caller_underaligned(%s: !rec_Big)
+ cir.func @caller_underaligned(%s: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(1) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
@@ -224,7 +224,7 @@ module attributes {
long_double_size = 0, enable_noundef_attrs = false>
} {
- cir.func private @takes_big_no_noundef(%arg0: !rec_Big)
+ cir.func private @takes_big_no_noundef(%arg0: !rec_Big) requires_call_conv_lowering
attributes { test_classify = #byref }
// CHECK: cir.func private @takes_big_no_noundef(!cir.ptr<!rec_Big>
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-byval.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-byval.cir
index 4f14515eae926e..4976580cc8fc07 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-byval.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-byval.cir
@@ -88,7 +88,7 @@ module attributes {
// A byval parameter the body never reads gets nothing at entry.
cir.func @takes_big(%arg0: !rec_Big) -> !s32i
- attributes { test_classify = #byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #byval_arg } {
%r = cir.const #cir.int<0> : !s32i
cir.return %r : !s32i
}
@@ -100,7 +100,7 @@ module attributes {
// byval composes with an Extend return.
cir.func @takes_big_ext(%arg0: !rec_Big) -> !s32i
- attributes { test_classify = #byval_arg_ext_return } {
+ requires_call_conv_lowering attributes { test_classify = #byval_arg_ext_return } {
%r = cir.const #cir.int<0> : !s32i
cir.return %r : !s32i
}
@@ -112,7 +112,7 @@ module attributes {
// byval composes with an Ignored second argument: the ignored arg is dropped
// from the signature and the byval slot is the only argument.
cir.func @takes_big_ignore(%arg0: !rec_Big, %arg1: !s32i) -> !s32i
- attributes { test_classify = #byval_ignore_arg } {
+ requires_call_conv_lowering attributes { test_classify = #byval_ignore_arg } {
%r = cir.const #cir.int<0> : !s32i
cir.return %r : !s32i
}
@@ -124,14 +124,14 @@ module attributes {
// A forward declaration: signature is rewritten but no body to touch.
cir.func private @takes_big_decl(%arg0: !rec_Big) -> !s32i
- attributes { test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg }
// CHECK: cir.func{{.*}} @takes_big_decl(!cir.ptr<!rec_Big>
// CHECK-SAME: llvm.byval = !rec_Big, llvm.noundef
// An operand that names no storage is stored into a fresh alloca.
cir.func @caller(%s: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%r = cir.call @takes_big(%s) : (!rec_Big) -> !s32i
cir.return %r : !s32i
}
@@ -145,7 +145,7 @@ module attributes {
// An operand loaded from a sufficiently aligned alloca is forwarded: byval
// is copied at the call boundary, so the callee still works on a copy.
cir.func @caller_byval_forward(%s: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -166,7 +166,7 @@ module attributes {
// copy filling it reads at the alignment the load stated, not the one the
// slot promises.
cir.func @caller_byval_underaligned(%s: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(1) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load align(1) %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -185,7 +185,7 @@ module attributes {
// load was rather than at the call: a store in between must not be what it
// reads.
cir.func @caller_byval_copy_store_between(%s: !rec_Big, %t: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(1) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load align(1) %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -209,7 +209,7 @@ module attributes {
// load was instead, so the callee sees the loaded value and not the stored
// one.
cir.func @caller_byval_store_between(%s: !rec_Big, %t: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -231,7 +231,7 @@ module attributes {
// A store into a member of another local between the load and the call
// cannot reach the operand's storage, so that storage is still handed on.
cir.func @caller_byval_member_store_between(%s: !rec_Big, %x: !s64i) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
%other = cir.alloca "other" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
@@ -254,7 +254,7 @@ module attributes {
// A store through a pointer parameter cannot reach storage allocated in this
// function, so that storage is still handed on.
cir.func @caller_byval_param_ptr_store_between(%s: !rec_Big, %t: !rec_Big, %p: !cir.ptr<!rec_Big>) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -274,7 +274,7 @@ module attributes {
// cannot reach the bytes the byval copy takes, so the load's address is still
// handed on.
cir.func @caller_byval_disjoint_store_between(%s: !rec_Big, %x: !s64i) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%o = cir.alloca "outer" align(8) : !cir.ptr<!rec_Outer>
%bp = cir.cast bitcast %o : !cir.ptr<!rec_Outer> -> !cir.ptr<!rec_Big>
cir.store %s, %bp : !rec_Big, !cir.ptr<!rec_Big>
@@ -297,7 +297,7 @@ module attributes {
// A constrained floating-point operation writes only the floating-point
// environment, which no pointer reaches, so the storage is still handed on.
cir.func @caller_byval_fenv_between(%s: !rec_Big, %a: !cir.float, %b: !cir.float) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -316,7 +316,7 @@ module attributes {
// A store into a member of the operand's own storage does reach it, so the
// copy is taken where the load was.
cir.func @caller_byval_own_member_store_between(%s: !rec_Big, %x: !s64i) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -339,7 +339,7 @@ module attributes {
// Inline asm that writes the operand's storage through a memory output keeps
// that storage from being handed on.
cir.func @caller_byval_asm_between(%s: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -365,7 +365,7 @@ module attributes {
// An op that holds regions is taken to write the operand's storage without
// its body being examined, even when that body has no memory effects.
cir.func @caller_byval_scope_between(%s: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -388,7 +388,7 @@ module attributes {
// An OpenACC compute construct whose body writes the operand's storage keeps
// that storage from being handed on.
cir.func @caller_byval_acc_between(%s: !rec_Big, %t: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -413,7 +413,7 @@ module attributes {
// A cir.array.ctor whose body writes the operand's storage keeps that storage
// from being handed on.
cir.func @caller_byval_array_ctor_between(%s: !rec_Big, %t: !rec_Big) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
%arr = cir.alloca "arr" align(4) : !cir.ptr<!cir.array<!rec_E x 2>>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
@@ -441,7 +441,7 @@ module attributes {
// A body that actually uses the byval arg value: the existing use in
// cir.return is rerouted through the load inserted at entry.
cir.func @takes_big_uses_arg(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #byval_arg } {
cir.return %arg0 : !rec_Big
}
@@ -454,7 +454,7 @@ module attributes {
// alloca at the call site, and both block args are changed to pointers.
// Only the second is read, so only it gets a load at the callee entry.
cir.func @two_byval(%a: !rec_Big, %b: !rec_Big) -> !rec_Big
- attributes { test_classify = #two_byval } {
+ requires_call_conv_lowering attributes { test_classify = #two_byval } {
cir.return %b : !rec_Big
}
@@ -469,7 +469,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[LOADED]] : !rec_Big
cir.func @caller_two(%s: !rec_Big, %t: !rec_Big) -> !rec_Big
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%r = cir.call @two_byval(%s, %t) : (!rec_Big, !rec_Big) -> !rec_Big
cir.return %r : !rec_Big
}
@@ -487,7 +487,7 @@ module attributes {
// sret return + byval arg: the sret pointer is prepended at slot 0 and the
// byval arg shifts to slot 1 (sretOffset = 1).
cir.func @byval_and_sret(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #sret_byval } {
+ requires_call_conv_lowering attributes { test_classify = #sret_byval } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.store %z, %0 : !rec_Big, !cir.ptr<!rec_Big>
@@ -507,7 +507,7 @@ module attributes {
// storage on, and the byval attributes still land on the argument slot the
// sret pointer displaced.
cir.func @caller_byval_and_sret(%s: !rec_Big) -> !rec_Big
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -529,7 +529,7 @@ module attributes {
// The rewriter rewires that alloca to the incoming pointer, with no entry
// load or byte-copy.
cir.func @takes_big_non_byval(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%0 = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %0 : !rec_Big, !cir.ptr<!rec_Big>
%1 = cir.load %0 : !cir.ptr<!rec_Big>, !rec_Big
@@ -544,7 +544,7 @@ module attributes {
// Field access must read through the incoming pointer, not a copy.
cir.func @takes_big_non_byval_field(%arg0: !rec_Big) -> !s64i
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%0 = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %0 : !rec_Big, !cir.ptr<!rec_Big>
%1 = cir.get_member %0[0] {name = "a"} : !cir.ptr<!rec_Big> -> !cir.ptr<!s64i>
@@ -562,7 +562,7 @@ module attributes {
// byval with the same CIRGen spill keeps a local copy: load the byval
// pointer at entry and store into the param-slot alloca.
cir.func @takes_big_byval_field(%arg0: !rec_Big) -> !s64i
- attributes { test_classify = #byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #byval_arg } {
%0 = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %0 : !rec_Big, !cir.ptr<!rec_Big>
%1 = cir.get_member %0[0] {name = "a"} : !cir.ptr<!rec_Big> -> !cir.ptr<!s64i>
@@ -580,7 +580,7 @@ module attributes {
// The param spill may already be gone, for instance to DCE.
cir.func @takes_big_non_byval_unused(%arg0: !rec_Big) -> !s32i
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%r = cir.const #cir.int<0> : !s32i
cir.return %r : !s32i
}
@@ -594,14 +594,14 @@ module attributes {
// A declaration gets the attributes too, with no body to rewrite.
cir.func private @takes_big_non_byval_decl(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// CHECK: cir.func{{.*}} @takes_big_non_byval_decl(!cir.ptr<!rec_Big>
// CHECK-SAME: {llvm.align = 8 : i64, llvm.dead_on_return = -1 : i64, llvm.dereferenceable = 32 : i64, llvm.nofreeobj, llvm.noundef})
// The call site forwards the caller's temporary instead of copying it.
cir.func @caller_non_byval(%s: !rec_Big) -> !rec_Big
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -618,7 +618,7 @@ module attributes {
// The whole-record load survives when a reader other than the call needs it.
cir.func @caller_non_byval_load_reused(%s: !rec_Big) -> !rec_Big
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -638,7 +638,7 @@ module attributes {
// stored value, since a non-byval argument passes the object rather than
// the loaded snapshot.
cir.func @caller_non_byval_store_between(%s: !rec_Big, %t: !rec_Big) -> !rec_Big
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -657,10 +657,10 @@ module attributes {
// A non-byval argument between two Direct ones keeps its operand slot.
cir.func private @takes_mixed_non_byval(%a: !s32i, %b: !rec_Big, %c: !s32i)
- attributes { test_classify = #mixed_non_byval }
+ requires_call_conv_lowering attributes { test_classify = #mixed_non_byval }
cir.func @caller_mixed_non_byval(%x: !s32i, %s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -675,10 +675,10 @@ module attributes {
// One load feeding two non-byval operands is erased once, not twice.
cir.func private @takes_two_non_byval(%a: !rec_Big, %b: !rec_Big)
- attributes { test_classify = #two_non_byval_args }
+ requires_call_conv_lowering attributes { test_classify = #two_non_byval_args }
cir.func @caller_two_non_byval_one_load(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -695,10 +695,10 @@ module attributes {
// The Direct operand keeps reading the load, so the load survives the rewrite.
cir.func private @takes_non_byval_then_direct(%a: !rec_Big, %b: !rec_Big)
- attributes { test_classify = #non_byval_then_direct }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_then_direct }
cir.func @caller_non_byval_then_direct(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -714,7 +714,7 @@ module attributes {
// The dead load is erased on the sret early-return path too.
cir.func @non_byval_and_sret(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #sret_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #sret_non_byval } {
%0 = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %0 : !rec_Big, !cir.ptr<!rec_Big>
%1 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
@@ -725,7 +725,7 @@ module attributes {
}
cir.func @caller_non_byval_and_sret(%s: !rec_Big) -> !rec_Big
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -745,10 +745,10 @@ module attributes {
// A slot aligned above the record's own alignment, matching an
// indirect_align that also exceeds it, is still forwarded.
cir.func private @takes_big_non_byval16(%a: !rec_Big)
- attributes { test_classify = #non_byval_arg_align16 }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg_align16 }
cir.func @caller_non_byval_overaligned(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(16) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -765,7 +765,7 @@ module attributes {
// A non-byval parameter's slot stands in for the incoming pointer until
// finalizeParameterSlots, so the call ends up naming that pointer.
cir.func @fwd_non_byval_param(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%0 = cir.alloca "x" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %0 : !rec_Big, !cir.ptr<!rec_Big>
%1 = cir.load %0 : !cir.ptr<!rec_Big>, !rec_Big
@@ -783,10 +783,10 @@ module attributes {
// The storage is aligned below what the callee requires, so it cannot be
// handed on and a slot that does promise the alignment is filled.
cir.func private @takes_big_align16(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg_align16 }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg_align16 }
cir.func @fwd_underaligned_param(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #byval_arg } {
%0 = cir.alloca "x" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %0 : !rec_Big, !cir.ptr<!rec_Big>
%1 = cir.load %0 : !cir.ptr<!rec_Big>, !rec_Big
@@ -806,7 +806,7 @@ module attributes {
// parameter is a pointer in the default address space, so the operand
// cannot be handed on and a slot of its own is filled instead.
cir.func @caller_byval_through_addrspace(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%raw = cir.alloca "raw" align(8) : !cir.ptr<!rec_Big>
%slot = cir.cast address_space %raw
: !cir.ptr<!rec_Big> -> !cir.ptr<!rec_Big, target_address_space(5)>
@@ -831,7 +831,7 @@ module attributes {
// of its own at the call boundary, so the two arguments sharing an address
// is not something the callee can observe.
cir.func @caller_two_from_one_load(%s: !rec_Big) -> !rec_Big
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-call-classification-attr.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-call-classification-attr.cir
index 2dca87f1677680..2976eb79cae06b 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-call-classification-attr.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-call-classification-attr.cir
@@ -17,7 +17,7 @@ module attributes {
// error in this driver mode rather than being left silently unrewritten.
cir.func @caller(%fp: !cir.ptr<!cir.func<(!s32i, !s32i) -> !s32i>>,
%arg0: !s32i, %arg1: !s32i) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.call %fp(%arg0, %arg1)
: (!cir.ptr<!cir.func<(!s32i, !s32i) -> !s32i>>, !s32i, !s32i) -> !s32i
cir.return %0 : !s32i
@@ -47,7 +47,7 @@ module attributes {
// cannot describe a callee resolved at run time either way.
cir.func @variadic_try_caller(%fp: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
%fmt: !cir.ptr<!s8i>, %n: !s32i) -> !s32i
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.try_call %fp(%fmt, %n) ^bb1, ^bb2
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !s32i) -> !s32i
^bb1:
@@ -85,7 +85,7 @@ module attributes {
} {
cir.func @try_caller(%fp: !cir.ptr<!cir.func<(!s32i) -> !s32i>>, %n: !s32i)
- -> !s32i attributes { test_classify = #passthrough } {
+ -> !s32i requires_call_conv_lowering attributes { test_classify = #passthrough } {
%0 = cir.try_call %fp(%n) ^bb1, ^bb2
: (!cir.ptr<!cir.func<(!s32i) -> !s32i>>, !s32i) -> !s32i
^bb1:
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-call-test-target.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-call-test-target.cir
index ab71eac35a9e0a..07a75585fd3fe6 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-call-test-target.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-call-test-target.cir
@@ -12,7 +12,7 @@ module attributes {
// Scalar indirect call under the test target: the callee's pointee FuncType
// classifies to Direct passthrough, so signature and call site are unchanged.
- cir.func @call_scalar(%fp: !cir.ptr<!cir.func<(!s32i) -> !s32i>>, %x: !s32i) -> !s32i {
+ cir.func @call_scalar(%fp: !cir.ptr<!cir.func<(!s32i) -> !s32i>>, %x: !s32i) -> !s32i requires_call_conv_lowering {
%0 = cir.call %fp(%x) : (!cir.ptr<!cir.func<(!s32i) -> !s32i>>, !s32i) -> !s32i
cir.return %0 : !s32i
}
@@ -24,7 +24,7 @@ module attributes {
// Indirect call whose struct argument classifies to Indirect (byval) under
// the test target: the argument spills to a stack slot and the callee
// pointer is bitcast to the coerced signature before the call.
- cir.func @call_byval(%fp: !cir.ptr<!cir.func<(!rec_Big) -> !s64i>>, %b: !rec_Big) -> !s64i {
+ cir.func @call_byval(%fp: !cir.ptr<!cir.func<(!rec_Big) -> !s64i>>, %b: !rec_Big) -> !s64i requires_call_conv_lowering {
%0 = cir.call %fp(%b) : (!cir.ptr<!cir.func<(!rec_Big) -> !s64i>>, !rec_Big) -> !s64i
cir.return %0 : !s64i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-call.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-call.cir
index f3f5c7a89f39e4..130b9ecf331070 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-call.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-call.cir
@@ -17,7 +17,7 @@ module attributes {
// Scalar indirect call: no ABI reshaping, so it passes through unchanged
// (and is no longer rejected as NYI).
cir.func @call_scalar(%fp: !cir.ptr<!cir.func<(!s32i) -> !s32i>>,
- %arg0: !s32i) -> !s32i {
+ %arg0: !s32i) -> !s32i requires_call_conv_lowering {
%0 = cir.call %fp(%arg0)
: (!cir.ptr<!cir.func<(!s32i) -> !s32i>>, !s32i) -> !s32i
cir.return %0 : !s32i
@@ -30,7 +30,7 @@ module attributes {
// attribute is applied at the call site and the callee pointer keeps its
// signature (Extend does not change the value type, so no bitcast).
cir.func @call_ext(%fp: !cir.ptr<!cir.func<(!s16i) -> !s16i>>,
- %arg0: !s16i) -> !s16i {
+ %arg0: !s16i) -> !s16i requires_call_conv_lowering {
%0 = cir.call %fp(%arg0)
: (!cir.ptr<!cir.func<(!s16i) -> !s16i>>, !s16i) -> !s16i
cir.return %0 : !s16i
@@ -44,7 +44,7 @@ module attributes {
// coerce type: the callee pointer is bitcast so its pointee tracks both the
// coerced parameter and the coerced result.
cir.func @call_coerce(%fp: !cir.ptr<!cir.func<(!rec_Pair) -> !rec_Pair>>,
- %out: !cir.ptr<!rec_Pair>) {
+ %out: !cir.ptr<!rec_Pair>) requires_call_conv_lowering {
%0 = cir.alloca "p" align(4) : !cir.ptr<!rec_Pair>
%1 = cir.load %0 : !cir.ptr<!rec_Pair>, !rec_Pair
%2 = cir.call %fp(%1)
@@ -61,7 +61,7 @@ module attributes {
// Indirect call with an Ignore-classified empty-record argument: the operand
// is dropped and the callee pointer loses that parameter.
cir.func @call_ignore(%fp: !cir.ptr<!cir.func<(!rec_Empty, !s32i) -> !s32i>>,
- %x: !s32i) -> !s32i {
+ %x: !s32i) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "e" align(1) : !cir.ptr<!rec_Empty>
%1 = cir.load %0 : !cir.ptr<!rec_Empty>, !rec_Empty
%2 = cir.call %fp(%1, %x)
@@ -78,7 +78,7 @@ module attributes {
// the call boundary, so the argument's own storage is handed on, and the
// callee pointer is bitcast to the coerced signature before the call is
// rebuilt.
- cir.func @call_byval(%fp: !cir.ptr<!cir.func<(!rec_Big) -> !s64i>>) -> !s64i {
+ cir.func @call_byval(%fp: !cir.ptr<!cir.func<(!rec_Big) -> !s64i>>) -> !s64i requires_call_conv_lowering {
%0 = cir.alloca "b" align(8) : !cir.ptr<!rec_Big>
%1 = cir.load %0 : !cir.ptr<!rec_Big>, !rec_Big
%2 = cir.call %fp(%1)
@@ -94,7 +94,7 @@ module attributes {
// Indirect call returning a large struct: an sret pointer slot is prepended
// and the callee is bitcast to the void-returning sret signature.
- cir.func @call_sret(%fp: !cir.ptr<!cir.func<() -> !rec_Big>>) {
+ cir.func @call_sret(%fp: !cir.ptr<!cir.func<() -> !rec_Big>>) requires_call_conv_lowering {
%0 = cir.call %fp() : (!cir.ptr<!cir.func<() -> !rec_Big>>) -> !rec_Big
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-forward-param.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-forward-param.cir
index af3c0655e5805f..f82fb321dce29e 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-forward-param.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-forward-param.cir
@@ -21,7 +21,7 @@ module attributes {
// already been rewritten, and its slot already queued for collapsing, by the
// time the call is reached.
cir.func @forwards_non_byval_param(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -37,7 +37,7 @@ module attributes {
// CHECK-SAME: (!cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.dead_on_return = -1 : i64, llvm.dereferenceable = 32 : i64, llvm.nofreeobj, llvm.noundef}) -> ()
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -60,10 +60,10 @@ module attributes {
// own definition is rewritten and the slot is still untouched. The callee
// receives the caller's storage either way.
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
cir.func @forwards_non_byval_param_via_slot(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -97,7 +97,7 @@ module attributes {
// Mutual recursion puts each function on both sides of the other, so both
// orders above occur in one module.
- cir.func @ping(%arg0: !rec_Big) attributes { test_classify = #non_byval_arg } {
+ cir.func @ping(%arg0: !rec_Big) requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -105,7 +105,7 @@ module attributes {
cir.return
}
- cir.func @pong(%arg0: !rec_Big) attributes { test_classify = #non_byval_arg } {
+ cir.func @pong(%arg0: !rec_Big) requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -154,7 +154,7 @@ module attributes {
// so that parameter sits at a
diff erent index than it was declared at.
// The attributes have to follow it there for the forward to be recognized.
cir.func @expand_ahead_of_non_byval(%two: !rec_Two, %big: !rec_Big)
- attributes { test_classify = #expand_then_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #expand_then_non_byval } {
%spill = cir.alloca "big" align(8) init : !cir.ptr<!rec_Big>
cir.store %big, %spill : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -169,7 +169,7 @@ module attributes {
// CHECK-SAME: (!cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.dead_on_return = -1 : i64, llvm.dereferenceable = 32 : i64, llvm.nofreeobj, llvm.noundef}) -> ()
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -195,13 +195,13 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// A slot reached through casts that preserve the storage. The slot states
// the alignment, so it is found underneath the chain, while the outermost
// cast is what gets forwarded.
cir.func @forwards_slot_through_cast(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%raw = cir.alloca "raw" align(8) : !cir.ptr<!cir.array<!s8i x 32>>
%mid = cir.cast bitcast %raw
: !cir.ptr<!cir.array<!s8i x 32>> -> !cir.ptr<!s8i>
@@ -244,7 +244,7 @@ module attributes {
// The sret pointer takes block argument 0, so the forwarded parameter sits
// one past where it was declared.
cir.func @sret_forwards_non_byval_param(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #sret_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #sret_non_byval } {
%spill = cir.alloca "arg0" align(8) : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -265,7 +265,7 @@ module attributes {
// CHECK-SAME: (!cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.dead_on_return = -1 : i64, llvm.dereferenceable = 32 : i64, llvm.nofreeobj, llvm.noundef}) -> ()
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -289,10 +289,10 @@ module attributes {
// parameter's, so it holds here regardless of which of the two was declared
// first.
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
cir.func @forwards_param_over_underaligned_slot(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(4) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%v = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -327,7 +327,7 @@ module attributes {
// Two parameters in one function, forwarded in the opposite order, so a slot
// paired with the wrong incoming pointer would swap the operands.
cir.func @forwards_two_non_byval_params(%x: !rec_Big, %y: !rec_Big)
- attributes { test_classify = #two_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #two_non_byval } {
%sx = cir.alloca "x" align(8) init : !cir.ptr<!rec_Big>
%sy = cir.alloca "y" align(8) init : !cir.ptr<!rec_Big>
cir.store %x, %sx : !rec_Big, !cir.ptr<!rec_Big>
@@ -344,7 +344,7 @@ module attributes {
// CHECK: cir.call @sink_two(%[[Y]], %[[X]]) :
cir.func private @sink_two(%a: !rec_Big, %b: !rec_Big)
- attributes { test_classify = #two_non_byval }
+ requires_call_conv_lowering attributes { test_classify = #two_non_byval }
}
@@ -372,10 +372,10 @@ module attributes {
// the caller's storage with cir.get_member rather than extracted from a
// whole-record value.
cir.func private @takes_two_expanded(%arg0: !rec_Two)
- attributes { test_classify = #expand_two }
+ requires_call_conv_lowering attributes { test_classify = #expand_two }
cir.func @expands_non_byval_param(%arg0: !rec_Two)
- attributes { test_classify = #non_byval_two } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_two } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Two>
cir.store %arg0, %spill : !rec_Two, !cir.ptr<!rec_Two>
%v = cir.load %spill : !cir.ptr<!rec_Two>, !rec_Two
@@ -412,7 +412,7 @@ module attributes {
// The parameter is handed on directly, with no load of its slot, which is
// what cir-simplify leaves at -O1 and above for a slot marked const.
cir.func @forwards_unloaded_param(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.call @takes_big_non_byval(%arg0) : (!rec_Big) -> ()
@@ -427,7 +427,7 @@ module attributes {
// CHECK-SAME: (!cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.dead_on_return = -1 : i64, llvm.dereferenceable = 32 : i64, llvm.nofreeobj, llvm.noundef}) -> ()
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -450,10 +450,10 @@ module attributes {
// the caller's own definition is rewritten, and over a slot aligned for a
// local copy rather than for the parameter.
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
cir.func @forwards_unloaded_param_early_call(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(4) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.call @takes_big_non_byval(%arg0) : (!rec_Big) -> ()
@@ -491,10 +491,10 @@ module attributes {
// The unloaded parameter feeding an Expand callee.
cir.func private @takes_two_expand(%arg0: !rec_Two)
- attributes { test_classify = #expand_two }
+ requires_call_conv_lowering attributes { test_classify = #expand_two }
cir.func @unloaded_param_to_expand(%arg0: !rec_Two)
- attributes { test_classify = #non_byval_two } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_two } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Two>
cir.store %arg0, %spill : !rec_Two, !cir.ptr<!rec_Two>
cir.call @takes_two_expand(%arg0) : (!rec_Two) -> ()
@@ -534,10 +534,10 @@ module attributes {
// A byval callee gets its own copy, read out of the caller's storage.
cir.func private @takes_big_byval(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg }
cir.func @unloaded_param_to_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.call @takes_big_byval(%arg0) : (!rec_Big) -> ()
@@ -576,10 +576,10 @@ module attributes {
// A Direct argument with a coerced type reads the record into a register,
// out of the caller's storage.
cir.func private @takes_two_coerced(%arg0: !rec_Two)
- attributes { test_classify = #coerced_two }
+ requires_call_conv_lowering attributes { test_classify = #coerced_two }
cir.func @unloaded_param_to_coerced_direct(%arg0: !rec_Two)
- attributes { test_classify = #non_byval_two } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_two } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Two>
cir.store %arg0, %spill : !rec_Two, !cir.ptr<!rec_Two>
cir.call @takes_two_coerced(%arg0) : (!rec_Two) -> ()
@@ -618,7 +618,7 @@ module attributes {
// Two arguments taken from one parameter, one forwarded and one copied, so
// a second read of the slot would show up as a second load.
cir.func @unloaded_param_to_two_calls(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.call @takes_big_non_byval(%arg0) : (!rec_Big) -> ()
@@ -634,10 +634,10 @@ module attributes {
// CHECK: cir.call @takes_big_byval(%[[COPY]]) :
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
cir.func private @takes_big_byval(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg }
}
@@ -658,7 +658,7 @@ module attributes {
// The argument is in a later block, which the spill still dominates.
cir.func @unloaded_param_read_in_successor(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.br ^bb1
@@ -676,7 +676,7 @@ module attributes {
// CHECK: cir.call @takes_big_non_byval(%[[PTR]]) :
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -703,7 +703,7 @@ module attributes {
// The body overwrites the slot before the argument is taken, so the copy the
// callee gets holds the parameter only if the read happens at the spill.
cir.func @unloaded_param_read_before_overwrite(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
@@ -721,7 +721,7 @@ module attributes {
// CHECK: cir.call @takes_big_byval(%[[COPY]]) :
cir.func private @takes_big_byval(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg }
}
@@ -748,7 +748,7 @@ module attributes {
// An sret return prepends a block argument, so the parameter is not at the
// index its classification sits at once the signature is rewritten.
cir.func @sret_with_unloaded_param(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #sret_and_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #sret_and_non_byval } {
%ret = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
@@ -766,7 +766,7 @@ module attributes {
// CHECK-SAME: (!cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.dead_on_return = -1 : i64, llvm.dereferenceable = 32 : i64, llvm.nofreeobj, llvm.noundef}) -> ()
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -795,7 +795,7 @@ module attributes {
// An Expand parameter ahead of it becomes one block argument per field, so
// again the parameter moves off its classification's index.
cir.func @expand_ahead_of_unloaded_param(%arg0: !rec_Two, %arg1: !rec_Big)
- attributes { test_classify = #expand_then_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #expand_then_non_byval } {
%s0 = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Two>
%s1 = cir.alloca "arg1" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %s0 : !rec_Two, !cir.ptr<!rec_Two>
@@ -813,7 +813,7 @@ module attributes {
// CHECK-SAME: (!cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.dead_on_return = -1 : i64, llvm.dereferenceable = 32 : i64, llvm.nofreeobj, llvm.noundef}) -> ()
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -841,7 +841,7 @@ module attributes {
// in for it may only claim the promise. The byval callee is handed the
// incoming pointer, which carries the promise and not the slot's alignment.
cir.func @unloaded_param_over_overaligned_slot(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(16) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.call @takes_big_byval(%arg0) : (!rec_Big) -> ()
@@ -855,7 +855,7 @@ module attributes {
// CHECK: cir.call @takes_big_byval(%[[PTR]]) :
cir.func private @takes_big_byval(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg }
}
@@ -877,7 +877,7 @@ module attributes {
// A parameter with no uses at all, so there is no spill to prepare and
// nothing to read back. The signature still becomes the incoming pointer.
cir.func @unused_non_byval_param(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
cir.return
}
@@ -907,7 +907,7 @@ module attributes {
// The body writes the slot but nothing takes the parameter as an argument,
// so there is nothing to read it back for.
cir.func @spilled_param_no_call_arg(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(4) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
@@ -941,10 +941,10 @@ module attributes {
// The parameter has no spill of its own, so it already names the caller's
// storage and is handed on as it stands.
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
cir.func @forwards_unspilled_param(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
cir.call @takes_big_non_byval(%arg0) : (!rec_Big) -> ()
cir.return
}
@@ -981,10 +981,10 @@ module attributes {
// The same parameter handed to a callee that wants its own copy, which is
// read out of the caller's storage through the incoming pointer.
cir.func private @takes_big_byval(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg }
cir.func @unspilled_param_to_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
cir.call @takes_big_byval(%arg0) : (!rec_Big) -> ()
cir.return
}
@@ -1020,7 +1020,7 @@ module attributes {
// The argument sits inside a nested region, which is where a full-expression
// scope puts it. The copy is taken at the spill, outside the region.
cir.func @unloaded_param_read_in_scope(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.scope {
@@ -1037,6 +1037,6 @@ module attributes {
// CHECK: cir.call @takes_big_byval(%[[COPY]]) :
cir.func private @takes_big_byval(%arg0: !rec_Big)
- attributes { test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #byval_arg }
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-nyi.cir
index 4f34978f79b20b..387160db5dfde7 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-non-byval-nyi.cir
@@ -21,11 +21,11 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// A record value with no storage behind it: nothing to forward.
cir.func @caller_non_byval_value(%novalue: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
cir.call @takes_big_non_byval(%novalue) : (!rec_Big) -> ()
cir.return
}
@@ -58,11 +58,11 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// A volatile load is an observable access the look-through would delete.
cir.func @caller_non_byval_volatile(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%volatileload = cir.load volatile %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -98,11 +98,11 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// An atomic load carries ordering the look-through would drop.
cir.func @caller_non_byval_atomic(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%atomicload = cir.load align(8) atomic(seq_cst) %tmp
@@ -140,12 +140,12 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// A load of a member of an enclosing record is not the temporary the caller
// destroys, so it is reported rather than forwarded.
cir.func @caller_non_byval_member(%s: !rec_Outer)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "outer" align(8) : !cir.ptr<!rec_Outer>
cir.store %s, %tmp : !rec_Outer, !cir.ptr<!rec_Outer>
%member = cir.get_member %tmp[0] {name = "inner"}
@@ -183,14 +183,14 @@ module attributes {
} {
cir.func private @takes_big_non_byval16(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg_align16 }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg_align16 }
// A slot stating less alignment than the callee is told the argument has.
// Raising it would not survive a slot that stands in for a parameter, so it
// is reported rather than forwarded under an alignment the callee may rely
// on.
cir.func @caller_non_byval_underaligned(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%tmp = cir.alloca "agg.tmp" align(8) : !cir.ptr<!rec_Big>
cir.store %s, %tmp : !rec_Big, !cir.ptr<!rec_Big>
%underaligned = cir.load %tmp : !cir.ptr<!rec_Big>, !rec_Big
@@ -229,7 +229,7 @@ module attributes {
// destroys, so it is not forwardable even though it becomes a pointer
// parameter carrying llvm.align.
cir.func @caller_non_byval_from_sret_slot() -> !rec_Big
- attributes { test_classify = #sret_return } {
+ requires_call_conv_lowering attributes { test_classify = #sret_return } {
%ret = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.store %z, %ret : !rec_Big, !cir.ptr<!rec_Big>
@@ -245,7 +245,7 @@ module attributes {
// CHECK-NEXT: cir.call @takes_big_non_byval(%retslot)
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -274,7 +274,7 @@ module attributes {
// owner. Only a non-byval parameter is recorded as forwardable, so this
// one is rejected.
cir.func @caller_non_byval_from_byval_param(%byvalparam: !rec_Big)
- attributes { test_classify = #byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #byval_arg } {
cir.call @takes_big_non_byval(%byvalparam) : (!rec_Big) -> ()
cir.return
}
@@ -285,7 +285,7 @@ module attributes {
// CHECK-NEXT: cir.call @takes_big_non_byval(%byvalparam)
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
}
@@ -312,7 +312,7 @@ module attributes {
// A non-byval parameter states less alignment than the callee it is handed to
// is told about, so it cannot stand in for that argument.
cir.func @caller_non_byval_param_underaligned(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg_align8 } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg_align8 } {
%spill = cir.alloca "arg0" align(16) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%paramload = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -326,7 +326,7 @@ module attributes {
// CHECK-NEXT: cir.call @takes_big_non_byval16(%paramload)
cir.func private @takes_big_non_byval16(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg_align16 }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg_align16 }
}
@@ -355,10 +355,10 @@ module attributes {
// would satisfy the callee here, and only the parameter's promise rules the
// forward out.
cir.func private @takes_big_non_byval16(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg_align16 }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg_align16 }
cir.func @callee_first_non_byval_param_underaligned(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg_align8 } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg_align8 } {
%spill = cir.alloca "arg0" align(16) init : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
%paramload = cir.load %spill : !cir.ptr<!rec_Big>, !rec_Big
@@ -394,12 +394,12 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// A decay names one element of an array, not the whole allocation, so
// getUnderlyingAlloca does not look through it.
cir.func @caller_non_byval_through_decay(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%arr = cir.alloca "arr" align(8) : !cir.ptr<!cir.array<!rec_Big x 2>>
%decayed = cir.cast array_to_ptrdecay %arr
: !cir.ptr<!cir.array<!rec_Big x 2>> -> !cir.ptr<!rec_Big>
@@ -438,12 +438,12 @@ module attributes {
} {
cir.func private @takes_big_non_byval16(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg_align16 }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg_align16 }
// The alignment comes from the slot underneath the cast, not from the cast,
// so an under-aligned slot is still reported once a cast is in between.
cir.func @caller_non_byval_underaligned_through_cast(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%raw = cir.alloca "raw" align(8) : !cir.ptr<!cir.array<!s8i x 32>>
%slot = cir.cast bitcast %raw
: !cir.ptr<!cir.array<!s8i x 32>> -> !cir.ptr<!rec_Big>
@@ -481,13 +481,13 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// The slot underneath the cast is forwardable, but the rewritten parameter
// is a pointer in the default address space, so the operand cannot be
// handed on as it stands.
cir.func @caller_non_byval_through_addrspace(%s: !rec_Big)
- attributes { test_classify = #passthrough } {
+ requires_call_conv_lowering attributes { test_classify = #passthrough } {
%raw = cir.alloca "raw" align(8) : !cir.ptr<!rec_Big>
%slot = cir.cast address_space %raw
: !cir.ptr<!rec_Big> -> !cir.ptr<!rec_Big, target_address_space(5)>
@@ -526,14 +526,14 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// A Direct pointer parameter that carries the same attributes the pass puts
// on a non-byval one. It is not one, so it must not be forwarded.
cir.func @caller_lookalike_attrs(%lookalike: !cir.ptr<!rec_Big> {
llvm.align = 8 : i64, llvm.dereferenceable = 32 : i64,
llvm.nofreeobj, llvm.noundef})
- attributes { test_classify = #direct_ptr } {
+ requires_call_conv_lowering attributes { test_classify = #direct_ptr } {
%v = cir.load %lookalike : !cir.ptr<!rec_Big>, !rec_Big
cir.call @takes_big_non_byval(%v) : (!rec_Big) -> ()
cir.return
@@ -562,12 +562,12 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// The read comes before the spill, so reading the slot there would read it
// before anything wrote it.
cir.func @param_read_before_spill(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
cir.call @takes_big_non_byval(%arg0) : (!rec_Big) -> ()
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
@@ -598,7 +598,7 @@ module attributes {
// Either slot could be the one the incoming pointer replaces, and there is
// nothing to prefer between them.
cir.func @param_spilled_twice(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init : !cir.ptr<!rec_Big>
%copy = cir.alloca "copy" align(8) : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
@@ -632,7 +632,7 @@ module attributes {
// The spill stores to a global rather than to a slot the incoming pointer
// can replace.
cir.func @spill_to_global(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%slot = cir.get_global @g : !cir.ptr<!rec_Big>
cir.store %arg0, %slot : !rec_Big, !cir.ptr<!rec_Big>
cir.return
@@ -663,7 +663,7 @@ module attributes {
// The spill stores through a cast rather than to the slot itself.
cir.func @spill_through_cast(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%raw = cir.alloca "arg0" align(8) : !cir.ptr<!cir.array<!u8i x 32>>
%slot = cir.cast bitcast %raw
: !cir.ptr<!cir.array<!u8i x 32>> -> !cir.ptr<!rec_Big>
@@ -696,7 +696,7 @@ module attributes {
// A slot in another address space is an allocation, but not one the incoming
// pointer can be substituted for.
cir.func @spill_to_other_address_space(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%slot = cir.alloca "arg0" align(8)
: !cir.ptr<!rec_Big, target_address_space(5)>
cir.store %arg0, %slot
@@ -728,7 +728,7 @@ module attributes {
// The parameter is returned directly, so it is not a call argument.
cir.func @param_returned_directly(%arg0: !rec_Big) -> !rec_Big
- attributes { test_classify = #sret_and_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #sret_and_non_byval } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.return %arg0 : !rec_Big
@@ -759,7 +759,7 @@ module attributes {
// Each parameter is spilled exactly once, but into the same slot, and the
// incoming pointer can only replace that slot for one of them.
cir.func @params_share_a_spill_slot(%arg0: !rec_Big, %arg1: !rec_Big)
- attributes { test_classify = #two_non_byval } {
+ requires_call_conv_lowering attributes { test_classify = #two_non_byval } {
%shared = cir.alloca "shared" align(8) init : !cir.ptr<!rec_Big>
cir.store %arg0, %shared : !rec_Big, !cir.ptr<!rec_Big>
cir.store %arg1, %shared : !rec_Big, !cir.ptr<!rec_Big>
@@ -789,13 +789,13 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// A cir.try_call operand counts as a call argument, so the read is routed
// through the slot, and the call is left to the rewrite, which does not
// implement this op.
cir.func @unloaded_param_to_try_call(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg } {
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
cir.store %arg0, %spill : !rec_Big, !cir.ptr<!rec_Big>
cir.try_call @takes_big_non_byval(%arg0) ^bb1, ^bb2 : (!rec_Big) -> ()
@@ -833,12 +833,12 @@ module attributes {
} {
cir.func private @takes_big_non_byval(%arg0: !rec_Big)
- attributes { test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { test_classify = #non_byval_arg }
// The spill is on one path only, so it reaches the argument without
// dominating it, and a read at the spill would not either.
cir.func @spill_does_not_dominate_read(%arg0: !rec_Big, %c: !cir.bool)
- attributes { test_classify = #non_byval_then_direct } {
+ requires_call_conv_lowering attributes { test_classify = #non_byval_then_direct } {
cir.brcond %c ^bb1, ^bb2
^bb1:
%spill = cir.alloca "arg0" align(8) init const : !cir.ptr<!rec_Big>
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-return-sret.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-return-sret.cir
index 529d25c7458f52..a2892d2cabf11e 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-return-sret.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-return-sret.cir
@@ -45,7 +45,7 @@ module attributes {
} {
cir.func @returns_big() -> !rec_Big
- attributes { test_classify = #indirect_return } {
+ requires_call_conv_lowering attributes { test_classify = #indirect_return } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.store %z, %0 : !rec_Big, !cir.ptr<!rec_Big>
@@ -72,7 +72,7 @@ module attributes {
// sret slot directly, so construction flows straight into it and the
// original store-from-result is dropped (no byte-copy, no load-back).
cir.func @caller() -> !s32i
- attributes { test_classify = #caller_cls } {
+ requires_call_conv_lowering attributes { test_classify = #caller_cls } {
%1 = cir.alloca "s" align(8) : !cir.ptr<!rec_Big>
%0 = cir.call @returns_big() : () -> !rec_Big
cir.store %0, %1 : !rec_Big, !cir.ptr<!rec_Big>
@@ -92,7 +92,7 @@ module attributes {
// A call whose result has more than one use cannot reuse a destination, so a
// fresh sret slot is allocated and each store of the result copies out of it.
cir.func @caller_multi() -> !s32i
- attributes { test_classify = #caller_cls } {
+ requires_call_conv_lowering attributes { test_classify = #caller_cls } {
%a = cir.alloca "a" align(8) : !cir.ptr<!rec_Big>
%b = cir.alloca "b" align(8) : !cir.ptr<!rec_Big>
%0 = cir.call @returns_big() : () -> !rec_Big
@@ -116,7 +116,7 @@ module attributes {
// s8 argument is still extended to s32 with llvm.signext on both the callee
// signature and the call site.
cir.func @returns_big_ext(%arg0: !s8i) -> !rec_Big
- attributes { test_classify = #indirect_return_ext } {
+ requires_call_conv_lowering attributes { test_classify = #indirect_return_ext } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.store %z, %0 : !rec_Big, !cir.ptr<!rec_Big>
@@ -132,7 +132,7 @@ module attributes {
// CHECK: cir.return
cir.func @caller_ext(%arg0: !s8i) -> !s32i
- attributes { test_classify = #caller_cls } {
+ requires_call_conv_lowering attributes { test_classify = #caller_cls } {
%1 = cir.alloca "s" align(8) : !cir.ptr<!rec_Big>
%0 = cir.call @returns_big_ext(%arg0) : (!s8i) -> !rec_Big
cir.store %0, %1 : !rec_Big, !cir.ptr<!rec_Big>
@@ -151,7 +151,7 @@ module attributes {
// returns into a single epilogue), so every cir.return must be routed
// through the sret pointer and the shared alloca rewired exactly once.
cir.func @returns_big_cond(%cond: !cir.bool) -> !rec_Big
- attributes { test_classify = #indirect_return_bool } {
+ requires_call_conv_lowering attributes { test_classify = #indirect_return_bool } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.if %cond {
@@ -179,10 +179,10 @@ module attributes {
// both returns collapse to a bare cir.return, and nothing is stored to the
// sret slot at all.
cir.func private @make_big(!cir.ptr<!rec_Big>)
- attributes { test_classify = #direct_ptr_arg }
+ requires_call_conv_lowering attributes { test_classify = #direct_ptr_arg }
cir.func @returns_big_ctor(%cond: !cir.bool) -> !rec_Big
- attributes { test_classify = #indirect_return_bool } {
+ requires_call_conv_lowering attributes { test_classify = #indirect_return_bool } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
cir.if %cond {
cir.call @make_big(%0) : (!cir.ptr<!rec_Big>) -> ()
@@ -206,7 +206,7 @@ module attributes {
// sret composes with an Ignore argument: the ignored arg is dropped from the
// signature and the sretOffset shift keeps the remaining block args aligned.
cir.func @returns_big_ignore(%ignored: !s32i) -> !rec_Big
- attributes { test_classify = #indirect_return_ignore } {
+ requires_call_conv_lowering attributes { test_classify = #indirect_return_ignore } {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_Big>
%z = cir.const #cir.zero : !rec_Big
cir.store %z, %0 : !rec_Big, !cir.ptr<!rec_Big>
@@ -226,7 +226,7 @@ module attributes {
// when the function body is present. Kept last so the CHECK-NOT below
// scopes to this declaration.
cir.func private @returns_big_decl() -> !rec_Big
- attributes { test_classify = #indirect_return }
+ requires_call_conv_lowering attributes { test_classify = #indirect_return }
// CHECK: cir.func{{.*}} @returns_big_decl(!cir.ptr<!rec_Big> {
// CHECK-SAME: llvm.sret = !rec_Big
diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-variadic-call-test-target-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-variadic-call-test-target-nyi.cir
index d5c7234812d854..ee52b1ce8b0da2 100644
--- a/clang/test/CIR/Transforms/abi-lowering/indirect-variadic-call-test-target-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/indirect-variadic-call-test-target-nyi.cir
@@ -12,7 +12,7 @@ module attributes {
// The test target classifies only the pointee's declared parameters, so any
// ellipsis argument is reported, needing a rewrite or not.
cir.func @call_variadic(%fp: !cir.ptr<!cir.func<(!s32i, ...) -> !s64i>>,
- %x: !s32i, %y: !s32i) -> !s64i {
+ %x: !s32i, %y: !s32i) -> !s64i requires_call_conv_lowering {
// CHECK: :[[@LINE+1]]:10: error: 'cir.call' op variadic arguments not yet implemented in CallConvLowering
%0 = cir.call %fp(%x, %y)
: (!cir.ptr<!cir.func<(!s32i, ...) -> !s64i>>, !s32i, !s32i) -> !s64i
@@ -32,10 +32,10 @@ module attributes {
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @variadic(!s32i, ...) -> !s64i
+ cir.func private @variadic(!s32i, ...) -> !s64i requires_call_conv_lowering
// A direct call is reported the same way.
- cir.func @call_variadic_direct(%x: !s32i, %y: !s32i) -> !s64i {
+ cir.func @call_variadic_direct(%x: !s32i, %y: !s32i) -> !s64i requires_call_conv_lowering {
// CHECK: :[[@LINE+1]]:10: error: 'cir.call' op variadic arguments not yet implemented in CallConvLowering
%0 = cir.call @variadic(%x, %y) : (!s32i, !s32i) -> !s64i
cir.return %0 : !s64i
diff --git a/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem-indirect.cir b/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem-indirect.cir
index 94272140974ad5..5595a6920556c7 100644
--- a/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem-indirect.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem-indirect.cir
@@ -17,7 +17,7 @@ module attributes {
// The callee is opaque, so the slot comes from classifying the function
// pointer's pointee: the struct argument spills to a byval slot, which the
// callee reaches whatever the call promised.
- cir.func @call_byval(%fp: !cir.ptr<!cir.func<(!rec_Big) -> !s64i>>, %b: !rec_Big) -> !s64i {
+ cir.func @call_byval(%fp: !cir.ptr<!cir.func<(!rec_Big) -> !s64i>>, %b: !rec_Big) -> !s64i requires_call_conv_lowering {
%0 = cir.call %fp(%b) { memory_effects = #none }
: (!cir.ptr<!cir.func<(!rec_Big) -> !s64i>>, !rec_Big) -> !s64i
cir.return %0 : !s64i
@@ -30,7 +30,7 @@ module attributes {
// Nothing is passed through a slot here, so the call keeps what it
// promised.
- cir.func @call_scalar(%fp: !cir.ptr<!cir.func<(!s32i) -> !s32i>>, %x: !s32i) -> !s32i {
+ cir.func @call_scalar(%fp: !cir.ptr<!cir.func<(!s32i) -> !s32i>>, %x: !s32i) -> !s32i requires_call_conv_lowering {
%0 = cir.call %fp(%x) { memory_effects = #none }
: (!cir.ptr<!cir.func<(!s32i) -> !s32i>>, !s32i) -> !s32i
cir.return %0 : !s32i
diff --git a/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem.cir b/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem.cir
index 26dfa2da181d8b..5c1352d639cfd7 100644
--- a/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/memory-effects-argmem.cir
@@ -61,36 +61,36 @@ module attributes {
} {
cir.func private @const_sret() -> !rec_Big
- attributes { memory_effects = #none, test_classify = #sret_ret }
+ requires_call_conv_lowering attributes { memory_effects = #none, test_classify = #sret_ret }
// CHECK: cir.func{{.*}} @const_sret(!cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.dead_on_unwind, llvm.sret = !rec_Big, llvm.writable}) attributes {{{.*}}memory_effects = #cir.memory_effects<other = none, arg_mem = readwrite, inaccessible_mem = none, errno_mem = none, target_mem0 = none, target_mem1 = none>
cir.func private @pure_sret() -> !rec_Big
- attributes { memory_effects = #read, test_classify = #sret_ret }
+ requires_call_conv_lowering attributes { memory_effects = #read, test_classify = #sret_ret }
// CHECK: cir.func{{.*}} @pure_sret(!cir.ptr<!rec_Big> {{{.*}}llvm.sret = !rec_Big{{.*}}}) attributes {{{.*}}memory_effects = #cir.memory_effects<other = read, arg_mem = readwrite, inaccessible_mem = read, errno_mem = read, target_mem0 = read, target_mem1 = read>
cir.func private @const_byval(!s32i, !rec_Big)
- attributes { memory_effects = #none, test_classify = #byval_arg }
+ requires_call_conv_lowering attributes { memory_effects = #none, test_classify = #byval_arg }
// CHECK: cir.func{{.*}} @const_byval(!s32i, !cir.ptr<!rec_Big> {llvm.align = 8 : i64, llvm.byval = !rec_Big, llvm.noundef}) attributes {{{.*}}memory_effects = #cir.memory_effects<other = none, arg_mem = readwrite, inaccessible_mem = none, errno_mem = none, target_mem0 = none, target_mem1 = none>
// An indirect argument without byval widens the same as byval.
cir.func private @const_non_byval(!rec_Big)
- attributes { memory_effects = #none, test_classify = #non_byval_arg }
+ requires_call_conv_lowering attributes { memory_effects = #none, test_classify = #non_byval_arg }
// CHECK: cir.func{{.*}} @const_non_byval(!cir.ptr<!rec_Big> {{{.*}}llvm.nofreeobj{{.*}}}) attributes {{{.*}}memory_effects = #cir.memory_effects<other = none, arg_mem = readwrite, inaccessible_mem = none, errno_mem = none, target_mem0 = none, target_mem1 = none>
// Variadic with no indirect slot in the signature.
cir.func private @const_variadic(!s8i, ...) -> !s32i
- attributes { memory_effects = #none, test_classify = #extend_arg }
+ requires_call_conv_lowering attributes { memory_effects = #none, test_classify = #extend_arg }
// CHECK: cir.func{{.*}} @const_variadic(!s8i {llvm.noundef, llvm.signext}, ...) -> !s32i attributes {{{.*}}memory_effects = #cir.memory_effects<other = none, arg_mem = readwrite, inaccessible_mem = none, errno_mem = none, target_mem0 = none, target_mem1 = none>
// An Extend argument is rewritten but hands the callee no memory, so the
// effects stay as written.
cir.func private @const_extend(!s8i) -> !s32i
- attributes { memory_effects = #none, test_classify = #extend_arg }
+ requires_call_conv_lowering attributes { memory_effects = #none, test_classify = #extend_arg }
// CHECK: cir.func{{.*}} @const_extend(!s8i {llvm.noundef, llvm.signext}) -> !s32i attributes {{{.*}}memory_effects = #cir.memory_effects<other = none, arg_mem = none, inaccessible_mem = none, errno_mem = none, target_mem0 = none, target_mem1 = none>
@@ -98,24 +98,24 @@ module attributes {
// memory. Only the hook reaches this, since no x86_64 classification
// produces Expand.
cir.func private @const_expand(!rec_Big) -> !s32i
- attributes { memory_effects = #none, test_classify = #expand_arg }
+ requires_call_conv_lowering attributes { memory_effects = #none, test_classify = #expand_arg }
// CHECK: cir.func{{.*}} @const_expand(!s64i, !s64i, !s64i) -> !s32i attributes {{{.*}}memory_effects = #cir.memory_effects<other = none, arg_mem = none, inaccessible_mem = none, errno_mem = none, target_mem0 = none, target_mem1 = none>
// Already widened on the way in, so widening it again changes nothing.
cir.func private @prewidened_sret() -> !rec_Big
- attributes { memory_effects = #argmem, test_classify = #sret_ret }
+ requires_call_conv_lowering attributes { memory_effects = #argmem, test_classify = #sret_ret }
// CHECK: cir.func{{.*}} @prewidened_sret(!cir.ptr<!rec_Big> {{{.*}}llvm.sret = !rec_Big{{.*}}}) attributes {{{.*}}memory_effects = #cir.memory_effects<other = none, arg_mem = readwrite, inaccessible_mem = none, errno_mem = none, target_mem0 = none, target_mem1 = none>
// A callee with no recorded effects must still come out with none, so that
// forwarding the original is distinguishable from hard-coding a value.
cir.func private @plain_sret() -> !rec_Big
- attributes { test_classify = #sret_ret }
+ requires_call_conv_lowering attributes { test_classify = #sret_ret }
// CHECK: cir.func{{.*}} @plain_sret(!cir.ptr<!rec_Big> {{{.*}}llvm.sret = !rec_Big{{.*}}}) attributes {test_classify = {args = [], return = {indirect_align = 8 : i64, kind = "indirect"}}}
- cir.func @call_plain_sret() attributes { test_classify = #passthrough } {
+ cir.func @call_plain_sret() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%r = cir.call @plain_sret() : () -> !rec_Big
cir.return
}
@@ -124,7 +124,7 @@ module attributes {
// nothrow without any recorded effects survives the rewrite and still gets
// no effects.
- cir.func @call_plain_sret_nothrow() attributes { test_classify = #passthrough } {
+ cir.func @call_plain_sret_nothrow() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%r = cir.call @plain_sret() nothrow : () -> !rec_Big
cir.return
}
@@ -133,7 +133,7 @@ module attributes {
// The call site carries its widened effects across the rewrite that gives
// it the sret operand.
- cir.func @call_const_sret() attributes { test_classify = #passthrough } {
+ cir.func @call_const_sret() requires_call_conv_lowering attributes { test_classify = #passthrough } {
%r = cir.call @const_sret() { memory_effects = #none } : () -> !rec_Big
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/try-call-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/try-call-nyi.cir
index 5b84ed53c197d2..f2cbfe3581b436 100644
--- a/clang/test/CIR/Transforms/abi-lowering/try-call-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/try-call-nyi.cir
@@ -13,12 +13,12 @@ module attributes {
} {
cir.func @callee(%arg0: !s32i, %arg1: !s32i) -> !s32i
- attributes { test_classify = #ignore_first_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_first_arg } {
cir.return %arg1 : !s32i
}
cir.func @caller(%arg0: !s32i, %arg1: !s32i) -> !s32i
- attributes { test_classify = #ignore_first_arg } {
+ requires_call_conv_lowering attributes { test_classify = #ignore_first_arg } {
cir.try_call @callee(%arg0, %arg1) ^bb1, ^bb2 : (!s32i, !s32i) -> !s32i
^bb1(%res: !s32i):
cir.return %res : !s32i
diff --git a/clang/test/CIR/Transforms/abi-lowering/variadic-call-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/variadic-call-nyi.cir
index af606c96779936..4f405d30f55c18 100644
--- a/clang/test/CIR/Transforms/abi-lowering/variadic-call-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/variadic-call-nyi.cir
@@ -21,13 +21,13 @@ module attributes {
} {
cir.func private @variadic(!s8i, ...) -> !s32i
- attributes { test_classify = #one_direct }
+ requires_call_conv_lowering attributes { test_classify = #one_direct }
// A fixed per-function classification attribute covers the declared
// parameter only, so the argument at the ellipsis is unclassified. The call
// is rejected even though nothing in the declared signature needs a rewrite.
cir.func @caller(%arg0: !s8i, %arg1: !s32i) -> !s32i
- attributes { test_classify = #two_direct } {
+ requires_call_conv_lowering attributes { test_classify = #two_direct } {
%0 = cir.call @variadic(%arg0, %arg1) : (!s8i, !s32i) -> !s32i
cir.return %0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-aggregate-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-aggregate-nyi.cir
index c264b26e150416..b764755f586c59 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-aggregate-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-aggregate-nyi.cir
@@ -57,7 +57,7 @@ module attributes {
// this bridge refuses the shape rather than guessing at it. Below the
// threshold the same shape is accepted and classifies Ignore, matching
// classic; see x86_64-union.cir take_empty.
- cir.func @take_empty_large_union(%arg0: !rec_UEmptyLarge) {
+ cir.func @take_empty_large_union(%arg0: !rec_UEmptyLarge) requires_call_conv_lowering {
cir.return
}
@@ -66,7 +66,7 @@ module attributes {
// A zero-sized member is dropped before classification, so its offset never
// reaches the rule sending a record with a member off its own alignment to
// memory. Only packing can put one at such an offset.
- cir.func @take_zero_len_arr(%arg0: !rec_ZeroLenArr) {
+ cir.func @take_zero_len_arr(%arg0: !rec_ZeroLenArr) requires_call_conv_lowering {
cir.return
}
@@ -77,7 +77,7 @@ module attributes {
// Past one eightbyte the declared extent settles nothing: the coercion
// follows this 9-byte unit and would give i8 for the second eightbyte,
// where classic sizes it from the record and gives i64.
- cir.func @take_bitint_unit_union(%arg0: !rec_UBitIntUnit) {
+ cir.func @take_bitint_unit_union(%arg0: !rec_UBitIntUnit) requires_call_conv_lowering {
cir.return
}
@@ -90,42 +90,42 @@ module attributes {
// 48 bytes with a vector member, a size no SSEUP coerce can be named from.
- cir.func @take_vec384_union(%arg0: !rec_UVec384) {
+ cir.func @take_vec384_union(%arg0: !rec_UVec384) requires_call_conv_lowering {
cir.return
}
// CHECK: not yet implemented for type '!cir.union<"UVec384"
// A three-float vector's 96 bits classify at 128, so it reaches SSEUP too.
- cir.func @take_vec3_384_union(%arg0: !rec_UVec3x384) {
+ cir.func @take_vec3_384_union(%arg0: !rec_UVec3x384) requires_call_conv_lowering {
cir.return
}
// CHECK: not yet implemented for type '!cir.union<"UVec3x384"
// The same vector, an array away.
- cir.func @take_vec_in_arr_union(%arg0: !rec_UVecInArr) {
+ cir.func @take_vec_in_arr_union(%arg0: !rec_UVecInArr) requires_call_conv_lowering {
cir.return
}
// CHECK: not yet implemented for type '!cir.union<"UVecInArr"
// The same vector, a record away.
- cir.func @take_vec_in_rec_union(%arg0: !rec_UVecInRec) {
+ cir.func @take_vec_in_rec_union(%arg0: !rec_UVecInRec) requires_call_conv_lowering {
cir.return
}
// CHECK: not yet implemented for type '!cir.union<"UVecInRec"
// An IEEE-quad float reaches SSEUP as well.
- cir.func @take_quad384_union(%arg0: !rec_UQuad384) {
+ cir.func @take_quad384_union(%arg0: !rec_UQuad384) requires_call_conv_lowering {
cir.return
}
// CHECK: not yet implemented for type '!cir.union<"UQuad384"
// A long double carrying quad semantics is the same float.
- cir.func @take_long_double384_union(%arg0: !rec_ULongDouble384) {
+ cir.func @take_long_double384_union(%arg0: !rec_ULongDouble384) requires_call_conv_lowering {
cir.return
}
@@ -133,7 +133,7 @@ module attributes {
// Packed, so 17 bytes, another size no coerce can be named from. Its
// 17-byte member spans the union, so only refusing the size catches it.
- cir.func @take_quad_packed_union(%arg0: !rec_UQuadPacked) {
+ cir.func @take_quad_packed_union(%arg0: !rec_UQuadPacked) requires_call_conv_lowering {
cir.return
}
@@ -145,14 +145,14 @@ module attributes {
// The all-pad reject also has to hold when the record is reached as a member,
// which is the shape a C++ empty class produces.
- cir.func @take_holds_all_pad(%arg0: !rec_HoldsAllPad) {
+ cir.func @take_holds_all_pad(%arg0: !rec_HoldsAllPad) requires_call_conv_lowering {
cir.return
}
// CHECK: not yet implemented for type '!cir.struct<"HoldsAllPad" {data
// A scalable vector has no size the eightbyte rules can read.
- cir.func @take_scalable(%arg0: !cir.vector<[4] x !cir.float>) {
+ cir.func @take_scalable(%arg0: !cir.vector<[4] x !cir.float>) requires_call_conv_lowering {
cir.return
}
@@ -161,7 +161,7 @@ module attributes {
// A _BitInt element narrower than a byte has no memory representation in
// CIR's lowering to LLVM, so this is rejected here rather than failing
// there.
- cir.func @take_sub_byte_element(%arg0: !cir.vector<16 x !cir.int<s, 2, bitint>>) {
+ cir.func @take_sub_byte_element(%arg0: !cir.vector<16 x !cir.int<s, 2, bitint>>) requires_call_conv_lowering {
cir.return
}
@@ -170,7 +170,7 @@ module attributes {
// A definition (unlike a declaration) is refused: no incomplete-by-value
// definition can arise from valid C++, so this stays a hard reject rather
// than the declaration-only skip in x86_64-incomplete-record-declaration.cir.
- cir.func @take_incomplete_defined(%arg0: !rec_Incomplete) {
+ cir.func @take_incomplete_defined(%arg0: !rec_Incomplete) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-bitfield.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-bitfield.cir
index adff98cb043fb5..7eace28b34938c 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-bitfield.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-bitfield.cir
@@ -44,7 +44,7 @@ module attributes {
// `struct BitPad { int a : 8; } __attribute__((aligned(16)));` The unit is
// one byte, but the declaration reaches three bytes past it, so the coercion
// cannot narrow to the unit and takes the whole eightbyte.
- cir.func @take_bit_pad(%arg0: !rec_BitPad) {
+ cir.func @take_bit_pad(%arg0: !rec_BitPad) requires_call_conv_lowering {
cir.return
}
@@ -52,14 +52,14 @@ module attributes {
// The same record with a unit as wide as the declaration does narrow, and
// the answer holds through a member record.
- cir.func @take_outer_bit_pad(%arg0: !rec_OuterBitPad) {
+ cir.func @take_outer_bit_pad(%arg0: !rec_OuterBitPad) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_outer_bit_pad(%arg0: !u32i)
// Two of those units fill the eightbyte, so there is nothing to narrow to.
- cir.func @take_arr_bit_pad(%arg0: !rec_ArrBitPad) {
+ cir.func @take_arr_bit_pad(%arg0: !rec_ArrBitPad) requires_call_conv_lowering {
cir.return
}
@@ -67,7 +67,7 @@ module attributes {
// Packing puts the int at offset 1, off its own alignment, which sends the
// record to memory before any coercion is chosen.
- cir.func @take_bf_pad(%arg0: !rec_BFPad) {
+ cir.func @take_bf_pad(%arg0: !rec_BFPad) requires_call_conv_lowering {
cir.return
}
@@ -76,7 +76,7 @@ module attributes {
// A zero-width bit-field takes no part in assigning eightbyte classes, but
// the type it was declared with still marks the bits it sits in as read, so
// the coercion does not narrow to the int ahead of it.
- cir.func @take_named_plus_zero_width(%arg0: !rec_NamedPlusZeroWidth) {
+ cir.func @take_named_plus_zero_width(%arg0: !rec_NamedPlusZeroWidth) requires_call_conv_lowering {
cir.return
}
@@ -85,7 +85,7 @@ module attributes {
// `struct Run { int a : 4; long long b : 27; int : 3; };` One unit holds
// all three fields, and each is classified from its own width and declared
// type rather than from the unit they share.
- cir.func @take_run(%arg0: !rec_Run) {
+ cir.func @take_run(%arg0: !rec_Run) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-bitint.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-bitint.cir
index 625f061ce2b5b7..c34d91aa69ade2 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-bitint.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-bitint.cir
@@ -38,7 +38,7 @@ module attributes {
// A sub-register width is Extend: signext for arguments, and no coercion in
// the body.
- cir.func @ret_b17(%arg0: !b17i) -> !b17i {
+ cir.func @ret_b17(%arg0: !b17i) -> !b17i requires_call_conv_lowering {
cir.return %arg0 : !b17i
}
@@ -52,7 +52,7 @@ module attributes {
// LLVM-NEXT: ret i17 %[[ARG]]
// Unsigned takes zeroext instead.
- cir.func @ret_ub17(%arg0: !ub17i) -> !ub17i {
+ cir.func @ret_ub17(%arg0: !ub17i) -> !ub17i requires_call_conv_lowering {
cir.return %arg0 : !ub17i
}
@@ -66,7 +66,7 @@ module attributes {
// LLVM-NEXT: ret i17 %[[ARG]]
// Already the width the classifier names: Direct, nothing to rewrite.
- cir.func @ret_b32(%arg0: !b32i) -> !b32i {
+ cir.func @ret_b32(%arg0: !b32i) -> !b32i requires_call_conv_lowering {
cir.return %arg0 : !b32i
}
@@ -80,7 +80,7 @@ module attributes {
// 33 bits travels in an i64. Its five bytes are fewer than the eightbyte,
// so both coerce slots are typed i64 and the narrow views sit on the
// accesses. That memory round trip is a truncate and a re-extend in LLVM.
- cir.func @ret_b33(%arg0: !b33i) -> !b33i {
+ cir.func @ret_b33(%arg0: !b33i) -> !b33i requires_call_conv_lowering {
cir.return %arg0 : !b33i
}
@@ -102,7 +102,7 @@ module attributes {
// LLVM-NEXT: ret i33 %[[NARROW]]
// Signedness changes only the extension back into the eightbyte.
- cir.func @ret_ub33(%arg0: !ub33i) -> !ub33i {
+ cir.func @ret_ub33(%arg0: !ub33i) -> !ub33i requires_call_conv_lowering {
cir.return %arg0 : !ub33i
}
@@ -125,7 +125,7 @@ module attributes {
// 63 bits fills the eightbyte, and the slot takes whichever type is larger,
// so here it is the bit-precise one and the i64 view moves to the load.
- cir.func @ret_b63(%arg0: !b63i) -> !b63i {
+ cir.func @ret_b63(%arg0: !b63i) -> !b63i requires_call_conv_lowering {
cir.return %arg0 : !b63i
}
@@ -146,7 +146,7 @@ module attributes {
// LLVM-NEXT: ret i63 %[[NARROW]]
// A _BitInt exactly filling one register is Direct, signature unchanged.
- cir.func @ret_b64(%arg0: !b64i) -> !b64i {
+ cir.func @ret_b64(%arg0: !b64i) -> !b64i requires_call_conv_lowering {
cir.return %arg0 : !b64i
}
@@ -159,7 +159,7 @@ module attributes {
// Two INTEGER eightbytes: coerced to a {i64, i64} pair the rewriter flattens
// into two arguments, which the prologue writes back into one slot.
- cir.func @ret_b65(%arg0: !b65i) -> !b65i {
+ cir.func @ret_b65(%arg0: !b65i) -> !b65i requires_call_conv_lowering {
cir.return %arg0 : !b65i
}
@@ -193,7 +193,7 @@ module attributes {
// LLVM-NEXT: ret i65 %[[NARROW]]
// Unsigned pairs the same way and zero-extends on the way back.
- cir.func @ret_ub65(%arg0: !ub65i) -> !ub65i {
+ cir.func @ret_ub65(%arg0: !ub65i) -> !ub65i requires_call_conv_lowering {
cir.return %arg0 : !ub65i
}
@@ -227,7 +227,7 @@ module attributes {
// LLVM-NEXT: ret i65 %[[NARROW]]
// 127 bits fills both eightbytes, so the slot is the bit-precise type again.
- cir.func @ret_b127(%arg0: !b127i) -> !b127i {
+ cir.func @ret_b127(%arg0: !b127i) -> !b127i requires_call_conv_lowering {
cir.return %arg0 : !b127i
}
@@ -261,7 +261,7 @@ module attributes {
// LLVM-NEXT: ret i127 %[[NARROW]]
// Exactly two eightbytes: passed as one i128, nothing to rewrite.
- cir.func @ret_b128(%arg0: !b128i) -> !b128i {
+ cir.func @ret_b128(%arg0: !b128i) -> !b128i requires_call_conv_lowering {
cir.return %arg0 : !b128i
}
@@ -274,7 +274,7 @@ module attributes {
// A call site widens the argument and narrows the result symmetrically, so
// the truncate and extend appear on both sides of the call.
- cir.func @call_b33(%arg0: !b33i) -> !b33i {
+ cir.func @call_b33(%arg0: !b33i) -> !b33i requires_call_conv_lowering {
%0 = cir.call @ret_b33(%arg0) : (!b33i) -> !b33i
cir.return %0 : !b33i
}
@@ -308,7 +308,7 @@ module attributes {
// A call site decomposes the argument into the two registers the callee
// expects and reassembles the returned pair.
- cir.func @call_b65(%arg0: !b65i) -> !b65i {
+ cir.func @call_b65(%arg0: !b65i) -> !b65i requires_call_conv_lowering {
%0 = cir.call @ret_b65(%arg0) : (!b65i) -> !b65i
cir.return %0 : !b65i
}
@@ -360,7 +360,7 @@ module attributes {
// Widths that classify
diff erently in one signature: the 65-bit parameter
// expands to two registers, shifting the 33-bit one to the fourth position
// while the extended one stays where it was.
- cir.func @take_widths(%arg0: !b17i, %arg1: !b65i, %arg2: !b33i) {
+ cir.func @take_widths(%arg0: !b17i, %arg1: !b65i, %arg2: !b33i) requires_call_conv_lowering {
cir.return
}
@@ -410,7 +410,7 @@ module attributes {
// Calling it maps the caller's four registers back onto the callee's four:
// the extended argument passes straight through, the pair is decomposed, and
// the 33-bit value is re-widened.
- cir.func @call_widths(%arg0: !b17i, %arg1: !b65i, %arg2: !b33i) {
+ cir.func @call_widths(%arg0: !b17i, %arg1: !b65i, %arg2: !b33i) requires_call_conv_lowering {
cir.call @take_widths(%arg0, %arg1, %arg2) : (!b17i, !b65i, !b33i) -> ()
cir.return
}
@@ -495,7 +495,7 @@ module attributes {
// Only a bit-precise type rounds up to a storage width, so a plain i40
// coerces to its own width and the widen check leaves it alone.
- cir.func @plain_i40(%arg0: !cir.int<s, 40>) -> !cir.int<s, 40> {
+ cir.func @plain_i40(%arg0: !cir.int<s, 40>) -> !cir.int<s, 40> requires_call_conv_lowering {
cir.return %arg0 : !cir.int<s, 40>
}
@@ -509,7 +509,7 @@ module attributes {
// A struct holding one sub-eightbyte _BitInt is a single INTEGER eightbyte:
// Direct, coerced to i32, and reconstituted before the body's own alloca.
- cir.func @coerce_s(%arg0: !rec_S) -> !rec_S {
+ cir.func @coerce_s(%arg0: !rec_S) -> !rec_S requires_call_conv_lowering {
%0 = cir.alloca "a" align(4) : !cir.ptr<!rec_S>
cir.store %arg0, %0 : !rec_S, !cir.ptr<!rec_S>
%1 = cir.load %0 : !cir.ptr<!rec_S>, !rec_S
@@ -538,7 +538,7 @@ module attributes {
// LLVM-NEXT: ret i32 %[[RES]]
// A struct holding a two-eightbyte _BitInt flattens into an i64 pair.
- cir.func @take_p(%arg0: !rec_P) {
+ cir.func @take_p(%arg0: !rec_P) requires_call_conv_lowering {
cir.return
}
@@ -567,7 +567,7 @@ module attributes {
// LLVM-NEXT: ret void
// A struct holding a _BitInt(128) coerces to a single i128.
- cir.func @take_w(%arg0: !rec_W) {
+ cir.func @take_w(%arg0: !rec_W) requires_call_conv_lowering {
cir.return
}
@@ -586,7 +586,7 @@ module attributes {
// A trailing byte pushes the struct past two eightbytes, so it passes byval,
// aligned 8 as _BitInt(128) requires rather than __int128's 16.
- cir.func @take_o(%arg0: !rec_O) {
+ cir.func @take_o(%arg0: !rec_O) requires_call_conv_lowering {
cir.return
}
@@ -601,7 +601,7 @@ module attributes {
// Returning it takes the sret path, and the caller's buffer replaces the
// return slot the body allocated.
- cir.func @ret_o() -> !rec_O {
+ cir.func @ret_o() -> !rec_O requires_call_conv_lowering {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!rec_O>
%1 = cir.const #cir.zero : !rec_O
cir.store %1, %0 : !rec_O, !cir.ptr<!rec_O>
@@ -625,7 +625,7 @@ module attributes {
// Each _BitInt(65) element occupies two eightbytes, so an array of two is 32
// bytes and the wrapping struct passes indirectly.
- cir.func @take_arr(%arg0: !rec_Arr) {
+ cir.func @take_arr(%arg0: !rec_Arr) requires_call_conv_lowering {
cir.return
}
@@ -641,7 +641,7 @@ module attributes {
// A _BitInt wider than 128 bits classifies Indirect: byval on the argument
// side. The rewriter attaches llvm.noundef to a byval argument, so where
// CIRGen already attached one the merged dictionary keeps a single entry.
- cir.func @take_b200(%arg0: !b200i {llvm.noundef}) {
+ cir.func @take_b200(%arg0: !b200i {llvm.noundef}) requires_call_conv_lowering {
cir.return
}
@@ -661,7 +661,7 @@ module attributes {
// A call site builds the byval copy itself, and the call operand's own
// byval attribute is widened the same way as the callee's.
- cir.func @call_b200(%arg0: !b200i) {
+ cir.func @call_b200(%arg0: !b200i) requires_call_conv_lowering {
cir.call @take_b200(%arg0) : (!b200i) -> ()
cir.return
}
@@ -687,7 +687,7 @@ module attributes {
// A non-multiple-of-8 width past 128 still classifies Indirect at the same
// 8-byte alignment: the byval alignment is the target's clamped _BitInt
// maximum, not derived from the width's own byte count.
- cir.func @take_b201(%arg0: !b201i) {
+ cir.func @take_b201(%arg0: !b201i) requires_call_conv_lowering {
cir.return
}
@@ -704,7 +704,7 @@ module attributes {
// handing the slot over to the incoming pointer is gated on the parameter
// being a record, and for a _BitInt the pair is its conversion between the
// i256 in memory and the i200 value.
- cir.func @take_b200_spilled(%arg0: !b200i) {
+ cir.func @take_b200_spilled(%arg0: !b200i) requires_call_conv_lowering {
%0 = cir.alloca "x" align(8) : !cir.ptr<!b200i>
cir.store %arg0, %0 : !b200i, !cir.ptr<!b200i>
cir.return
@@ -730,7 +730,7 @@ module attributes {
// Signedness only affects the extend direction on the memory round trip,
// not the classification.
- cir.func @take_ub200(%arg0: !ub200i) {
+ cir.func @take_ub200(%arg0: !ub200i) requires_call_conv_lowering {
cir.return
}
@@ -748,7 +748,7 @@ module attributes {
// attach to any scalar return) must be dropped along with the result
// itself rather than surviving as a stale one-element res_attrs on a
// function that now returns void.
- cir.func @ret_b200() -> (!b200i {llvm.noundef}) {
+ cir.func @ret_b200() -> (!b200i {llvm.noundef}) requires_call_conv_lowering {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!b200i>
%1 = cir.const #cir.int<5> : !b200i
cir.store %1, %0 : !b200i, !cir.ptr<!b200i>
@@ -774,7 +774,7 @@ module attributes {
// A call site rewriting to the sret shape drops the pre-existing
// llvm.noundef the same way the callee's own definition does.
- cir.func @call_ret_b200() -> (!b200i {llvm.noundef}) {
+ cir.func @call_ret_b200() -> (!b200i {llvm.noundef}) requires_call_conv_lowering {
%0 = cir.alloca "__retval" align(8) : !cir.ptr<!b200i>
%1 = cir.call @ret_b200() : () -> !b200i
cir.store %1, %0 : !b200i, !cir.ptr<!b200i>
@@ -800,7 +800,7 @@ module attributes {
// A struct member wider than 128 bits recurses through the same rule as a
// scalar of that width; the struct as a whole still passes byval since it
// spans more than two eightbytes.
- cir.func @take_d(%arg0: !rec_D) {
+ cir.func @take_d(%arg0: !rec_D) requires_call_conv_lowering {
cir.return
}
@@ -816,7 +816,7 @@ module attributes {
// A union member wider than 128 bits recurses through the same rule via
// the union's own member-recursion check, a separate code path from a
// struct's.
- cir.func @take_ud(%arg0: !rec_UD) {
+ cir.func @take_ud(%arg0: !rec_UD) requires_call_conv_lowering {
cir.return
}
@@ -831,7 +831,7 @@ module attributes {
// An array of a width wider than 128 bits recurses through the element type,
// a third member-recursion path distinct from a struct's and a union's.
- cir.func @take_ad(%arg0: !rec_AD) {
+ cir.func @take_ad(%arg0: !rec_AD) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-complex.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-complex.cir
index 6e36411c295eb1..e0c8310fdcde56 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-complex.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-complex.cir
@@ -23,7 +23,7 @@ module attributes {
// Both halves of a _Complex float share one SSE eightbyte, so it coerces to
// a two-element vector rather than passing as a CIR complex.
- cir.func @cfloat(%arg0: !cir.complex<!cir.float>) -> !cir.complex<!cir.float> {
+ cir.func @cfloat(%arg0: !cir.complex<!cir.float>) -> !cir.complex<!cir.float> requires_call_conv_lowering {
cir.return %arg0 : !cir.complex<!cir.float>
}
@@ -31,7 +31,7 @@ module attributes {
// _Complex double needs two SSE eightbytes, so it becomes a register pair
// and the arguments flatten.
- cir.func @cdouble(%arg0: !cir.complex<!cir.double>) -> !cir.complex<!cir.double> {
+ cir.func @cdouble(%arg0: !cir.complex<!cir.double>) -> !cir.complex<!cir.double> requires_call_conv_lowering {
cir.return %arg0 : !cir.complex<!cir.double>
}
@@ -39,13 +39,13 @@ module attributes {
// A _Complex of a sub-eightbyte integer packs both halves into one INTEGER
// eightbyte.
- cir.func @cshort(%arg0: !cir.complex<!s16i>) -> !cir.complex<!s16i> {
+ cir.func @cshort(%arg0: !cir.complex<!s16i>) -> !cir.complex<!s16i> requires_call_conv_lowering {
cir.return %arg0 : !cir.complex<!s16i>
}
// CHECK: cir.func{{.*}} @cshort(%arg0: !u32i) -> !u32i
- cir.func @cint(%arg0: !cir.complex<!s32i>) -> !cir.complex<!s32i> {
+ cir.func @cint(%arg0: !cir.complex<!s32i>) -> !cir.complex<!s32i> requires_call_conv_lowering {
cir.return %arg0 : !cir.complex<!s32i>
}
@@ -54,13 +54,13 @@ module attributes {
// A complex x87 long double passes its argument in memory while the return
// comes back as the st0/st1 pair.
cir.func @clongdouble(%arg0: !cir.complex<!cir.long_double<!cir.f80>>)
- -> !cir.complex<!cir.long_double<!cir.f80>> {
+ -> !cir.complex<!cir.long_double<!cir.f80>> requires_call_conv_lowering {
cir.return %arg0 : !cir.complex<!cir.long_double<!cir.f80>>
}
// CHECK: cir.func{{.*}} @clongdouble(%arg0: !cir.ptr<!cir.complex<!cir.long_double<!cir.f80>>> {{.*}}llvm.byval = !cir.complex<!cir.long_double<!cir.f80>>{{.*}}) -> ![[X87PAIR]]
- cir.func @call_cfloat(%arg0: !cir.complex<!cir.float>) -> !cir.complex<!cir.float> {
+ cir.func @call_cfloat(%arg0: !cir.complex<!cir.float>) -> !cir.complex<!cir.float> requires_call_conv_lowering {
%0 = cir.call @cfloat(%arg0) : (!cir.complex<!cir.float>) -> !cir.complex<!cir.float>
cir.return %0 : !cir.complex<!cir.float>
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-class.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-class.cir
index 9428e26734ba51..9af72d54335391 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-class.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-class.cir
@@ -51,7 +51,7 @@ module attributes {
} {
// A C++ empty class is padding alone, so the argument is dropped.
- cir.func @take_empty(%arg0: !rec_E) {
+ cir.func @take_empty(%arg0: !rec_E) requires_call_conv_lowering {
cir.return
}
@@ -62,7 +62,7 @@ module attributes {
// Unnamed bit-field storage is marked empty because no field of the source
// reads it, but it holds data for the ABI, so a record of nothing else is
// still passed in a register of its own.
- cir.func @take_empty_bits(%arg0: !rec_EBits, %arg1: !s32i) -> !s32i {
+ cir.func @take_empty_bits(%arg0: !rec_EBits, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg1 : !s32i
}
@@ -70,7 +70,7 @@ module attributes {
// LLVM: define i32 @take_empty_bits(i8 %{{[^,)]+}}, i32 %{{[^,)]+}})
// Emptiness is the absence of a data member, not the presence of a pad one.
- cir.func @take_mixed_pad_empty(%arg0: !rec_MixPE, %arg1: !s32i) -> !s32i {
+ cir.func @take_mixed_pad_empty(%arg0: !rec_MixPE, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg1 : !s32i
}
@@ -81,7 +81,7 @@ module attributes {
// an unnamed access unit of its own. Classic CodeGen reaches those bytes
// through the member's own fields, so this is refused. An empty base or a
// [[no_unique_address]] member of `struct { unsigned : 32; }` produces it.
- cir.func @take_holds_empty_bits(%arg0: !rec_HoldsEmptyBits) {
+ cir.func @take_holds_empty_bits(%arg0: !rec_HoldsEmptyBits) requires_call_conv_lowering {
cir.return
}
@@ -89,7 +89,7 @@ module attributes {
// LLVM: define void @take_holds_empty_bits(i64 %{{[^,)]+}})
// Several [[no_unique_address]] members widen the padding past a byte.
- cir.func @take_empty_blob(%arg0: !rec_EBlob) -> !s32i {
+ cir.func @take_empty_blob(%arg0: !rec_EBlob) -> !s32i requires_call_conv_lowering {
%0 = cir.const #cir.int<0> : !s32i
cir.return %0 : !s32i
}
@@ -98,7 +98,7 @@ module attributes {
// LLVM: define i32 @take_empty_blob()
// An empty return is dropped to void, and the local slot survives.
- cir.func @ret_empty() -> !rec_E {
+ cir.func @ret_empty() -> !rec_E requires_call_conv_lowering {
%0 = cir.alloca "r" align(1) : !cir.ptr<!rec_E>
%1 = cir.load %0 : !cir.ptr<!rec_E>, !rec_E
cir.return %1 : !rec_E
@@ -110,7 +110,7 @@ module attributes {
// LLVM: define void @ret_empty()
// A remaining real argument shifts down into the first slot.
- cir.func @take_mixed(%arg0: !rec_E, %arg1: !s32i) -> !s32i {
+ cir.func @take_mixed(%arg0: !rec_E, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg1 : !s32i
}
@@ -119,7 +119,7 @@ module attributes {
// LLVM: define i32 @take_mixed(i32 %{{.*}})
// Dropping one from the middle keeps the order of the arguments around it.
- cir.func @take_middle(%arg0: !s32i, %arg1: !rec_E, %arg2: !u8i) -> !s32i {
+ cir.func @take_middle(%arg0: !s32i, %arg1: !rec_E, %arg2: !u8i) -> !s32i requires_call_conv_lowering {
cir.return %arg0 : !s32i
}
@@ -128,7 +128,7 @@ module attributes {
// A byte-sized record needing no padding is data: the padded flag is the
// boundary, not the size.
- cir.func @take_byte(%arg0: !rec_Byte) {
+ cir.func @take_byte(%arg0: !rec_Byte) requires_call_conv_lowering {
cir.return
}
@@ -136,7 +136,7 @@ module attributes {
// LLVM: define void @take_byte(i8 %{{.*}})
// An empty member contributes no eightbyte, so only the int is classified.
- cir.func @take_has_empty(%arg0: !rec_HasEmpty) -> !s32i {
+ cir.func @take_has_empty(%arg0: !rec_HasEmpty) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "h" align(4) : !cir.ptr<!rec_HasEmpty>
cir.store %arg0, %0 : !rec_HasEmpty, !cir.ptr<!rec_HasEmpty>
%1 = cir.get_member %0[0] {name = "x"} : !cir.ptr<!rec_HasEmpty> -> !cir.ptr<!s32i>
@@ -155,7 +155,7 @@ module attributes {
// The empty member still takes layout space, so the int sits at offset 4 and
// the eightbyte spanning both coerces to i64.
- cir.func @take_has_empty_first(%arg0: !rec_HasEmptyFirst) -> !s32i {
+ cir.func @take_has_empty_first(%arg0: !rec_HasEmptyFirst) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "h" align(4) : !cir.ptr<!rec_HasEmptyFirst>
cir.store %arg0, %0 : !rec_HasEmptyFirst, !cir.ptr<!rec_HasEmptyFirst>
%1 = cir.get_member %0[1] {name = "x"} : !cir.ptr<!rec_HasEmptyFirst> -> !cir.ptr<!s32i>
@@ -172,7 +172,7 @@ module attributes {
// A plain empty member leaves its record non-empty, matching the Itanium
// rule, so this one is dropped by composition rather than by the flag: the
// member maps to no fields and contributes no eightbyte.
- cir.func @take_empty_mem(%arg0: !rec_EmptyMem) {
+ cir.func @take_empty_mem(%arg0: !rec_EmptyMem) requires_call_conv_lowering {
cir.return
}
@@ -182,7 +182,7 @@ module attributes {
// Nested one level deeper, as the first base of a derived record: it adds no
// eightbyte, but its byte still places Base2 at offset 4.
- cir.func @take_d2(%arg0: !rec_D2) -> !s32i {
+ cir.func @take_d2(%arg0: !rec_D2) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "d" align(4) : !cir.ptr<!rec_D2>
cir.store %arg0, %0 : !rec_D2, !cir.ptr<!rec_D2>
%1 = cir.get_member %0[1] {name = "Base2"} : !cir.ptr<!rec_D2> -> !cir.ptr<!rec_Base2>
@@ -197,7 +197,7 @@ module attributes {
// LLVM: define i32 @take_d2(i64 %{{.*}})
// Being empty does not override the declared argument-passing kind.
- cir.func @take_ntc_empty(%arg0: !rec_NTCE) {
+ cir.func @take_ntc_empty(%arg0: !rec_NTCE) requires_call_conv_lowering {
cir.return
}
@@ -205,7 +205,7 @@ module attributes {
// LLVM: define void @take_ntc_empty(ptr nofreeobj noundef align 1 dereferenceable(1) %{{.*}})
// The same record returned goes through sret rather than being dropped.
- cir.func @ret_ntc_empty() -> !rec_NTCE {
+ cir.func @ret_ntc_empty() -> !rec_NTCE requires_call_conv_lowering {
%0 = cir.alloca "r" align(1) : !cir.ptr<!rec_NTCE>
%1 = cir.load %0 : !cir.ptr<!rec_NTCE>, !rec_NTCE
cir.return %1 : !rec_NTCE
@@ -215,7 +215,7 @@ module attributes {
// LLVM: define void @ret_ntc_empty(ptr dead_on_unwind noalias writable sret(%struct.NTCE) align 1 %{{.*}})
// At exactly two eightbytes an empty class is still dropped.
- cir.func @take_empty_med(%arg0: !rec_EMed, %arg1: !s32i) -> !s32i {
+ cir.func @take_empty_med(%arg0: !rec_EMed, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg1 : !s32i
}
@@ -223,7 +223,7 @@ module attributes {
// LLVM: define i32 @take_empty_med(i32 %{{.*}})
// Returning one at that size is dropped to void as well.
- cir.func @ret_empty_med() -> !rec_EMed {
+ cir.func @ret_empty_med() -> !rec_EMed requires_call_conv_lowering {
%0 = cir.alloca "r" align(16) : !cir.ptr<!rec_EMed>
%1 = cir.load %0 : !cir.ptr<!rec_EMed>, !rec_EMed
cir.return %1 : !rec_EMed
@@ -235,7 +235,7 @@ module attributes {
// Past two eightbytes SysV says memory whatever the content, so it is passed
// indirectly at its declared alignment.
- cir.func @take_empty_big(%arg0: !rec_EBig, %arg1: !s32i) -> !s32i {
+ cir.func @take_empty_big(%arg0: !rec_EBig, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg1 : !s32i
}
@@ -243,7 +243,7 @@ module attributes {
// LLVM: define i32 @take_empty_big(ptr noundef byval(%struct.EBig) align 32 %{{.*}}, i32 %{{.*}})
// The same record returned uses sret at that alignment.
- cir.func @ret_empty_big() -> !rec_EBig {
+ cir.func @ret_empty_big() -> !rec_EBig requires_call_conv_lowering {
%0 = cir.alloca "r" align(32) : !cir.ptr<!rec_EBig>
%1 = cir.load %0 : !cir.ptr<!rec_EBig>, !rec_EBig
cir.return %1 : !rec_EBig
@@ -253,7 +253,7 @@ module attributes {
// LLVM: define void @ret_empty_big(ptr dead_on_unwind noalias writable sret(%struct.EBig) align 32 %{{.*}})
// A call site drops the operand as well as the parameter.
- cir.func @caller(%arg0: !rec_E, %arg1: !s32i) -> !s32i {
+ cir.func @caller(%arg0: !rec_E, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
%0 = cir.call @take_mixed(%arg0, %arg1) : (!rec_E, !s32i) -> !s32i
cir.return %0 : !s32i
}
@@ -264,8 +264,8 @@ module attributes {
// A dropped return leaves the call with no result, so uses of it become
// poison rather than dangling.
- cir.func private @mk_empty() -> !rec_E
- cir.func @caller_ret_empty() -> !s32i {
+ cir.func private @mk_empty() -> !rec_E requires_call_conv_lowering
+ cir.func @caller_ret_empty() -> !s32i requires_call_conv_lowering {
%0 = cir.call @mk_empty() : () -> !rec_E
%1 = cir.alloca "e" align(1) : !cir.ptr<!rec_E>
cir.store %0, %1 : !rec_E, !cir.ptr<!rec_E>
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-record.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-record.cir
index 23254734f27e5b..e712c274298e38 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-record.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-empty-record.cir
@@ -11,7 +11,7 @@ module attributes {
// A zero-field record (a C empty struct) classifies as Ignore: the argument
// is dropped from the lowered signature.
- cir.func @take_empty(%arg0: !rec_E0) {
+ cir.func @take_empty(%arg0: !rec_E0) requires_call_conv_lowering {
cir.return
}
@@ -20,7 +20,7 @@ module attributes {
// The empty argument is dropped even when a real argument remains; the real
// argument shifts down to the first slot.
- cir.func @take_mixed(%arg0: !rec_E0, %arg1: !s32i) -> !s32i {
+ cir.func @take_mixed(%arg0: !rec_E0, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
cir.return %arg1 : !s32i
}
@@ -29,7 +29,7 @@ module attributes {
// An empty-record return is dropped: the function returns void. The
// local storage slot survives the rewrite; only the return is dropped.
- cir.func @ret_empty() -> !rec_E0 {
+ cir.func @ret_empty() -> !rec_E0 requires_call_conv_lowering {
%0 = cir.alloca "r" align(1) : !cir.ptr<!rec_E0>
%1 = cir.load %0 : !cir.ptr<!rec_E0>, !rec_E0
cir.return %1 : !rec_E0
@@ -41,7 +41,7 @@ module attributes {
// The empty argument is also dropped at call sites: the caller's own empty
// argument is dropped, and the call to take_mixed drops it too.
- cir.func @caller(%arg0: !rec_E0, %arg1: !s32i) -> !s32i {
+ cir.func @caller(%arg0: !rec_E0, %arg1: !s32i) -> !s32i requires_call_conv_lowering {
%0 = cir.call @take_mixed(%arg0, %arg1) : (!rec_E0, !s32i) -> !s32i
cir.return %0 : !s32i
}
@@ -51,7 +51,7 @@ module attributes {
// A local empty struct lives in an alloca; the alloca survives the rewrite
// while the empty operand is dropped from the call.
- cir.func @caller_local(%arg0: !s32i) -> !s32i {
+ cir.func @caller_local(%arg0: !s32i) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "e" align(1) : !cir.ptr<!rec_E0>
%1 = cir.load %0 : !cir.ptr<!rec_E0>, !rec_E0
%2 = cir.call @take_mixed(%1, %arg0) : (!rec_E0, !s32i) -> !s32i
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-get-global.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-get-global.cir
index 3234bf7f9ac7b5..3a76f62bd5592f 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-get-global.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-get-global.cir
@@ -14,17 +14,17 @@ module attributes {
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @make_big(!s32i) -> !rec_Big
- cir.func private @make_pair(!s32i) -> !rec_Pair2
- cir.func private @take_big(!rec_Big)
- cir.func private @take_char(!s8i)
- cir.func private @plain(!s32i) -> !s32i
- cir.func private @take_empty(!rec_E0)
+ cir.func private @make_big(!s32i) -> !rec_Big requires_call_conv_lowering
+ cir.func private @make_pair(!s32i) -> !rec_Pair2 requires_call_conv_lowering
+ cir.func private @take_big(!rec_Big) requires_call_conv_lowering
+ cir.func private @take_char(!s8i) requires_call_conv_lowering
+ cir.func private @plain(!s32i) -> !s32i requires_call_conv_lowering
+ cir.func private @take_empty(!rec_E0) requires_call_conv_lowering
cir.global "private" external @data : !s32i
// A 32-byte return becomes an sret pointer parameter, so the address of the
// function has to be taken at the rewritten type and cast back for the use.
- cir.func @addr_sret() -> !cir.ptr<!cir.func<(!s32i) -> !rec_Big>> {
+ cir.func @addr_sret() -> !cir.ptr<!cir.func<(!s32i) -> !rec_Big>> requires_call_conv_lowering {
%0 = cir.get_global @make_big : !cir.ptr<!cir.func<(!s32i) -> !rec_Big>>
cir.return %0 : !cir.ptr<!cir.func<(!s32i) -> !rec_Big>>
}
@@ -36,7 +36,7 @@ module attributes {
// An 8-byte return is coerced to a single register, which changes the return
// type rather than adding a parameter.
- cir.func @addr_coerced_return() -> !cir.ptr<!cir.func<(!s32i) -> !rec_Pair2>> {
+ cir.func @addr_coerced_return() -> !cir.ptr<!cir.func<(!s32i) -> !rec_Pair2>> requires_call_conv_lowering {
%0 = cir.get_global @make_pair : !cir.ptr<!cir.func<(!s32i) -> !rec_Pair2>>
cir.return %0 : !cir.ptr<!cir.func<(!s32i) -> !rec_Pair2>>
}
@@ -47,7 +47,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[C]] : !cir.ptr<!cir.func<(!s32i) -> !rec_Pair2>>
// A rewrite on the argument side reaches the address the same way.
- cir.func @addr_byval_arg() -> !cir.ptr<!cir.func<(!rec_Big)>> {
+ cir.func @addr_byval_arg() -> !cir.ptr<!cir.func<(!rec_Big)>> requires_call_conv_lowering {
%0 = cir.get_global @take_big : !cir.ptr<!cir.func<(!rec_Big)>>
cir.return %0 : !cir.ptr<!cir.func<(!rec_Big)>>
}
@@ -59,7 +59,7 @@ module attributes {
// Extend is carried by an argument attribute and leaves the function type
// alone, so the address needs no cast.
- cir.func @addr_extend_only() -> !cir.ptr<!cir.func<(!s8i)>> {
+ cir.func @addr_extend_only() -> !cir.ptr<!cir.func<(!s8i)>> requires_call_conv_lowering {
%0 = cir.get_global @take_char : !cir.ptr<!cir.func<(!s8i)>>
cir.return %0 : !cir.ptr<!cir.func<(!s8i)>>
}
@@ -69,7 +69,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[G]] : !cir.ptr<!cir.func<(!s8i)>>
// A signature the ABI passes as written keeps its address type.
- cir.func @addr_unrewritten() -> !cir.ptr<!cir.func<(!s32i) -> !s32i>> {
+ cir.func @addr_unrewritten() -> !cir.ptr<!cir.func<(!s32i) -> !s32i>> requires_call_conv_lowering {
%0 = cir.get_global @plain : !cir.ptr<!cir.func<(!s32i) -> !s32i>>
cir.return %0 : !cir.ptr<!cir.func<(!s32i) -> !s32i>>
}
@@ -79,7 +79,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[G]] : !cir.ptr<!cir.func<(!s32i) -> !s32i>>
// The address of a data global names no function at all.
- cir.func @addr_data() -> !cir.ptr<!s32i> {
+ cir.func @addr_data() -> !cir.ptr<!s32i> requires_call_conv_lowering {
%0 = cir.get_global @data : !cir.ptr<!s32i>
cir.return %0 : !cir.ptr<!s32i>
}
@@ -91,7 +91,7 @@ module attributes {
// The address can also be the callee of an indirect call. It is retyped
// with its callee's rewrite, and the indirect-call rewrite that runs later
// casts it back to the coerced signature it calls through.
- cir.func @call_through_address(%arg0: !s32i, %arg1: !cir.ptr<!rec_Big>) {
+ cir.func @call_through_address(%arg0: !s32i, %arg1: !cir.ptr<!rec_Big>) requires_call_conv_lowering {
%0 = cir.get_global @make_big : !cir.ptr<!cir.func<(!s32i) -> !rec_Big>>
%1 = cir.call %0(%arg0) : (!cir.ptr<!cir.func<(!s32i) -> !rec_Big>>, !s32i) -> !rec_Big
cir.store %1, %arg1 : !rec_Big, !cir.ptr<!rec_Big>
@@ -107,7 +107,7 @@ module attributes {
// A direct call and an address of the same callee are rewritten in one
// iteration, the call first. The sret path there reuses a dominating store
// and erases it, so the address must survive that.
- cir.func @call_and_address(%arg0: !cir.ptr<!rec_Big>) -> !cir.ptr<!cir.func<(!s32i) -> !rec_Big>> {
+ cir.func @call_and_address(%arg0: !cir.ptr<!rec_Big>) -> !cir.ptr<!cir.func<(!s32i) -> !rec_Big>> requires_call_conv_lowering {
%0 = cir.const #cir.int<7> : !s32i
%1 = cir.call @make_big(%0) : (!s32i) -> !rec_Big
cir.store %1, %arg0 : !rec_Big, !cir.ptr<!rec_Big>
@@ -123,7 +123,7 @@ module attributes {
// An address nothing reads still has to be retyped, since the verifier ties
// it to the callee, but it needs no cast back.
- cir.func @unused_address() {
+ cir.func @unused_address() requires_call_conv_lowering {
%0 = cir.get_global @make_big : !cir.ptr<!cir.func<(!s32i) -> !rec_Big>>
cir.return
}
@@ -134,7 +134,7 @@ module attributes {
// An empty record argument the ABI ignores leaves the signature shorter, so
// the address changes type by losing a parameter rather than coercing one.
- cir.func @addr_ignored_arg() -> !cir.ptr<!cir.func<(!rec_E0)>> {
+ cir.func @addr_ignored_arg() -> !cir.ptr<!cir.func<(!rec_E0)>> requires_call_conv_lowering {
%0 = cir.get_global @take_empty : !cir.ptr<!cir.func<(!rec_E0)>>
cir.return %0 : !cir.ptr<!cir.func<(!rec_E0)>>
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-incomplete-record-declaration.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-incomplete-record-declaration.cir
index 1710ab95670591..1cd7377b845ab3 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-incomplete-record-declaration.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-incomplete-record-declaration.cir
@@ -16,35 +16,35 @@ module attributes {
// eightbyte classification, but nothing here ever completes Incomplete
// either, so no call or definition of this exact signature can arise
// anywhere. Left unclassified and unrewritten.
- cir.func private @take_incomplete(!rec_Incomplete)
+ cir.func private @take_incomplete(!rec_Incomplete) requires_call_conv_lowering
// CHECK: cir.func private @take_incomplete(!rec_Incomplete)
// Same reasoning for an incomplete-by-value return type.
- cir.func private @make_incomplete() -> !rec_Incomplete
+ cir.func private @make_incomplete() -> !rec_Incomplete requires_call_conv_lowering
// CHECK: cir.func private @make_incomplete() -> !rec_Incomplete
// The reject propagates through an enclosing struct and through an array
// element, the same as any other unsupported member.
- cir.func private @take_wrapped(!rec_Wraps)
+ cir.func private @take_wrapped(!rec_Wraps) requires_call_conv_lowering
// CHECK: cir.func private @take_wrapped(!rec_Wraps)
- cir.func private @take_incomplete_array(!cir.array<!rec_Incomplete x 4>)
+ cir.func private @take_incomplete_array(!cir.array<!rec_Incomplete x 4>) requires_call_conv_lowering
// CHECK: cir.func private @take_incomplete_array(!cir.array<!rec_Incomplete x 4>)
// A classifiable function sharing the module with an unclassifiable
// declaration is still rewritten: skipping one function must not abort
// the whole pass the way a hard NYI error would.
- cir.func @take_pair(%arg0: !rec_Pair) {
+ cir.func @take_pair(%arg0: !rec_Pair) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_pair(%arg0: !u64i)
- cir.func @call_pair(%arg0: !rec_Pair) {
+ cir.func @call_pair(%arg0: !rec_Pair) requires_call_conv_lowering {
cir.call @take_pair(%arg0) : (!rec_Pair) -> ()
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call-nyi.cir
index ff69168b87c5f2..fa181c4040c623 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call-nyi.cir
@@ -16,7 +16,7 @@ module attributes {
// carry its wire form. CIRABIRewriteContext cannot rebuild a cir.try_call,
// so it is reported.
cir.func @needs_rewrite(%arg0: !cir.ptr<!cir.func<(!s8i) -> !s32i>>,
- %arg1: !s8i) {
+ %arg1: !s8i) requires_call_conv_lowering {
%0 = cir.try_call %arg0(%arg1) ^bb1, ^bb2
: (!cir.ptr<!cir.func<(!s8i) -> !s32i>>, !s8i) -> !s32i
^bb1:
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call.cir
index 75e9c9d69c8302..28d99c608fd192 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call.cir
@@ -14,7 +14,7 @@ module attributes {
// Scalars already carry their wire form, so the call stands as written.
cir.func @pass_through(%arg0: !cir.ptr<!cir.func<(!s32i) -> !s32i>>,
- %arg1: !s32i) {
+ %arg1: !s32i) requires_call_conv_lowering {
%0 = cir.try_call %arg0(%arg1) ^bb1, ^bb2
: (!cir.ptr<!cir.func<(!s32i) -> !s32i>>, !s32i) -> !s32i
^bb1:
@@ -39,7 +39,7 @@ module attributes {
// and a void return is its own wire form, so this call stands as written
// too.
cir.func @variadic_void(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...)>>,
- %arg1: !cir.ptr<!s8i>) {
+ %arg1: !cir.ptr<!s8i>) requires_call_conv_lowering {
cir.try_call %arg0(%arg1) ^bb1, ^bb2
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...)>>, !cir.ptr<!s8i>) -> ()
^bb1:
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-variadic.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-variadic.cir
index dbfd1938911c5e..6801677e15e8f9 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-variadic.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-variadic.cir
@@ -30,7 +30,7 @@ module attributes {
// A one-eightbyte record at the ellipsis coerces to a single integer
// register and stays out of the callee pointer's function type.
cir.func @indirect_record(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !rec_Pair) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !rec_Pair) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !rec_Pair) -> !s32i
cir.return
@@ -46,7 +46,7 @@ module attributes {
// A memory-class record at the ellipsis goes byval, as it does for a direct
// variadic call.
cir.func @indirect_big(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !rec_Big) -> !s32i
cir.return
@@ -62,7 +62,7 @@ module attributes {
// A void return needs no rewrite, but the byval slot for the ellipsis
// argument still rewrites the call.
cir.func @indirect_big_void(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...)>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) requires_call_conv_lowering {
cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...)>>, !cir.ptr<!s8i>, !rec_Big) -> ()
cir.return
@@ -78,7 +78,7 @@ module attributes {
// An integer narrower than int is extended at the ellipsis of an indirect
// call just as it is for a direct one.
cir.func @indirect_narrow(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !s8i) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !s8i) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !s8i) -> !s32i
cir.return
@@ -94,7 +94,7 @@ module attributes {
// An empty record at the ellipsis is dropped, and the argument behind it
// still stays out of the callee pointer's function type.
cir.func @indirect_empty(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !rec_E0, %arg3: !s32i) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !rec_E0, %arg3: !s32i) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2, %arg3)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !rec_E0, !s32i) -> !s32i
cir.return
@@ -110,7 +110,7 @@ module attributes {
// A two-eightbyte record at the ellipsis of an indirect call flattens to
// a register per eightbyte, the same as it does for a direct call.
cir.func @indirect_two_register(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !rec_Two) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !rec_Two) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !rec_Two) -> !s32i
cir.return
@@ -128,7 +128,7 @@ module attributes {
// The byval record and the Pair passed through the ellipsis stay out of it.
cir.func @indirect_sret_mixed(%arg0: !cir.ptr<!cir.func<(!rec_Pair, !rec_E0, ...) -> !rec_Big>>,
%arg1: !rec_Pair, %arg2: !rec_E0, %arg3: !rec_Big,
- %arg4: !rec_Pair, %arg5: !cir.ptr<!rec_Big>) {
+ %arg4: !rec_Pair, %arg5: !cir.ptr<!rec_Big>) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2, %arg3, %arg4)
: (!cir.ptr<!cir.func<(!rec_Pair, !rec_E0, ...) -> !rec_Big>>, !rec_Pair, !rec_E0, !rec_Big, !rec_Pair) -> !rec_Big
cir.store %0, %arg5 : !rec_Big, !cir.ptr<!rec_Big>
@@ -145,7 +145,7 @@ module attributes {
// A call through a pointee with no declared parameters passes every argument
// through the ellipsis, so the callee pointer keeps its type.
cir.func @indirect_no_declared(%arg0: !cir.ptr<!cir.func<(...) -> !s32i>>,
- %arg1: !rec_Pair, %arg2: !rec_Big) {
+ %arg1: !rec_Pair, %arg2: !rec_Big) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(...) -> !s32i>>, !rec_Pair, !rec_Big) -> !s32i
cir.return
@@ -162,7 +162,7 @@ module attributes {
// caller's storage. The declared one retypes the callee pointer, and the one
// passed through the ellipsis stays out of its function type, as does the
// byval record.
- cir.func @indirect_noregs(%arg0: !cir.ptr<!cir.func<(!rec_NoRegs, ...)>>, %arg1: !rec_Big) {
+ cir.func @indirect_noregs(%arg0: !cir.ptr<!cir.func<(!rec_NoRegs, ...)>>, %arg1: !rec_Big) requires_call_conv_lowering {
%0 = cir.alloca "x" align(4) : !cir.ptr<!rec_NoRegs>
%1 = cir.alloca "y" align(4) : !cir.ptr<!rec_NoRegs>
%2 = cir.load %0 : !cir.ptr<!rec_NoRegs>, !rec_NoRegs
@@ -185,14 +185,14 @@ module attributes {
// recorded effects widen to cover it. A scalar there hands over no memory,
// and the effects stay as written.
cir.func @indirect_big_none(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2) {memory_effects = #none}
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !rec_Big) -> !s32i
cir.return
}
cir.func @indirect_scalar_none(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !s32i) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !s32i) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2) {memory_effects = #none}
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !s32i) -> !s32i
cir.return
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-int-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-int-nyi.cir
index aeeedeba4db219..2e02e08f19b4c0 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-int-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-int-nyi.cir
@@ -11,7 +11,7 @@ module attributes {
// A non-bitint integer of intermediate width (65..127) is rejected: only
// widths up to 64 and exactly 128 are accepted.
- cir.func @take_i96(%arg0: !i96) {
+ cir.func @take_i96(%arg0: !i96) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-lang-addrspace-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-lang-addrspace-nyi.cir
index 285df67e53c838..752a1743906ce3 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-lang-addrspace-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-lang-addrspace-nyi.cir
@@ -9,7 +9,7 @@ module attributes {
} {
cir.func @lang_addrspace_ptr(
- %arg0: !cir.ptr<!s32i, lang_address_space(offload_global)>) {
+ %arg0: !cir.ptr<!s32i, lang_address_space(offload_global)>) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-copy.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-copy.cir
index 6dc6fdd82d71ae..d8b0da32df1dd9 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-copy.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-copy.cir
@@ -53,25 +53,25 @@ module attributes {
// Each callee is rewritten with its call sites in declaration order, so
// these call sites are rewritten before any definition below.
- cir.func private @take_x87(!rec_UX87)
- cir.func private @make_x87() -> !rec_UX87
- cir.func private @take_h(!rec_H)
- cir.func private @make_h() -> !rec_H
- cir.func private @take_s(!rec_S)
- cir.func private @make_s() -> !rec_S
- cir.func private @take_sf(!rec_SF)
- cir.func private @make_sf() -> !rec_SF
- cir.func private @take_s12(!rec_S12)
- cir.func private @take_s16(!rec_S16)
- cir.func private @take_u3(!rec_U3)
- cir.func private @take_x87mem(!rec_UX87Mem)
- cir.func private @make_x87mem() -> !rec_UX87Mem
- cir.func private @take_hmem(!rec_HMem)
- cir.func private @make_hmem() -> !rec_HMem
- cir.func private @take_smem(!rec_SMem)
- cir.func private @make_smem() -> !rec_SMem
- cir.func private @make_tp() -> !rec_TP
- cir.func private @make_tpmem() -> !rec_TPMem
+ cir.func private @take_x87(!rec_UX87) requires_call_conv_lowering
+ cir.func private @make_x87() -> !rec_UX87 requires_call_conv_lowering
+ cir.func private @take_h(!rec_H) requires_call_conv_lowering
+ cir.func private @make_h() -> !rec_H requires_call_conv_lowering
+ cir.func private @take_s(!rec_S) requires_call_conv_lowering
+ cir.func private @make_s() -> !rec_S requires_call_conv_lowering
+ cir.func private @take_sf(!rec_SF) requires_call_conv_lowering
+ cir.func private @make_sf() -> !rec_SF requires_call_conv_lowering
+ cir.func private @take_s12(!rec_S12) requires_call_conv_lowering
+ cir.func private @take_s16(!rec_S16) requires_call_conv_lowering
+ cir.func private @take_u3(!rec_U3) requires_call_conv_lowering
+ cir.func private @take_x87mem(!rec_UX87Mem) requires_call_conv_lowering
+ cir.func private @make_x87mem() -> !rec_UX87Mem requires_call_conv_lowering
+ cir.func private @take_hmem(!rec_HMem) requires_call_conv_lowering
+ cir.func private @make_hmem() -> !rec_HMem requires_call_conv_lowering
+ cir.func private @take_smem(!rec_SMem) requires_call_conv_lowering
+ cir.func private @make_smem() -> !rec_SMem requires_call_conv_lowering
+ cir.func private @make_tp() -> !rec_TP requires_call_conv_lowering
+ cir.func private @make_tpmem() -> !rec_TPMem requires_call_conv_lowering
// CHECK: cir.func private @take_x87(!u64i, !u64i)
// CHECK: cir.func private @make_x87() -> ![[PAIR]]
@@ -94,7 +94,7 @@ module attributes {
// CHECK: cir.func private @make_tpmem(!cir.ptr<!rec_TPMem> {llvm.align = 8 : i64, llvm.dead_on_unwind, llvm.sret = !rec_TPMem, llvm.writable})
// A spilled parameter is copied out of its coercion slot.
- cir.func @param_spill_x87(%arg0: !rec_UX87) {
+ cir.func @param_spill_x87(%arg0: !rec_UX87) requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87>
cir.store %arg0, %0 : !rec_UX87, !cir.ptr<!rec_UX87>
cir.return
@@ -111,7 +111,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(16) to %[[SPILL]] align(16) : !cir.ptr<!rec_UX87>
// CHECK-NEXT: cir.return
- cir.func @param_spill_h(%arg0: !rec_H) {
+ cir.func @param_spill_h(%arg0: !rec_H) requires_call_conv_lowering {
%0 = cir.alloca "h" align(4) : !cir.ptr<!rec_H>
cir.store %arg0, %0 : !rec_H, !cir.ptr<!rec_H>
cir.return
@@ -125,7 +125,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(8) to %[[SPILL]] align(4) : !cir.ptr<!rec_H>
// CHECK-NEXT: cir.return
- cir.func @param_spill_s(%arg0: !rec_S) {
+ cir.func @param_spill_s(%arg0: !rec_S) requires_call_conv_lowering {
%0 = cir.alloca "s" align(4) : !cir.ptr<!rec_S>
cir.store %arg0, %0 : !rec_S, !cir.ptr<!rec_S>
cir.return
@@ -139,7 +139,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(8) to %[[SPILL]] align(4) : !cir.ptr<!rec_S>
// CHECK-NEXT: cir.return
- cir.func @param_spill_sf(%arg0: !rec_SF) {
+ cir.func @param_spill_sf(%arg0: !rec_SF) requires_call_conv_lowering {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_SF>
cir.store %arg0, %0 : !rec_SF, !cir.ptr<!rec_SF>
cir.return
@@ -157,7 +157,7 @@ module attributes {
// CHECK-NEXT: cir.return
// An unused parameter still fills its slot and nothing reads it.
- cir.func @param_unused_x87(%arg0: !rec_UX87) {
+ cir.func @param_unused_x87(%arg0: !rec_UX87) requires_call_conv_lowering {
cir.return
}
@@ -170,7 +170,7 @@ module attributes {
// CHECK-NEXT: cir.cast bitcast %[[SLOT]] : !cir.ptr<![[PAIR]]> -> !cir.ptr<!rec_UX87>
// CHECK-NEXT: cir.return
- cir.func @param_unused_h(%arg0: !rec_H) {
+ cir.func @param_unused_h(%arg0: !rec_H) requires_call_conv_lowering {
cir.return
}
@@ -180,7 +180,7 @@ module attributes {
// CHECK-NEXT: cir.cast bitcast %[[SLOT]] : !cir.ptr<!u64i> -> !cir.ptr<!rec_H>
// CHECK-NEXT: cir.return
- cir.func @param_unused_s(%arg0: !rec_S) {
+ cir.func @param_unused_s(%arg0: !rec_S) requires_call_conv_lowering {
cir.return
}
@@ -192,7 +192,7 @@ module attributes {
// The call is rewritten first and stores the parameter into an argument
// slot. The parameter's rewrite turns that store into a copy.
- cir.func @param_forward_x87(%arg0: !rec_UX87) {
+ cir.func @param_forward_x87(%arg0: !rec_UX87) requires_call_conv_lowering {
cir.call @take_x87(%arg0) : (!rec_UX87) -> ()
cir.return
}
@@ -209,7 +209,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_x87(%[[LO]], %[[HI]]) : (!u64i, !u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @param_forward_h(%arg0: !rec_H) {
+ cir.func @param_forward_h(%arg0: !rec_H) requires_call_conv_lowering {
cir.call @take_h(%arg0) : (!rec_H) -> ()
cir.return
}
@@ -223,7 +223,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_h(%[[V]]) : (!u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @param_forward_sf(%arg0: !rec_SF) {
+ cir.func @param_forward_sf(%arg0: !rec_SF) requires_call_conv_lowering {
cir.call @take_sf(%arg0) : (!rec_SF) -> ()
cir.return
}
@@ -241,7 +241,7 @@ module attributes {
// CHECK-NEXT: cir.return
// A returned parameter is read in place out of its own coercion slot.
- cir.func @param_return_x87(%arg0: !rec_UX87) -> !rec_UX87 {
+ cir.func @param_return_x87(%arg0: !rec_UX87) -> !rec_UX87 requires_call_conv_lowering {
cir.return %arg0 : !rec_UX87
}
@@ -252,7 +252,7 @@ module attributes {
// CHECK-NEXT: %[[RET:.*]] = cir.load align(16) %[[RVIEW]] : !cir.ptr<![[PAIR]]>, ![[PAIR]]
// CHECK-NEXT: cir.return %[[RET]] : ![[PAIR]]
- cir.func @param_return_h(%arg0: !rec_H) -> !rec_H {
+ cir.func @param_return_h(%arg0: !rec_H) -> !rec_H requires_call_conv_lowering {
cir.return %arg0 : !rec_H
}
@@ -264,7 +264,7 @@ module attributes {
// CHECK-NEXT: %[[RET:.*]] = cir.load align(8) %[[RVIEW]] : !cir.ptr<!u64i>, !u64i
// CHECK-NEXT: cir.return %[[RET]] : !u64i
- cir.func @param_return_sf(%arg0: !rec_SF) -> !rec_SF {
+ cir.func @param_return_sf(%arg0: !rec_SF) -> !rec_SF requires_call_conv_lowering {
cir.return %arg0 : !rec_SF
}
@@ -275,7 +275,7 @@ module attributes {
// CHECK-NEXT: %[[RET:.*]] = cir.load align(8) %[[RVIEW]] : !cir.ptr<![[SFPAIR]]>, ![[SFPAIR]]
// CHECK-NEXT: cir.return %[[RET]] : ![[SFPAIR]]
- cir.func @ret_local_x87() -> !rec_UX87 {
+ cir.func @ret_local_x87() -> !rec_UX87 requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87>
%1 = cir.load %0 : !cir.ptr<!rec_UX87>, !rec_UX87
cir.return %1 : !rec_UX87
@@ -288,7 +288,7 @@ module attributes {
// CHECK-NEXT: %[[RET:.*]] = cir.load align(16) %[[RVIEW]] : !cir.ptr<![[PAIR]]>, ![[PAIR]]
// CHECK-NEXT: cir.return %[[RET]] : ![[PAIR]]
- cir.func @ret_local_h() -> !rec_H {
+ cir.func @ret_local_h() -> !rec_H requires_call_conv_lowering {
%0 = cir.alloca "h" align(4) : !cir.ptr<!rec_H>
%1 = cir.load %0 : !cir.ptr<!rec_H>, !rec_H
cir.return %1 : !rec_H
@@ -301,7 +301,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[RET]] : !u64i
// An argument loaded from an alloca is read in place.
- cir.func @call_inplace_x87() {
+ cir.func @call_inplace_x87() requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87>
%1 = cir.load %0 : !cir.ptr<!rec_UX87>, !rec_UX87
cir.call @take_x87(%1) : (!rec_UX87) -> ()
@@ -318,7 +318,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_x87(%[[LO]], %[[HI]]) : (!u64i, !u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @call_inplace_h() {
+ cir.func @call_inplace_h() requires_call_conv_lowering {
%0 = cir.alloca "h" align(4) : !cir.ptr<!rec_H>
%1 = cir.load %0 : !cir.ptr<!rec_H>, !rec_H
cir.call @take_h(%1) : (!rec_H) -> ()
@@ -332,7 +332,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_h(%[[V]]) : (!u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @call_inplace_s() {
+ cir.func @call_inplace_s() requires_call_conv_lowering {
%0 = cir.alloca "s" align(4) : !cir.ptr<!rec_S>
%1 = cir.load %0 : !cir.ptr<!rec_S>, !rec_S
cir.call @take_s(%1) : (!rec_S) -> ()
@@ -346,7 +346,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_s(%[[V]]) : (!u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @call_inplace_sf() {
+ cir.func @call_inplace_sf() requires_call_conv_lowering {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_SF>
%1 = cir.load %0 : !cir.ptr<!rec_SF>, !rec_SF
cir.call @take_sf(%1) : (!rec_SF) -> ()
@@ -364,7 +364,7 @@ module attributes {
// CHECK-NEXT: cir.return
// Each field is read at the alignment the alloca guarantees at its offset.
- cir.func @call_inplace_s16() {
+ cir.func @call_inplace_s16() requires_call_conv_lowering {
%0 = cir.alloca "s" align(4) : !cir.ptr<!rec_S16>
%1 = cir.load %0 : !cir.ptr<!rec_S16>, !rec_S16
cir.call @take_s16(%1) : (!rec_S16) -> ()
@@ -382,7 +382,7 @@ module attributes {
// CHECK-NEXT: cir.return
// Storage that is not an alloca is copied into a slot first.
- cir.func @call_copied_x87(%arg0: !cir.ptr<!rec_UX87>) {
+ cir.func @call_copied_x87(%arg0: !cir.ptr<!rec_UX87>) requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_UX87>, !rec_UX87
cir.call @take_x87(%0) : (!rec_UX87) -> ()
cir.return
@@ -399,7 +399,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_x87(%[[LO]], %[[HI]]) : (!u64i, !u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @call_copied_h(%arg0: !cir.ptr<!rec_H>) {
+ cir.func @call_copied_h(%arg0: !cir.ptr<!rec_H>) requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_H>, !rec_H
cir.call @take_h(%0) : (!rec_H) -> ()
cir.return
@@ -415,7 +415,7 @@ module attributes {
// The coerced type is larger than the record, so the alloca is copied
// into a slot that holds both.
- cir.func @call_small_u3() {
+ cir.func @call_small_u3() requires_call_conv_lowering {
%0 = cir.alloca "u" align(1) : !cir.ptr<!rec_U3>
%1 = cir.load %0 : !cir.ptr<!rec_U3>, !rec_U3
cir.call @take_u3(%1) : (!rec_U3) -> ()
@@ -431,7 +431,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_u3(%[[V]]) : (!cir.int<u, 24>) -> ()
// CHECK-NEXT: cir.return
- cir.func @call_small_s12() {
+ cir.func @call_small_s12() requires_call_conv_lowering {
%0 = cir.alloca "s" align(4) : !cir.ptr<!rec_S12>
%1 = cir.load %0 : !cir.ptr<!rec_S12>, !rec_S12
cir.call @take_s12(%1) : (!rec_S12) -> ()
@@ -451,7 +451,7 @@ module attributes {
// CHECK-NEXT: cir.return
// A stored call result is copied out of its return slot.
- cir.func @result_store_x87() {
+ cir.func @result_store_x87() requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87>
%1 = cir.call @make_x87() : () -> !rec_UX87
cir.store %1, %0 : !rec_UX87, !cir.ptr<!rec_UX87>
@@ -467,7 +467,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(16) to %[[U]] align(16) : !cir.ptr<!rec_UX87>
// CHECK-NEXT: cir.return
- cir.func @result_store_h() {
+ cir.func @result_store_h() requires_call_conv_lowering {
%0 = cir.alloca "h" align(4) : !cir.ptr<!rec_H>
%1 = cir.call @make_h() : () -> !rec_H
cir.store %1, %0 : !rec_H, !cir.ptr<!rec_H>
@@ -483,7 +483,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(8) to %[[H]] align(4) : !cir.ptr<!rec_H>
// CHECK-NEXT: cir.return
- cir.func @result_store_s() {
+ cir.func @result_store_s() requires_call_conv_lowering {
%0 = cir.alloca "s" align(4) : !cir.ptr<!rec_S>
%1 = cir.call @make_s() : () -> !rec_S
cir.store %1, %0 : !rec_S, !cir.ptr<!rec_S>
@@ -499,7 +499,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(8) to %[[S]] align(4) : !cir.ptr<!rec_S>
// CHECK-NEXT: cir.return
- cir.func @result_store_sf() {
+ cir.func @result_store_sf() requires_call_conv_lowering {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_SF>
%1 = cir.call @make_sf() : () -> !rec_SF
cir.store %1, %0 : !rec_SF, !cir.ptr<!rec_SF>
@@ -516,7 +516,7 @@ module attributes {
// CHECK-NEXT: cir.return
// A store into an array element is a copy into that element.
- cir.func @result_stride_x87(%arg0: !cir.ptr<!rec_UX87>) {
+ cir.func @result_stride_x87(%arg0: !cir.ptr<!rec_UX87>) requires_call_conv_lowering {
%0 = cir.const #cir.int<3> : !s64i
%1 = cir.ptr_stride %arg0, %0 : (!cir.ptr<!rec_UX87>, !s64i) -> !cir.ptr<!rec_UX87>
%2 = cir.call @make_x87() : () -> !rec_UX87
@@ -534,7 +534,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(16) to %[[ELT]] align(16) : !cir.ptr<!rec_UX87>
// CHECK-NEXT: cir.return
- cir.func @result_stride_h(%arg0: !cir.ptr<!rec_H>) {
+ cir.func @result_stride_h(%arg0: !cir.ptr<!rec_H>) requires_call_conv_lowering {
%0 = cir.const #cir.int<3> : !s64i
%1 = cir.ptr_stride %arg0, %0 : (!cir.ptr<!rec_H>, !s64i) -> !cir.ptr<!rec_H>
%2 = cir.call @make_h() : () -> !rec_H
@@ -554,7 +554,7 @@ module attributes {
// The consumer is rewritten first and stores the result into an argument
// slot. The producer's rewrite turns that store into a copy.
- cir.func @result_feed_x87() {
+ cir.func @result_feed_x87() requires_call_conv_lowering {
%0 = cir.call @make_x87() : () -> !rec_UX87
cir.call @take_x87(%0) : (!rec_UX87) -> ()
cir.return
@@ -575,7 +575,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_x87(%[[LO]], %[[HI]]) : (!u64i, !u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @result_feed_h() {
+ cir.func @result_feed_h() requires_call_conv_lowering {
%0 = cir.call @make_h() : () -> !rec_H
cir.call @take_h(%0) : (!rec_H) -> ()
cir.return
@@ -594,7 +594,7 @@ module attributes {
// CHECK-NEXT: cir.return
// The producer is rewritten first, so the return reads its slot in place.
- cir.func @result_return_x87() -> !rec_UX87 {
+ cir.func @result_return_x87() -> !rec_UX87 requires_call_conv_lowering {
%0 = cir.call @make_x87() : () -> !rec_UX87
cir.return %0 : !rec_UX87
}
@@ -609,7 +609,7 @@ module attributes {
// CHECK-NEXT: %[[RET:.*]] = cir.load align(16) %[[RVIEW]] : !cir.ptr<![[PAIR]]>, ![[PAIR]]
// CHECK-NEXT: cir.return %[[RET]] : ![[PAIR]]
- cir.func @result_return_h() -> !rec_H {
+ cir.func @result_return_h() -> !rec_H requires_call_conv_lowering {
%0 = cir.call @make_h() : () -> !rec_H
cir.return %0 : !rec_H
}
@@ -624,7 +624,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[RET]] : !u64i
// A volatile store becomes a volatile copy.
- cir.func @result_volatile_x87(%arg0: !cir.ptr<!rec_UX87>) {
+ cir.func @result_volatile_x87(%arg0: !cir.ptr<!rec_UX87>) requires_call_conv_lowering {
%0 = cir.call @make_x87() : () -> !rec_UX87
cir.store volatile align(16) %0, %arg0 : !rec_UX87, !cir.ptr<!rec_UX87>
cir.return
@@ -638,7 +638,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(16) to %arg0 align(16) volatile : !cir.ptr<!rec_UX87>
// CHECK-NEXT: cir.return
- cir.func @result_volatile_h(%arg0: !cir.ptr<!rec_H>) {
+ cir.func @result_volatile_h(%arg0: !cir.ptr<!rec_H>) requires_call_conv_lowering {
%0 = cir.call @make_h() : () -> !rec_H
cir.store volatile %0, %arg0 : !rec_H, !cir.ptr<!rec_H>
cir.return
@@ -654,7 +654,7 @@ module attributes {
// A result whose destination is loaded after the call is copied out of a
// return slot of its own.
- cir.func @sret_nodom_x87mem(%arg0: !cir.ptr<!cir.ptr<!rec_UX87Mem>>) {
+ cir.func @sret_nodom_x87mem(%arg0: !cir.ptr<!cir.ptr<!rec_UX87Mem>>) requires_call_conv_lowering {
%0 = cir.call @make_x87mem() : () -> !rec_UX87Mem
%1 = cir.load %arg0 : !cir.ptr<!cir.ptr<!rec_UX87Mem>>, !cir.ptr<!rec_UX87Mem>
cir.store %0, %1 : !rec_UX87Mem, !cir.ptr<!rec_UX87Mem>
@@ -668,7 +668,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[SRET]] align(16) to %[[DEST]] align(16) : !cir.ptr<!rec_UX87Mem>
// CHECK-NEXT: cir.return
- cir.func @sret_nodom_hmem(%arg0: !cir.ptr<!cir.ptr<!rec_HMem>>) {
+ cir.func @sret_nodom_hmem(%arg0: !cir.ptr<!cir.ptr<!rec_HMem>>) requires_call_conv_lowering {
%0 = cir.call @make_hmem() : () -> !rec_HMem
%1 = cir.load %arg0 : !cir.ptr<!cir.ptr<!rec_HMem>>, !cir.ptr<!rec_HMem>
cir.store %0, %1 : !rec_HMem, !cir.ptr<!rec_HMem>
@@ -682,7 +682,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[SRET]] align(8) to %[[DEST]] align(8) : !cir.ptr<!rec_HMem>
// CHECK-NEXT: cir.return
- cir.func @sret_nodom_smem(%arg0: !cir.ptr<!cir.ptr<!rec_SMem>>) {
+ cir.func @sret_nodom_smem(%arg0: !cir.ptr<!cir.ptr<!rec_SMem>>) requires_call_conv_lowering {
%0 = cir.call @make_smem() : () -> !rec_SMem
%1 = cir.load %arg0 : !cir.ptr<!cir.ptr<!rec_SMem>>, !cir.ptr<!rec_SMem>
cir.store %0, %1 : !rec_SMem, !cir.ptr<!rec_SMem>
@@ -697,7 +697,7 @@ module attributes {
// CHECK-NEXT: cir.return
// A local is a complete object, so the copy into it takes the whole record.
- cir.func @tp_store_local() {
+ cir.func @tp_store_local() requires_call_conv_lowering {
%0 = cir.alloca "t" align(4) : !cir.ptr<!rec_TP>
%1 = cir.call @make_tp() : () -> !rec_TP
cir.store %1, %0 : !rec_TP, !cir.ptr<!rec_TP>
@@ -715,7 +715,7 @@ module attributes {
// Any other destination may be a subobject whose tail padding holds
// another object, so the copy stops at the data size.
- cir.func @tp_store_ptr(%arg0: !cir.ptr<!rec_TP>) {
+ cir.func @tp_store_ptr(%arg0: !cir.ptr<!rec_TP>) requires_call_conv_lowering {
%0 = cir.call @make_tp() : () -> !rec_TP
cir.store %0, %arg0 : !rec_TP, !cir.ptr<!rec_TP>
cir.return
@@ -729,7 +729,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(8) to %arg0 align(4) skip_tail_padding : !cir.ptr<!rec_TP>
// CHECK-NEXT: cir.return
- cir.func @sret_nodom_tpmem(%arg0: !cir.ptr<!cir.ptr<!rec_TPMem>>) {
+ cir.func @sret_nodom_tpmem(%arg0: !cir.ptr<!cir.ptr<!rec_TPMem>>) requires_call_conv_lowering {
%0 = cir.call @make_tpmem() : () -> !rec_TPMem
%1 = cir.load %arg0 : !cir.ptr<!cir.ptr<!rec_TPMem>>, !cir.ptr<!rec_TPMem>
cir.store %0, %1 : !rec_TPMem, !cir.ptr<!rec_TPMem>
@@ -745,7 +745,7 @@ module attributes {
// A record with a layout gap but no pad member has no tail padding, so the
// copy through a pointer takes the whole record.
- cir.func @sf_store_ptr(%arg0: !cir.ptr<!rec_SF>) {
+ cir.func @sf_store_ptr(%arg0: !cir.ptr<!rec_SF>) requires_call_conv_lowering {
%0 = cir.call @make_sf() : () -> !rec_SF
cir.store %0, %arg0 : !rec_SF, !cir.ptr<!rec_SF>
cir.return
@@ -759,7 +759,7 @@ module attributes {
// CHECK-NEXT: cir.copy %[[VIEW]] align(8) to %arg0 align(8) : !cir.ptr<!rec_SF>
// CHECK-NEXT: cir.return
- cir.func @tp_param_store_ptr(%arg0: !rec_TP, %arg1: !cir.ptr<!rec_TP>) {
+ cir.func @tp_param_store_ptr(%arg0: !rec_TP, %arg1: !cir.ptr<!rec_TP>) requires_call_conv_lowering {
cir.store %arg0, %arg1 : !rec_TP, !cir.ptr<!rec_TP>
cir.return
}
@@ -773,7 +773,7 @@ module attributes {
// The copy that replaces a byval parameter's only store keeps the store's
// alignment.
- cir.func @byval_tpmem_ptr(%arg0: !rec_TPMem, %arg1: !cir.ptr<!rec_TPMem>) {
+ cir.func @byval_tpmem_ptr(%arg0: !rec_TPMem, %arg1: !cir.ptr<!rec_TPMem>) requires_call_conv_lowering {
cir.store align(1) %arg0, %arg1 : !rec_TPMem, !cir.ptr<!rec_TPMem>
cir.return
}
@@ -784,7 +784,7 @@ module attributes {
// A byval parameter stored twice has no single spill, so each store is a
// copy from the incoming pointer.
- cir.func @byval_twice_x87mem(%arg0: !rec_UX87Mem, %arg1: !cir.ptr<!rec_UX87Mem>) {
+ cir.func @byval_twice_x87mem(%arg0: !rec_UX87Mem, %arg1: !cir.ptr<!rec_UX87Mem>) requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87Mem>
cir.store %arg0, %0 : !rec_UX87Mem, !cir.ptr<!rec_UX87Mem>
cir.store %arg0, %arg1 : !rec_UX87Mem, !cir.ptr<!rec_UX87Mem>
@@ -798,7 +798,7 @@ module attributes {
// CHECK-NEXT: cir.return
// A byval parameter handed straight on is copied into the callee's slot.
- cir.func @byval_forward_hmem(%arg0: !rec_HMem) {
+ cir.func @byval_forward_hmem(%arg0: !rec_HMem) requires_call_conv_lowering {
cir.call @take_hmem(%arg0) : (!rec_HMem) -> ()
cir.return
}
@@ -811,7 +811,7 @@ module attributes {
// The consumer is rewritten first and stores the sret result into its
// byval slot. The producer's rewrite turns that store into a copy.
- cir.func @byval_result_x87mem() {
+ cir.func @byval_result_x87mem() requires_call_conv_lowering {
%0 = cir.call @make_x87mem() : () -> !rec_UX87Mem
cir.call @take_x87mem(%0) : (!rec_UX87Mem) -> ()
cir.return
@@ -825,7 +825,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_x87mem(%[[BYVAL]]) : (!cir.ptr<!rec_UX87Mem> {llvm.align = 16 : i64, llvm.byval = !rec_UX87Mem, llvm.noundef}) -> ()
// CHECK-NEXT: cir.return
- cir.func @byval_result_hmem() {
+ cir.func @byval_result_hmem() requires_call_conv_lowering {
%0 = cir.call @make_hmem() : () -> !rec_HMem
cir.call @take_hmem(%0) : (!rec_HMem) -> ()
cir.return
@@ -843,7 +843,7 @@ module attributes {
// temp, and the fetched value is copied into the local. The second fetch
// feeds a call rewritten before it, whose argument slot store becomes a
// copy.
- cir.func @vaarg_x87(%arg0: !s32i, ...) {
+ cir.func @vaarg_x87(%arg0: !s32i, ...) requires_call_conv_lowering {
%0 = cir.alloca "ap" align(16) : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
%1 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87>
%2 = cir.cast array_to_ptrdecay %0 : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> -> !cir.ptr<!rec___va_list_tag>
@@ -876,7 +876,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_x87(%[[LO]], %[[HI]]) : (!u64i, !u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @vaarg_h(%arg0: !s32i, ...) {
+ cir.func @vaarg_h(%arg0: !s32i, ...) requires_call_conv_lowering {
%0 = cir.alloca "ap" align(16) : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
%1 = cir.alloca "h" align(4) : !cir.ptr<!rec_H>
%2 = cir.cast array_to_ptrdecay %0 : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> -> !cir.ptr<!rec___va_list_tag>
@@ -894,7 +894,7 @@ module attributes {
// A memory-class fetch reads the overflow area. The second one feeds a
// byval slot, filled by a copy.
- cir.func @vaarg_x87mem(%arg0: !s32i, ...) {
+ cir.func @vaarg_x87mem(%arg0: !s32i, ...) requires_call_conv_lowering {
%0 = cir.alloca "ap" align(16) : !cir.ptr<!cir.array<!rec___va_list_tag x 1>>
%1 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87Mem>
%2 = cir.cast array_to_ptrdecay %0 : !cir.ptr<!cir.array<!rec___va_list_tag x 1>> -> !cir.ptr<!rec___va_list_tag>
@@ -919,7 +919,7 @@ module attributes {
// The producer is rewritten before the consumer, so the consumer reads the
// producer's slot in place.
- cir.func @param_forward_late_x87(%arg0: !rec_UX87) {
+ cir.func @param_forward_late_x87(%arg0: !rec_UX87) requires_call_conv_lowering {
cir.call @take_late_x87(%arg0) : (!rec_UX87) -> ()
cir.return
}
@@ -934,7 +934,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_late_x87(%[[LO]], %[[HI]]) : (!u64i, !u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @param_forward_late_h(%arg0: !rec_H) {
+ cir.func @param_forward_late_h(%arg0: !rec_H) requires_call_conv_lowering {
cir.call @take_late_h(%arg0) : (!rec_H) -> ()
cir.return
}
@@ -948,7 +948,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_late_h(%[[V]]) : (!u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @result_feed_late_x87() {
+ cir.func @result_feed_late_x87() requires_call_conv_lowering {
%0 = cir.call @make_x87() : () -> !rec_UX87
cir.call @take_late_x87(%0) : (!rec_UX87) -> ()
cir.return
@@ -967,7 +967,7 @@ module attributes {
// CHECK-NEXT: cir.call @take_late_x87(%[[LO]], %[[HI]]) : (!u64i, !u64i) -> ()
// CHECK-NEXT: cir.return
- cir.func @result_feed_late_h() {
+ cir.func @result_feed_late_h() requires_call_conv_lowering {
%0 = cir.call @make_h() : () -> !rec_H
cir.call @take_late_h(%0) : (!rec_H) -> ()
cir.return
@@ -984,7 +984,7 @@ module attributes {
// CHECK-NEXT: cir.return
// The sret slot is handed on as the byval argument.
- cir.func @byval_result_late_x87mem() {
+ cir.func @byval_result_late_x87mem() requires_call_conv_lowering {
%0 = cir.call @make_x87mem() : () -> !rec_UX87Mem
cir.call @take_late_x87mem(%0) : (!rec_UX87Mem) -> ()
cir.return
@@ -999,21 +999,21 @@ module attributes {
// The definition is rewritten before the producer, so the return stores
// the result into a slot and the producer's rewrite turns that store into
// a copy.
- cir.func @result_return_late_x87() -> !rec_UX87 {
+ cir.func @result_return_late_x87() -> !rec_UX87 requires_call_conv_lowering {
%0 = cir.call @make_late_x87() : () -> !rec_UX87
cir.return %0 : !rec_UX87
}
- cir.func @result_return_late_h() -> !rec_H {
+ cir.func @result_return_late_h() -> !rec_H requires_call_conv_lowering {
%0 = cir.call @make_late_h() : () -> !rec_H
cir.return %0 : !rec_H
}
- cir.func private @take_late_x87(!rec_UX87)
- cir.func private @take_late_h(!rec_H)
- cir.func private @take_late_x87mem(!rec_UX87Mem)
- cir.func private @make_late_x87() -> !rec_UX87
- cir.func private @make_late_h() -> !rec_H
+ cir.func private @take_late_x87(!rec_UX87) requires_call_conv_lowering
+ cir.func private @take_late_h(!rec_H) requires_call_conv_lowering
+ cir.func private @take_late_x87mem(!rec_UX87Mem) requires_call_conv_lowering
+ cir.func private @make_late_x87() -> !rec_UX87 requires_call_conv_lowering
+ cir.func private @make_late_h() -> !rec_H requires_call_conv_lowering
// CHECK-LABEL: cir.func @result_return_late_x87()
// CHECK-SAME: -> ![[PAIR]]
@@ -1046,7 +1046,7 @@ module attributes {
// A constant carries no bytes beyond its own value, so it is still stored
// into the argument slot by value.
- cir.func @const_feed_x87() {
+ cir.func @const_feed_x87() requires_call_conv_lowering {
%0 = cir.const #cir.zero : !rec_UX87
cir.call @take_x87(%0) : (!rec_UX87) -> ()
cir.return
@@ -1060,7 +1060,7 @@ module attributes {
// CHECK: cir.call @take_x87(%{{.*}}, %{{.*}}) : (!u64i, !u64i) -> ()
// MOVE: cir.store %{{.*}}, %{{.*}} : !rec_UX87, !cir.ptr<!rec_UX87>
- cir.func @const_feed_h() {
+ cir.func @const_feed_h() requires_call_conv_lowering {
%0 = cir.const #cir.zero : !rec_H
cir.call @take_h(%0) : (!rec_H) -> ()
cir.return
@@ -1076,7 +1076,7 @@ module attributes {
// MOVE-LABEL: cir.func @const_feed_h()
// MOVE: cir.store %{{.*}}, %{{.*}} : !rec_H, !cir.ptr<!rec_H>
- cir.func @const_feed_hmem() {
+ cir.func @const_feed_hmem() requires_call_conv_lowering {
%0 = cir.const #cir.zero : !rec_HMem
cir.call @take_hmem(%0) : (!rec_HMem) -> ()
cir.return
@@ -1091,7 +1091,7 @@ module attributes {
// MOVE: cir.store %{{.*}}, %{{.*}} : !rec_HMem, !cir.ptr<!rec_HMem>
// A member read reads the record back out of the result slot.
- cir.func @result_extract_s() -> !s32i {
+ cir.func @result_extract_s() -> !s32i requires_call_conv_lowering {
%0 = cir.call @make_s() : () -> !rec_S
%1 = cir.extract_member %0[1] : !rec_S -> !s32i
cir.return %1 : !s32i
@@ -1333,7 +1333,7 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func @atomic_store_param_h(%arg0: !rec_H, %arg1: !cir.ptr<!rec_H>) {
+ cir.func @atomic_store_param_h(%arg0: !rec_H, %arg1: !cir.ptr<!rec_H>) requires_call_conv_lowering {
// expected-error @below {{atomic store of a record argument or result not yet implemented in CallConvLowering}}
cir.store atomic(seq_cst) %arg0, %arg1 : !rec_H, !cir.ptr<!rec_H>
cir.return
@@ -1351,7 +1351,7 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func @atomic_store_flat_param_x87(%arg0: !rec_UX87, %arg1: !cir.ptr<!rec_UX87>) {
+ cir.func @atomic_store_flat_param_x87(%arg0: !rec_UX87, %arg1: !cir.ptr<!rec_UX87>) requires_call_conv_lowering {
// expected-error @below {{atomic store of a record argument or result not yet implemented in CallConvLowering}}
cir.store atomic(seq_cst) %arg0, %arg1 : !rec_UX87, !cir.ptr<!rec_UX87>
cir.return
@@ -1369,7 +1369,7 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func @atomic_store_byval_param(%arg0: !rec_UX87Mem, %arg1: !cir.ptr<!rec_UX87Mem>) {
+ cir.func @atomic_store_byval_param(%arg0: !rec_UX87Mem, %arg1: !cir.ptr<!rec_UX87Mem>) requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87Mem>
cir.store %arg0, %0 : !rec_UX87Mem, !cir.ptr<!rec_UX87Mem>
// expected-error @below {{atomic store of a record argument or result not yet implemented in CallConvLowering}}
@@ -1389,8 +1389,8 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @make_x87() -> !rec_UX87
- cir.func @atomic_store_result_x87(%arg0: !cir.ptr<!rec_UX87>) {
+ cir.func private @make_x87() -> !rec_UX87 requires_call_conv_lowering
+ cir.func @atomic_store_result_x87(%arg0: !cir.ptr<!rec_UX87>) requires_call_conv_lowering {
%0 = cir.call @make_x87() : () -> !rec_UX87
// expected-error @below {{atomic store of a record argument or result not yet implemented in CallConvLowering}}
cir.store atomic(seq_cst) %0, %arg0 : !rec_UX87, !cir.ptr<!rec_UX87>
@@ -1409,8 +1409,8 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @make_x87mem() -> !rec_UX87Mem
- cir.func @atomic_store_sret_x87mem(%arg0: !cir.ptr<!cir.ptr<!rec_UX87Mem>>) {
+ cir.func private @make_x87mem() -> !rec_UX87Mem requires_call_conv_lowering
+ cir.func @atomic_store_sret_x87mem(%arg0: !cir.ptr<!cir.ptr<!rec_UX87Mem>>) requires_call_conv_lowering {
%0 = cir.call @make_x87mem() : () -> !rec_UX87Mem
%1 = cir.load %arg0 : !cir.ptr<!cir.ptr<!rec_UX87Mem>>, !cir.ptr<!rec_UX87Mem>
// expected-error @below {{atomic store of a record argument or result not yet implemented in CallConvLowering}}
@@ -1435,7 +1435,7 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func @atomic_store_vaarg_h(%arg0: !cir.ptr<!rec___va_list_tag>, %arg1: !cir.ptr<!rec_H>) {
+ cir.func @atomic_store_vaarg_h(%arg0: !cir.ptr<!rec___va_list_tag>, %arg1: !cir.ptr<!rec_H>) requires_call_conv_lowering {
%0 = cir.va_arg %arg0 : (!cir.ptr<!rec___va_list_tag>) -> !rec_H
// expected-error @below {{atomic store of a record argument or result not yet implemented in CallConvLowering}}
cir.store atomic(seq_cst) %0, %arg1 : !rec_H, !cir.ptr<!rec_H>
@@ -1456,11 +1456,11 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @make_h() -> !rec_H
+ cir.func private @make_h() -> !rec_H requires_call_conv_lowering
// A call result consumed by anything but a store, call, return or member
// read would be loaded from its slot as a value.
- cir.func @result_yield_h(%arg0: !cir.bool, %arg1: !cir.ptr<!rec_H>) {
+ cir.func @result_yield_h(%arg0: !cir.bool, %arg1: !cir.ptr<!rec_H>) requires_call_conv_lowering {
%0 = cir.call @make_h() : () -> !rec_H
%1 = cir.ternary(%arg0, true {
// expected-error @below {{use of a record argument or result other than by a store, call, return or member read not yet implemented in CallConvLowering}}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-nyi.cir
index 94586dd26f4519..6f7d6074592c2b 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-nyi.cir
@@ -9,8 +9,8 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @take_s(!rec_S)
- cir.func @direct_atomic(%arg0: !cir.ptr<!rec_S>) {
+ cir.func private @take_s(!rec_S) requires_call_conv_lowering
+ cir.func @direct_atomic(%arg0: !cir.ptr<!rec_S>) requires_call_conv_lowering {
%0 = cir.load atomic(seq_cst) %arg0 : !cir.ptr<!rec_S>, !rec_S
// expected-error @below {{atomic load of a record operand not yet implemented in CallConvLowering}}
cir.call @take_s(%0) : (!rec_S) -> ()
@@ -30,8 +30,8 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @take_sf(!rec_SF)
- cir.func @flattened_atomic(%arg0: !cir.ptr<!rec_SF>) {
+ cir.func private @take_sf(!rec_SF) requires_call_conv_lowering
+ cir.func @flattened_atomic(%arg0: !cir.ptr<!rec_SF>) requires_call_conv_lowering {
%0 = cir.load atomic(seq_cst) %arg0 : !cir.ptr<!rec_SF>, !rec_SF
// expected-error @below {{atomic load of a record operand not yet implemented in CallConvLowering}}
cir.call @take_sf(%0) : (!rec_SF) -> ()
@@ -50,8 +50,8 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @take_smem(!rec_SMem)
- cir.func @byval_atomic(%arg0: !cir.ptr<!rec_SMem>) {
+ cir.func private @take_smem(!rec_SMem) requires_call_conv_lowering
+ cir.func @byval_atomic(%arg0: !cir.ptr<!rec_SMem>) requires_call_conv_lowering {
%0 = cir.load atomic(seq_cst) %arg0 : !cir.ptr<!rec_SMem>, !rec_SMem
// expected-error @below {{atomic load of a record operand not yet implemented in CallConvLowering}}
cir.call @take_smem(%0) : (!rec_SMem) -> ()
@@ -70,7 +70,7 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func @return_atomic(%arg0: !cir.ptr<!rec_S>) -> !rec_S {
+ cir.func @return_atomic(%arg0: !cir.ptr<!rec_S>) -> !rec_S requires_call_conv_lowering {
%0 = cir.load atomic(seq_cst) %arg0 : !cir.ptr<!rec_S>, !rec_S
// expected-error @below {{atomic load of a record operand not yet implemented in CallConvLowering}}
cir.return %0 : !rec_S
@@ -88,7 +88,7 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func @byval_atomic_spill(%arg0: !rec_SMem) {
+ cir.func @byval_atomic_spill(%arg0: !rec_SMem) requires_call_conv_lowering {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_SMem>
// expected-error @below {{atomic store of a record argument or result not yet implemented in CallConvLowering}}
cir.store atomic(seq_cst) %arg0, %0 : !rec_SMem, !cir.ptr<!rec_SMem>
@@ -110,8 +110,8 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @make_w() -> !rec_W
- cir.func @result_record_member(%arg0: !cir.ptr<!rec_H>) {
+ cir.func private @make_w() -> !rec_W requires_call_conv_lowering
+ cir.func @result_record_member(%arg0: !cir.ptr<!rec_H>) requires_call_conv_lowering {
%0 = cir.call @make_w() : () -> !rec_W
// expected-error @below {{use of a record argument or result other than by a store, call, return or member read not yet implemented in CallConvLowering}}
%1 = cir.extract_member %0[0] : !rec_W -> !rec_H
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-volatile.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-volatile.cir
index 05ce78b9a700e9..e2aaed7991353e 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-volatile.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-load-volatile.cir
@@ -15,11 +15,11 @@ module attributes {
#dlti.dl_entry<i32, dense<32>: vector<2xi64>>,
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func private @take_s(!rec_S)
- cir.func private @take_sf(!rec_SF)
- cir.func private @take_smem(!rec_SMem)
+ cir.func private @take_s(!rec_S) requires_call_conv_lowering
+ cir.func private @take_sf(!rec_SF) requires_call_conv_lowering
+ cir.func private @take_smem(!rec_SMem) requires_call_conv_lowering
- cir.func @direct_volatile(%arg0: !cir.ptr<!rec_S>) {
+ cir.func @direct_volatile(%arg0: !cir.ptr<!rec_S>) requires_call_conv_lowering {
%0 = cir.load volatile align(4) %arg0 : !cir.ptr<!rec_S>, !rec_S
cir.call @take_s(%0) : (!rec_S) -> ()
cir.return
@@ -40,7 +40,7 @@ module attributes {
// LLVM-NEXT: call void @take_s(i64 %[[VAL]])
// An alloca is copied too, never read in place.
- cir.func @local_direct_volatile() {
+ cir.func @local_direct_volatile() requires_call_conv_lowering {
%0 = cir.alloca "s" align(4) : !cir.ptr<!rec_S>
%1 = cir.load volatile %0 : !cir.ptr<!rec_S>, !rec_S
cir.call @take_s(%1) : (!rec_S) -> ()
@@ -61,7 +61,7 @@ module attributes {
// LLVM-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[SLOT]], ptr align 4 %[[S]], i64 8, i1 true)
// LLVM-NEXT: %[[VAL:.*]] = load i64, ptr %[[SLOT]], align 8
- cir.func @flattened_volatile(%arg0: !cir.ptr<!rec_SF>) {
+ cir.func @flattened_volatile(%arg0: !cir.ptr<!rec_SF>) requires_call_conv_lowering {
%0 = cir.load volatile align(8) %arg0 : !cir.ptr<!rec_SF>, !rec_SF
cir.call @take_sf(%0) : (!rec_SF) -> ()
cir.return
@@ -82,7 +82,7 @@ module attributes {
// LLVM-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[SLOT]], ptr align 8 %0, i64 16, i1 true)
// The flattened read of a volatile load is copied even from an alloca.
- cir.func @local_flattened_volatile() {
+ cir.func @local_flattened_volatile() requires_call_conv_lowering {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_SF>
%1 = cir.load volatile %0 : !cir.ptr<!rec_SF>, !rec_SF
cir.call @take_sf(%1) : (!rec_SF) -> ()
@@ -101,7 +101,7 @@ module attributes {
// LLVM-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[SLOT]], ptr align 8 %[[S]], i64 16, i1 true)
// A byval parameter's volatile spill is a volatile copy.
- cir.func @byval_volatile_spill(%arg0: !rec_SMem) {
+ cir.func @byval_volatile_spill(%arg0: !rec_SMem) requires_call_conv_lowering {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_SMem>
cir.store volatile %arg0, %0 : !rec_SMem, !cir.ptr<!rec_SMem>
cir.return
@@ -116,7 +116,7 @@ module attributes {
// LLVM-NEXT: %[[S:.*]] = alloca %struct.SMem, align 8
// LLVM-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[S]], ptr align 8 %0, i64 24, i1 true)
- cir.func @byval_volatile(%arg0: !cir.ptr<!rec_SMem>) {
+ cir.func @byval_volatile(%arg0: !cir.ptr<!rec_SMem>) requires_call_conv_lowering {
%0 = cir.load volatile align(8) %arg0 : !cir.ptr<!rec_SMem>, !rec_SMem
cir.call @take_smem(%0) : (!rec_SMem) -> ()
cir.return
@@ -133,7 +133,7 @@ module attributes {
// LLVM-NEXT: call void @take_smem(ptr noundef byval(%struct.SMem) align 8 %[[SLOT]])
// A volatile load is not forwarded, even from an alloca nothing writes.
- cir.func @local_byval_volatile() {
+ cir.func @local_byval_volatile() requires_call_conv_lowering {
%0 = cir.alloca "s" align(8) : !cir.ptr<!rec_SMem>
%1 = cir.load volatile %0 : !cir.ptr<!rec_SMem>, !rec_SMem
cir.call @take_smem(%1) : (!rec_SMem) -> ()
@@ -152,7 +152,7 @@ module attributes {
// LLVM-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[SLOT]], ptr align 8 %[[S]], i64 24, i1 true)
// LLVM-NEXT: call void @take_smem(ptr noundef byval(%struct.SMem) align 8 %[[SLOT]])
- cir.func @return_volatile(%arg0: !cir.ptr<!rec_S>) -> !rec_S {
+ cir.func @return_volatile(%arg0: !cir.ptr<!rec_S>) -> !rec_S requires_call_conv_lowering {
%0 = cir.load volatile align(4) %arg0 : !cir.ptr<!rec_S>, !rec_S
cir.return %0 : !rec_S
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-packed.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-packed.cir
index 7c2cb34747e6d8..44a5811330583a 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-record-packed.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-record-packed.cir
@@ -33,7 +33,7 @@ module attributes {
// allocated as the coerce type and the record is read through a bitcast of
// it. That is the opposite direction from a padded record, where the slot
// has to be the wider record or the reload would run past it.
- cir.func @take_five_short(%arg0: !rec_FiveShort) {
+ cir.func @take_five_short(%arg0: !rec_FiveShort) requires_call_conv_lowering {
cir.return
}
@@ -45,7 +45,7 @@ module attributes {
// The caller allocates the slot the other way round, as the record, and
// reads the register out through a view of it.
- cir.func @call_five_short(%arg0: !rec_FiveShort) {
+ cir.func @call_five_short(%arg0: !rec_FiveShort) requires_call_conv_lowering {
cir.call @take_five_short(%arg0) : (!rec_FiveShort) -> ()
cir.return
}
@@ -60,7 +60,7 @@ module attributes {
// Two eightbytes flatten into two wire arguments, so the record is rebuilt a
// register at a time through the coercion tuple rather than by one bitcast.
- cir.func @take_nine(%arg0: !rec_Nine) {
+ cir.func @take_nine(%arg0: !rec_Nine) requires_call_conv_lowering {
cir.return
}
@@ -75,14 +75,14 @@ module attributes {
// A packed record the caller must destroy takes the non-byval form rather
// than byval, which keeps the record's declared alignment where byval would
// raise it to the ABI minimum of 8.
- cir.func @take_p(%arg0: !rec_P) {
+ cir.func @take_p(%arg0: !rec_P) requires_call_conv_lowering {
cir.return
}
// CHECK-LABEL: cir.func{{.*}} @take_p(%arg0: !cir.ptr<!rec_P> {llvm.align = 1 : i64, llvm.dereferenceable = 5 : i64, llvm.nofreeobj, llvm.noundef})
// A union coerces through the same one-register path as FiveShort.
- cir.func @take_upacked(%arg0: !rec_UPacked) {
+ cir.func @take_upacked(%arg0: !rec_UPacked) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-scalars.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-scalars.cir
index 07bb22280aefc2..c640f267d7c286 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-scalars.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-scalars.cir
@@ -21,7 +21,7 @@ module attributes {
} {
// Register-sized integers are Direct: signature and call sites unchanged.
- cir.func @passthrough(%arg0: !s32i, %arg1: !s64i) -> !s32i {
+ cir.func @passthrough(%arg0: !s32i, %arg1: !s64i) -> !s32i requires_call_conv_lowering {
cir.return %arg0 : !s32i
}
@@ -29,42 +29,42 @@ module attributes {
// CHECK-NEXT: cir.return %arg0 : !s32i
// Floating-point scalars are Direct.
- cir.func @floats(%arg0: !cir.float, %arg1: !cir.double) -> !cir.double {
+ cir.func @floats(%arg0: !cir.float, %arg1: !cir.double) -> !cir.double requires_call_conv_lowering {
cir.return %arg1 : !cir.double
}
// CHECK: cir.func{{.*}} @floats(%arg0: !cir.float, %arg1: !cir.double) -> !cir.double
// Pointers are Direct.
- cir.func @take_ptr(%arg0: !cir.ptr<!s32i>) -> !cir.ptr<!s32i> {
+ cir.func @take_ptr(%arg0: !cir.ptr<!s32i>) -> !cir.ptr<!s32i> requires_call_conv_lowering {
cir.return %arg0 : !cir.ptr<!s32i>
}
// CHECK: cir.func{{.*}} @take_ptr(%arg0: !cir.ptr<!s32i>) -> !cir.ptr<!s32i>
// Signed sub-register integer is sign-extended.
- cir.func @take_s8(%arg0: !s8i) {
+ cir.func @take_s8(%arg0: !s8i) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_s8(%arg0: !s8i {llvm.noundef, llvm.signext})
// Unsigned sub-register integer is zero-extended.
- cir.func @take_u16(%arg0: !u16i) {
+ cir.func @take_u16(%arg0: !u16i) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_u16(%arg0: !u16i {llvm.noundef, llvm.zeroext})
// bool is zero-extended.
- cir.func @take_bool(%arg0: !cir.bool) {
+ cir.func @take_bool(%arg0: !cir.bool) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_bool(%arg0: !cir.bool {llvm.noundef, llvm.zeroext})
// Call site picks up the same extension attribute on the operand.
- cir.func @call_s8(%arg0: !s8i) {
+ cir.func @call_s8(%arg0: !s8i) requires_call_conv_lowering {
cir.call @take_s8(%arg0) : (!s8i) -> ()
cir.return
}
@@ -72,14 +72,14 @@ module attributes {
// CHECK: cir.call @take_s8(%arg0) : (!s8i {llvm.noundef, llvm.signext}) -> ()
// A sub-register integer return is not extended.
- cir.func @ret_s8() -> !s8i {
+ cir.func @ret_s8() -> !s8i requires_call_conv_lowering {
%0 = cir.const #cir.int<0> : !s8i
cir.return %0 : !s8i
}
// CHECK: cir.func{{.*}} @ret_s8() -> !s8i
- cir.func @ret_u16() -> !u16i {
+ cir.func @ret_u16() -> !u16i requires_call_conv_lowering {
%0 = cir.const #cir.int<0> : !u16i
cir.return %0 : !u16i
}
@@ -87,7 +87,7 @@ module attributes {
// CHECK: cir.func{{.*}} @ret_u16() -> !u16i
// A signed __int128 is Direct, so the signature is unchanged.
- cir.func @ret_i128(%arg0: !s128i) -> !s128i {
+ cir.func @ret_i128(%arg0: !s128i) -> !s128i requires_call_conv_lowering {
cir.return %arg0 : !s128i
}
@@ -95,14 +95,14 @@ module attributes {
// CHECK-NEXT: cir.return %arg0 : !s128i
// An unsigned __int128 is Direct as well.
- cir.func @ret_u128(%arg0: !u128i) -> !u128i {
+ cir.func @ret_u128(%arg0: !u128i) -> !u128i requires_call_conv_lowering {
cir.return %arg0 : !u128i
}
// CHECK: cir.func{{.*}} @ret_u128(%arg0: !u128i) -> !u128i
// The call site passes the value through unchanged.
- cir.func @call_i128(%arg0: !s128i) -> !s128i {
+ cir.func @call_i128(%arg0: !s128i) -> !s128i requires_call_conv_lowering {
%0 = cir.call @ret_i128(%arg0) : (!s128i) -> !s128i
cir.return %0 : !s128i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct-offset.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct-offset.cir
index 0005a3c1473c90..e20d7c1109fa31 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct-offset.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct-offset.cir
@@ -22,7 +22,7 @@ module attributes {
// HiWord is 16 bytes: a leading ABI-empty byte, then an i64 at offset 8.
// The low eightbyte carries no field (NO_CLASS), so the classifier passes
// the value in one register taken from byte 8.
- cir.func @take_hiword(%arg0: !rec_HiWord) -> !s64i {
+ cir.func @take_hiword(%arg0: !rec_HiWord) -> !s64i requires_call_conv_lowering {
%0 = cir.alloca "h" align(8) : !cir.ptr<!rec_HiWord>
cir.store %arg0, %0 : !rec_HiWord, !cir.ptr<!rec_HiWord>
%1 = cir.get_member %0[1] {name = "hi"} : !cir.ptr<!rec_HiWord> -> !cir.ptr<!s64i>
@@ -41,7 +41,7 @@ module attributes {
// CIR: cir.copy %[[SLOT]] align(8) to %[[H]] align(8) : !cir.ptr<!rec_HiWord>
// The return value is read in place from byte 8 of the local aggregate.
- cir.func @give_hiword() -> !rec_HiWord {
+ cir.func @give_hiword() -> !rec_HiWord requires_call_conv_lowering {
%0 = cir.alloca "h" align(8) : !cir.ptr<!rec_HiWord>
%1 = cir.load %0 : !cir.ptr<!rec_HiWord>, !rec_HiWord
cir.return %1 : !rec_HiWord
@@ -57,7 +57,7 @@ module attributes {
// CIR: cir.return %[[RVAL]] : !s64i
// A 16-byte-aligned slot is only 8-byte aligned at byte 8.
- cir.func @give_hiword_align16() -> !rec_HiWord {
+ cir.func @give_hiword_align16() -> !rec_HiWord requires_call_conv_lowering {
%0 = cir.alloca "h" align(16) : !cir.ptr<!rec_HiWord>
%1 = cir.load %0 : !cir.ptr<!rec_HiWord>, !rec_HiWord
cir.return %1 : !rec_HiWord
@@ -73,7 +73,7 @@ module attributes {
// CIR-NEXT: cir.return %[[AVAL]] : !s64i
// The u24 in the last 3 bytes of the 11-byte record is read in place.
- cir.func @give_lead_pad3() -> !rec_LeadPad3 {
+ cir.func @give_lead_pad3() -> !rec_LeadPad3 requires_call_conv_lowering {
%0 = cir.alloca "l" align(1) : !cir.ptr<!rec_LeadPad3>
%1 = cir.load %0 : !cir.ptr<!rec_LeadPad3>, !rec_LeadPad3
cir.return %1 : !rec_LeadPad3
@@ -89,7 +89,7 @@ module attributes {
// CIR-NEXT: cir.return %[[PVAL]] : !cir.int<u, 24>
// The offset view of a slot keeps the slot's address space.
- cir.func @give_hiword_as5() -> !rec_HiWord {
+ cir.func @give_hiword_as5() -> !rec_HiWord requires_call_conv_lowering {
%0 = cir.alloca "h" align(8) : !cir.ptr<!rec_HiWord, target_address_space(5)>
%1 = cir.load %0 : !cir.ptr<!rec_HiWord, target_address_space(5)>, !rec_HiWord
cir.return %1 : !rec_HiWord
@@ -105,7 +105,7 @@ module attributes {
// CIR-NEXT: cir.return %[[SVAL]] : !s64i
// Through a pointer argument the bytes are copied, then byte 8 is read.
- cir.func @give_hiword_from_pointer(%arg0: !cir.ptr<!rec_HiWord>) -> !rec_HiWord {
+ cir.func @give_hiword_from_pointer(%arg0: !cir.ptr<!rec_HiWord>) -> !rec_HiWord requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_HiWord>, !rec_HiWord
cir.return %0 : !rec_HiWord
}
@@ -122,7 +122,7 @@ module attributes {
// The caller reconstructs the aggregate from the callee's i64 result, so
// the received register is written back to byte 8 of a slot.
- cir.func @call_hiword() -> !s64i {
+ cir.func @call_hiword() -> !s64i requires_call_conv_lowering {
%0 = cir.call @give_hiword() : () -> !rec_HiWord
%1 = cir.alloca "r" align(8) : !cir.ptr<!rec_HiWord>
cir.store %0, %1 : !rec_HiWord, !cir.ptr<!rec_HiWord>
@@ -144,7 +144,7 @@ module attributes {
// Passing an aggregate argument runs the extraction direction at the call
// site: the operand's byte 8 is read out to form the register.
- cir.func @pass_hiword(%arg0: !rec_HiWord) {
+ cir.func @pass_hiword(%arg0: !rec_HiWord) requires_call_conv_lowering {
%0 = cir.call @take_hiword(%arg0) : (!rec_HiWord) -> !s64i
cir.return
}
@@ -162,7 +162,7 @@ module attributes {
// The same offset-8 coercion from a leading pad field rather than a nested
// empty record. Only 4 live bytes in the high eightbyte, so i32 not i64.
- cir.func @take_lead_pad(%arg0: !rec_LeadPad) -> !s32i {
+ cir.func @take_lead_pad(%arg0: !rec_LeadPad) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "l" align(4) : !cir.ptr<!rec_LeadPad>
cir.store %arg0, %0 : !rec_LeadPad, !cir.ptr<!rec_LeadPad>
%1 = cir.get_member %0[1] {name = "data"} : !cir.ptr<!rec_LeadPad> -> !cir.ptr<!s32i>
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct.cir
index 2c9695e0ee88a8..2a2e32e517be40 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-direct.cir
@@ -27,7 +27,7 @@ module attributes {
// reads a field, so the prologue that reconstitutes the record from the
// register is visible: the i64 is stored to a coerce slot, the slot is
// bitcast to the record pointer, and the body's own slot is copied from it.
- cir.func @take_pair(%arg0: !rec_Pair) -> !s32i {
+ cir.func @take_pair(%arg0: !rec_Pair) -> !s32i requires_call_conv_lowering {
%0 = cir.alloca "p" align(4) : !cir.ptr<!rec_Pair>
cir.store %arg0, %0 : !rec_Pair, !cir.ptr<!rec_Pair>
%1 = cir.get_member %0[0] {name = "a"} : !cir.ptr<!rec_Pair> -> !cir.ptr<!s32i>
@@ -47,7 +47,7 @@ module attributes {
// A two-i64 struct (16 bytes) is passed as two i64 registers (flattened).
// The body reads the second field: the two registers are written into a
// coerce slot, which the body's own slot is copied from, then indexed.
- cir.func @take_two(%arg0: !rec_Two) -> !s64i {
+ cir.func @take_two(%arg0: !rec_Two) -> !s64i requires_call_conv_lowering {
%0 = cir.alloca "t" align(8) : !cir.ptr<!rec_Two>
cir.store %arg0, %0 : !rec_Two, !cir.ptr<!rec_Two>
%1 = cir.get_member %0[1] {name = "b"} : !cir.ptr<!rec_Two> -> !cir.ptr<!s64i>
@@ -68,7 +68,7 @@ module attributes {
// Mixed-alignment fields (i8 then i32) still fit one eightbyte: the i32 is
// placed at its aligned offset and the struct coerces to a single i64.
- cir.func @take_mixed(%arg0: !rec_Mixed) {
+ cir.func @take_mixed(%arg0: !rec_Mixed) requires_call_conv_lowering {
cir.return
}
@@ -80,7 +80,7 @@ module attributes {
// A struct wrapping a small char array is data, not an empty record: the
// 4-byte struct coerces to a single i32.
- cir.func @take_charbuf(%arg0: !rec_CharBuf) {
+ cir.func @take_charbuf(%arg0: !rec_CharBuf) requires_call_conv_lowering {
cir.return
}
@@ -92,7 +92,7 @@ module attributes {
// A one-byte struct wrapping a single-element char array is data, not an
// empty class: it coerces to a single i8.
- cir.func @take_char1(%arg0: !rec_Char1) {
+ cir.func @take_char1(%arg0: !rec_Char1) requires_call_conv_lowering {
cir.return
}
@@ -105,7 +105,7 @@ module attributes {
// A 12-byte array argument is passed as two eightbytes (i64 then i32). The
// two registers are written into a coerce slot, then reloaded as the
// array.
- cir.func @take_arr3(%arg0: !cir.array<!s32i x 3>) {
+ cir.func @take_arr3(%arg0: !cir.array<!s32i x 3>) requires_call_conv_lowering {
cir.return
}
@@ -119,7 +119,7 @@ module attributes {
// An anonymous struct has no record-layout entry, so it defaults to
// can-pass-in-registers and coerces like its named counterpart.
- cir.func @take_anon(%arg0: !cir.struct<{data !s32i, data !s32i}>) {
+ cir.func @take_anon(%arg0: !cir.struct<{data !s32i, data !s32i}>) requires_call_conv_lowering {
cir.return
}
@@ -132,7 +132,7 @@ module attributes {
// A caller forwarding its own Pair argument stores the incoming i64 to a
// coerce slot, copies that slot as a Pair into a second coerce slot, and
// loads the i64 it passes to take_pair from the second slot.
- cir.func @call_pair(%arg0: !rec_Pair) {
+ cir.func @call_pair(%arg0: !rec_Pair) requires_call_conv_lowering {
%0 = cir.call @take_pair(%arg0) : (!rec_Pair) -> !s32i
cir.return
}
@@ -149,7 +149,7 @@ module attributes {
// A struct holding a single __int128 is exactly two eightbytes, so it is
// Direct and coerced to i128 rather than passed by value.
- cir.func @coerce_s1(%arg0: !rec_S1) -> !rec_S1 {
+ cir.func @coerce_s1(%arg0: !rec_S1) -> !rec_S1 requires_call_conv_lowering {
%0 = cir.alloca "a" align(16) : !cir.ptr<!rec_S1>
cir.store %arg0, %0 : !rec_S1, !cir.ptr<!rec_S1>
%1 = cir.load %0 : !cir.ptr<!rec_S1>, !rec_S1
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-indirect.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-indirect.cir
index d156d50152786a..06d90194cf80b9 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-indirect.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-indirect.cir
@@ -22,7 +22,7 @@ module attributes {
// A 24-byte struct does not fit in registers: passed byval. The body reads
// a field, so the load the rewriter inserts at entry (turning the byval
// pointer back into the record value) is visible.
- cir.func @take_big(%arg0: !rec_Big) -> !s64i {
+ cir.func @take_big(%arg0: !rec_Big) -> !s64i requires_call_conv_lowering {
%0 = cir.alloca "b" align(8) : !cir.ptr<!rec_Big>
cir.store %arg0, %0 : !rec_Big, !cir.ptr<!rec_Big>
%1 = cir.get_member %0[2] {name = "c"} : !cir.ptr<!rec_Big> -> !cir.ptr<!s64i>
@@ -37,7 +37,7 @@ module attributes {
// CHECK: %{{.*}} = cir.load %[[FLD]] : !cir.ptr<!s64i>, !s64i
// A 24-byte struct return uses an sret pointer argument.
- cir.func @ret_big() -> !rec_Big {
+ cir.func @ret_big() -> !rec_Big requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_Big>
%1 = cir.load %0 : !cir.ptr<!rec_Big>, !rec_Big
cir.return %1 : !rec_Big
@@ -47,7 +47,7 @@ module attributes {
// A small struct that cannot pass in registers (non-trivial for ABI) is
// passed indirectly even though its size would otherwise fit a register.
- cir.func @take_noregs(%arg0: !rec_NoRegs) {
+ cir.func @take_noregs(%arg0: !rec_NoRegs) requires_call_conv_lowering {
cir.return
}
@@ -55,13 +55,13 @@ module attributes {
// {__int128, char} spans more than two eightbytes, so it does not fit in
// registers: the argument is byval and the return uses sret.
- cir.func @take_big128(%arg0: !rec_Big128) {
+ cir.func @take_big128(%arg0: !rec_Big128) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_big128(%arg0: !cir.ptr<!rec_Big128> {llvm.align = 16 : i64, llvm.byval = !rec_Big128, llvm.noundef})
- cir.func @ret_big128() -> !rec_Big128 {
+ cir.func @ret_big128() -> !rec_Big128 requires_call_conv_lowering {
%0 = cir.alloca "r" align(16) : !cir.ptr<!rec_Big128>
%1 = cir.load %0 : !cir.ptr<!rec_Big128>, !rec_Big128
cir.return %1 : !rec_Big128
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-padded.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-padded.cir
index 69fed26eb0e9cc..d979c9350886b9 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-padded.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-struct-padded.cir
@@ -61,7 +61,7 @@ module attributes {
// The coerce slot is allocated as the whole 16-byte record and bitcast down to
// the 4-byte coerce type, not the other way round, or reading the record out
// of it would run past the slot.
- cir.func @take_ov(%arg0: !rec_Ov) {
+ cir.func @take_ov(%arg0: !rec_Ov) requires_call_conv_lowering {
cir.return
}
@@ -74,7 +74,7 @@ module attributes {
// Past two eightbytes, so byval, and the alignment comes from the record's
// declared alignment in cir.record_layouts rather than from its members,
// whose widest is the four-byte int.
- cir.func @take_big(%arg0: !rec_Big) {
+ cir.func @take_big(%arg0: !rec_Big) requires_call_conv_lowering {
cir.return
}
@@ -83,7 +83,7 @@ module attributes {
// A record the caller must destroy is passed by reference rather than copied,
// so it takes the non-byval form instead of byval even though the size rule
// is the same.
- cir.func @take_no_regs(%arg0: !rec_NoRegs) {
+ cir.func @take_no_regs(%arg0: !rec_NoRegs) requires_call_conv_lowering {
cir.return
}
@@ -91,7 +91,7 @@ module attributes {
// An anonymous record has no entry in cir.record_layouts, so both the
// register-passing decision and the alignment come from the fallbacks.
- cir.func @take_anon_pad(%arg0: !rec_anon_pad) {
+ cir.func @take_anon_pad(%arg0: !rec_anon_pad) requires_call_conv_lowering {
cir.return
}
@@ -99,7 +99,7 @@ module attributes {
// The caller side coerces in the other direction, copying the whole record
// into a slot of its own and reading the register from a view of it.
- cir.func @call_ov(%arg0: !rec_Ov) {
+ cir.func @call_ov(%arg0: !rec_Ov) requires_call_conv_lowering {
cir.call @take_ov(%arg0) : (!rec_Ov) -> ()
cir.return
}
@@ -114,7 +114,7 @@ module attributes {
// `Ov`
diff ers from this record only in spelling the same bytes `pad`, so
// the mark alone is what keeps the eightbyte from narrowing to !s32i.
- cir.func @take_unnamed_unit(%arg0: !rec_UnnamedUnit) {
+ cir.func @take_unnamed_unit(%arg0: !rec_UnnamedUnit) requires_call_conv_lowering {
cir.return
}
@@ -122,7 +122,7 @@ module attributes {
// `Zw` holds the same storage as `Ov`, so only the zero-width bit-field keeps
// the eightbyte from narrowing to !s32i.
- cir.func @take_zw(%arg0: !rec_Zw) {
+ cir.func @take_zw(%arg0: !rec_Zw) requires_call_conv_lowering {
cir.return
}
@@ -130,7 +130,7 @@ module attributes {
// The declared type is wider than the byte the record ends on, so the first
// eightbyte stays i64 while the second narrows to the trailing char.
- cir.func @take_zw_wide(%arg0: !rec_ZwWide) {
+ cir.func @take_zw_wide(%arg0: !rec_ZwWide) requires_call_conv_lowering {
cir.return
}
@@ -138,7 +138,7 @@ module attributes {
// The unit of unnamed bit-fields occupies the four bytes at offset 8, and it
// holds data, so the second eightbyte is passed as well as the first.
- cir.func @take_unit_sse(%arg0: !rec_UnitSSE) {
+ cir.func @take_unit_sse(%arg0: !rec_UnitSSE) requires_call_conv_lowering {
cir.return
}
@@ -150,13 +150,13 @@ module attributes {
// A record that is padding throughout apart from one byte still coerces to
// that byte, at either alignment.
- cir.func @take_padded_byte(%arg0: !rec_PadByte) {
+ cir.func @take_padded_byte(%arg0: !rec_PadByte) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_padded_byte(%arg0: !u8i)
- cir.func @take_padded_byte2(%arg0: !rec_PadByte2) {
+ cir.func @take_padded_byte2(%arg0: !rec_PadByte2) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-union-coerce-shapes.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-union-coerce-shapes.cir
index fab8a00323fd78..cb30635f508d44 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-union-coerce-shapes.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-union-coerce-shapes.cir
@@ -25,7 +25,7 @@ module attributes {
// A 16-byte union whose spanning member is one 128-bit integer coerces to that
// integer rather than to a pair of eightbytes.
- cir.func @take_u128(%arg0: !rec_U128) {
+ cir.func @take_u128(%arg0: !rec_U128) requires_call_conv_lowering {
cir.return
}
@@ -34,14 +34,14 @@ module attributes {
// The two eightbytes need not share a class. The first covers half of the
// double array and merges to INTEGER against the long, while the second is all
// double and stays SSE.
- cir.func @take_umixed(%arg0: !rec_UMixed) {
+ cir.func @take_umixed(%arg0: !rec_UMixed) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_umixed(%arg0: !u64i, %arg1: !cir.double)
// With no integer member to merge against, both eightbytes stay SSE.
- cir.func @take_ud2(%arg0: !rec_UD2) {
+ cir.func @take_ud2(%arg0: !rec_UD2) requires_call_conv_lowering {
cir.return
}
@@ -50,14 +50,14 @@ module attributes {
// The second eightbyte is partial. The classifier reduces this union to its
// 4-byte integer, so an eightbyte sized from that member would cover only the
// first four bytes and drop the rest of the array.
- cir.func @take_u12(%arg0: !rec_U12) {
+ cir.func @take_u12(%arg0: !rec_U12) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_u12(%arg0: !u64i, %arg1: !u32i)
// Two eightbytes in return position, flattened to an anonymous struct.
- cir.func @ret_umixed(%arg0: !rec_UMixed) -> !rec_UMixed {
+ cir.func @ret_umixed(%arg0: !rec_UMixed) -> !rec_UMixed requires_call_conv_lowering {
cir.return %arg0 : !rec_UMixed
}
@@ -65,7 +65,7 @@ module attributes {
// A member-less union at exactly two eightbytes still classifies Ignore. One
// byte more is MEMORY, which x86_64-aggregate-nyi.cir covers.
- cir.func @take_empty16(%arg0: !rec_UEmpty16) {
+ cir.func @take_empty16(%arg0: !rec_UEmpty16) requires_call_conv_lowering {
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-union.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-union.cir
index 355c44c14eade7..81f7e1f917af5b 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-union.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-union.cir
@@ -157,7 +157,7 @@ module attributes {
// Every union member sits at offset zero, so a 4-byte union of an int and a
// float classifies INTEGER on its single eightbyte and coerces to i32.
- cir.func @take_int_float(%arg0: !rec_UIntFloat) {
+ cir.func @take_int_float(%arg0: !rec_UIntFloat) requires_call_conv_lowering {
cir.return
}
@@ -177,7 +177,7 @@ module attributes {
// through to a byte-size fallback that is always unsigned. That
diff erence
// is confined to CIR: LLVM integers have no signedness, so both lower to
// i32, which the LLVM checks at the end of this file pin.
- cir.func @take_float_int(%arg0: !rec_UFloatInt) {
+ cir.func @take_float_int(%arg0: !rec_UFloatInt) requires_call_conv_lowering {
cir.return
}
@@ -185,7 +185,7 @@ module attributes {
// CHECK: %[[CAST:.*]] = cir.cast bitcast %{{.*}} : !cir.ptr<!u32i> -> !cir.ptr<!rec_UFloatInt>
// An 8-byte union fills its eightbyte and coerces to i64.
- cir.func @take_long_double(%arg0: !rec_ULongDouble) {
+ cir.func @take_long_double(%arg0: !rec_ULongDouble) requires_call_conv_lowering {
cir.return
}
@@ -196,7 +196,7 @@ module attributes {
// Same class-merge point at 8 bytes: double-first still coerces to a
// 64-bit integer, unsigned for the same reduction-tie reason as
// take_float_int above.
- cir.func @take_double_long(%arg0: !rec_UDoubleLong) {
+ cir.func @take_double_long(%arg0: !rec_UDoubleLong) requires_call_conv_lowering {
cir.return
}
@@ -205,7 +205,7 @@ module attributes {
// A union of floats classifies SSE, so the coercion is a float register
// rather than an integer one.
- cir.func @take_floats(%arg0: !rec_UFloats) {
+ cir.func @take_floats(%arg0: !rec_UFloats) requires_call_conv_lowering {
cir.return
}
@@ -214,7 +214,7 @@ module attributes {
// CHECK: %[[CAST:.*]] = cir.cast bitcast %[[SLOT]] : !cir.ptr<!cir.float> -> !cir.ptr<!rec_UFloats>
// A 3-byte union coerces to the i24 that spans it.
- cir.func @take_three(%arg0: !rec_UThree) {
+ cir.func @take_three(%arg0: !rec_UThree) requires_call_conv_lowering {
cir.return
}
@@ -224,7 +224,7 @@ module attributes {
// The highest-aligned member (the int) is narrower than the union, whose
// 8-byte size comes from the char array. The eightbyte is sized from the
// union, not from that member, so this coerces to i64 rather than i32.
- cir.func @take_narrow_storage(%arg0: !rec_UNarrowStorage) {
+ cir.func @take_narrow_storage(%arg0: !rec_UNarrowStorage) requires_call_conv_lowering {
cir.return
}
@@ -233,7 +233,7 @@ module attributes {
// A 16-byte union is two INTEGER eightbytes, flattened into one argument per
// eightbyte.
- cir.func @take_two_eightbytes(%arg0: !rec_UTwoEightbytes) {
+ cir.func @take_two_eightbytes(%arg0: !rec_UTwoEightbytes) requires_call_conv_lowering {
cir.return
}
@@ -246,7 +246,7 @@ module attributes {
// CHECK: %{{.*}} = cir.cast bitcast %{{.*}} : !cir.ptr<!rec_anon_struct> -> !cir.ptr<!rec_UTwoEightbytes>
// A union too large for registers is passed byval.
- cir.func @take_big(%arg0: !rec_UBig) {
+ cir.func @take_big(%arg0: !rec_UBig) requires_call_conv_lowering {
cir.return
}
@@ -255,18 +255,18 @@ module attributes {
// Nothing spans this union's 24 declared bytes, the widest covering 17. No
// member can reach SSEUP, so its size alone sends it to memory.
- cir.func @take_tail_pad(%arg0: !rec_UTailPad) {
+ cir.func @take_tail_pad(%arg0: !rec_UTailPad) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_tail_pad(%arg0: !cir.ptr<!rec_UTailPad> {llvm.align = 8 : i64, llvm.byval = !rec_UTailPad, llvm.noundef})
- cir.func private @return_tail_pad() -> !rec_UTailPad
+ cir.func private @return_tail_pad() -> !rec_UTailPad requires_call_conv_lowering
// CHECK: cir.func private @return_tail_pad(!cir.ptr<!rec_UTailPad> {llvm.align = 8 : i64, llvm.dead_on_unwind, llvm.sret = !rec_UTailPad, llvm.writable})
// Same shape, with a layout that forbids registers.
- cir.func @take_tail_pad_no_regs(%arg0: !rec_UTailPadNoRegs) {
+ cir.func @take_tail_pad_no_regs(%arg0: !rec_UTailPadNoRegs) requires_call_conv_lowering {
cir.return
}
@@ -274,7 +274,7 @@ module attributes {
// 48 bytes with nothing spanning, accepted because an `__int128` member
// cannot reach SSEUP.
- cir.func @take_int384(%arg0: !rec_UInt384) {
+ cir.func @take_int384(%arg0: !rec_UInt384) requires_call_conv_lowering {
cir.return
}
@@ -282,7 +282,7 @@ module attributes {
// The spill of a parameter passed in registers is a copy out of the
// coercion slot.
- cir.func @take_union_x87_scalar(%arg0: !rec_UX87Scalar) {
+ cir.func @take_union_x87_scalar(%arg0: !rec_UX87Scalar) requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87Scalar>
cir.store %arg0, %0 : !rec_UX87Scalar, !cir.ptr<!rec_UX87Scalar>
cir.return
@@ -297,7 +297,7 @@ module attributes {
// A three-byte vector's alloc size is 4, so the last of these three array
// elements reaches byte 11, past the 10 bytes a long double stores.
- cir.func @take_union_x87_vec_arr(%arg0: !rec_UX87VecArr) {
+ cir.func @take_union_x87_vec_arr(%arg0: !rec_UX87VecArr) requires_call_conv_lowering {
cir.return
}
@@ -305,38 +305,38 @@ module attributes {
// Two one-element vectors pass in one SSE register, classified SSE plus
// SSEUP.
- cir.func @take_union_x87_twice(%arg0: !rec_UX87Twice) {
+ cir.func @take_union_x87_twice(%arg0: !rec_UX87Twice) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_union_x87_twice(%arg0: !cir.vector<2 x !cir.double>)
- cir.func @take_union_x87_bytes(%arg0: !rec_UX87Bytes) {
+ cir.func @take_union_x87_bytes(%arg0: !rec_UX87Bytes) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_union_x87_bytes(%arg0: !u64i, %arg1: !u64i)
- cir.func @take_union_x87_in_rec(%arg0: !rec_UX87InRec) {
+ cir.func @take_union_x87_in_rec(%arg0: !rec_UX87InRec) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_union_x87_in_rec(%arg0: !u64i, %arg1: !u64i)
- cir.func @take_union_x87_in_arr(%arg0: !rec_UX87InArr) {
+ cir.func @take_union_x87_in_arr(%arg0: !rec_UX87InArr) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_union_x87_in_arr(%arg0: !u64i, %arg1: !u64i)
- cir.func @take_struct_union_x87(%arg0: !rec_SUX87) {
+ cir.func @take_struct_union_x87(%arg0: !rec_SUX87) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_struct_union_x87(%arg0: !u64i, %arg1: !u64i)
// The argument is read out of a copy of the operand's storage.
- cir.func @call_union_x87_bytes(%arg0: !cir.ptr<!rec_UX87Bytes>) {
+ cir.func @call_union_x87_bytes(%arg0: !cir.ptr<!rec_UX87Bytes>) requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_UX87Bytes>, !rec_UX87Bytes
cir.call @take_union_x87_bytes(%0) : (!rec_UX87Bytes) -> ()
cir.return
@@ -359,9 +359,9 @@ module attributes {
// CHECK: cir.call @take_union_x87_bytes(%[[BLO]], %[[BHI]]) : (!u64i, !u64i) -> ()
// The call result is copied out of the coercion slot it is returned into.
- cir.func private @return_union_x87_bytes() -> !rec_UX87Bytes
+ cir.func private @return_union_x87_bytes() -> !rec_UX87Bytes requires_call_conv_lowering
- cir.func @store_union_x87_bytes(%arg0: !cir.ptr<!rec_UX87Bytes>) {
+ cir.func @store_union_x87_bytes(%arg0: !cir.ptr<!rec_UX87Bytes>) requires_call_conv_lowering {
%0 = cir.call @return_union_x87_bytes() : () -> !rec_UX87Bytes
cir.store %0, %arg0 : !rec_UX87Bytes, !cir.ptr<!rec_UX87Bytes>
cir.return
@@ -375,7 +375,7 @@ module attributes {
// CHECK: cir.copy %[[RVIEW]] align(16) to %arg0 align(16) : !cir.ptr<!rec_UX87Bytes>
// CHECK-NEXT: cir.return
- cir.func @take_union_x87_wide(%arg0: !rec_UX87Wide) {
+ cir.func @take_union_x87_wide(%arg0: !rec_UX87Wide) requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87Wide>
cir.store %arg0, %0 : !rec_UX87Wide, !cir.ptr<!rec_UX87Wide>
cir.return
@@ -388,7 +388,7 @@ module attributes {
// CHECK: %[[WSPILL:.*]] = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87Wide>
// CHECK-NEXT: cir.copy %[[WVIEW]] align(16) to %[[WSPILL]] align(16) : !cir.ptr<!rec_UX87Wide>
- cir.func @call_union_x87_wide(%arg0: !cir.ptr<!rec_UX87Wide>) {
+ cir.func @call_union_x87_wide(%arg0: !cir.ptr<!rec_UX87Wide>) requires_call_conv_lowering {
%0 = cir.load %arg0 : !cir.ptr<!rec_UX87Wide>, !rec_UX87Wide
cir.call @take_union_x87_wide(%0) : (!rec_UX87Wide) -> ()
cir.return
@@ -406,7 +406,7 @@ module attributes {
// Here the second eightbyte is X87UP with no X87 before it, so the union goes
// to memory.
- cir.func @take_union_x87_nested(%arg0: !rec_UX87Nested) {
+ cir.func @take_union_x87_nested(%arg0: !rec_UX87Nested) requires_call_conv_lowering {
cir.return
}
@@ -414,7 +414,7 @@ module attributes {
// The integer in the first member makes the first eightbyte INTEGER, so the
// second is X87UP with no X87 before it and the union goes to memory.
- cir.func @take_union_x87_displaced(%arg0: !rec_UX87Displaced) {
+ cir.func @take_union_x87_displaced(%arg0: !rec_UX87Displaced) requires_call_conv_lowering {
cir.return
}
@@ -423,7 +423,7 @@ module attributes {
// At 32 bytes the union goes to memory, both as a parameter and as a return
// value. A parameter stored twice has no single spill to fill, so each
// store becomes a copy from the incoming pointer.
- cir.func @take_union_x87_complex(%arg0: !rec_UX87Complex, %arg1: !cir.ptr<!rec_UX87Complex>) {
+ cir.func @take_union_x87_complex(%arg0: !rec_UX87Complex, %arg1: !cir.ptr<!rec_UX87Complex>) requires_call_conv_lowering {
%0 = cir.alloca "u" align(16) : !cir.ptr<!rec_UX87Complex>
cir.store %arg0, %0 : !rec_UX87Complex, !cir.ptr<!rec_UX87Complex>
cir.store %arg0, %arg1 : !rec_UX87Complex, !cir.ptr<!rec_UX87Complex>
@@ -436,13 +436,13 @@ module attributes {
// CHECK-NEXT: cir.copy %arg0 align(16) to %arg1 align(16) : !cir.ptr<!rec_UX87Complex>
// CHECK-NEXT: cir.return
- cir.func private @return_union_x87_complex() -> !rec_UX87Complex
+ cir.func private @return_union_x87_complex() -> !rec_UX87Complex requires_call_conv_lowering
// CHECK: cir.func private @return_union_x87_complex(!cir.ptr<!rec_UX87Complex> {llvm.align = 16 : i64, llvm.dead_on_unwind, llvm.sret = !rec_UX87Complex, llvm.writable})
// The result is stored where the call cannot be handed the destination, so
// it is copied out of a return slot of its own.
- cir.func @store_union_x87_complex(%arg0: !cir.ptr<!cir.ptr<!rec_UX87Complex>>) {
+ cir.func @store_union_x87_complex(%arg0: !cir.ptr<!cir.ptr<!rec_UX87Complex>>) requires_call_conv_lowering {
%0 = cir.call @return_union_x87_complex() : () -> !rec_UX87Complex
%1 = cir.load %arg0 : !cir.ptr<!cir.ptr<!rec_UX87Complex>>, !cir.ptr<!rec_UX87Complex>
cir.store %0, %1 : !rec_UX87Complex, !cir.ptr<!rec_UX87Complex>
@@ -459,7 +459,7 @@ module attributes {
// The byval alignment comes from the record's declared alignment, which the
// layout metadata carries because the members alone cannot express an
// alignment attribute. Same members as take_big, alignment 32 rather than 8.
- cir.func @take_big_over_aligned(%arg0: !rec_UBigOverAligned) {
+ cir.func @take_big_over_aligned(%arg0: !rec_UBigOverAligned) requires_call_conv_lowering {
cir.return
}
@@ -468,7 +468,7 @@ module attributes {
// The same declared-alignment source feeds every accepted record, not just
// unions: an over-aligned STRUCT gets the same byval alignment fix, since
// mapCIRType's alignment lookup is on the shared record path.
- cir.func @take_struct_over_aligned(%arg0: !rec_SOverAligned) {
+ cir.func @take_struct_over_aligned(%arg0: !rec_SOverAligned) requires_call_conv_lowering {
cir.return
}
@@ -476,7 +476,7 @@ module attributes {
// A union with no members classifies Ignore and is dropped from the
// signature.
- cir.func @take_empty(%arg0: !rec_UEmpty) {
+ cir.func @take_empty(%arg0: !rec_UEmpty) requires_call_conv_lowering {
cir.return
}
@@ -484,7 +484,7 @@ module attributes {
// An empty-union return is dropped too: the function returns void while its
// local storage slot survives.
- cir.func @ret_empty() -> !rec_UEmpty {
+ cir.func @ret_empty() -> !rec_UEmpty requires_call_conv_lowering {
%0 = cir.alloca "u" align(1) : !cir.ptr<!rec_UEmpty>
%1 = cir.load %0 : !cir.ptr<!rec_UEmpty>, !rec_UEmpty
cir.return %1 : !rec_UEmpty
@@ -496,7 +496,7 @@ module attributes {
// An empty member does not reject a union: the int is the only member
// supplying bytes, so it is what the coercion is built from.
- cir.func @take_empty_int(%arg0: !rec_UEmptyInt) {
+ cir.func @take_empty_int(%arg0: !rec_UEmptyInt) requires_call_conv_lowering {
cir.return
}
@@ -507,7 +507,7 @@ module attributes {
// member supplying no bytes is skipped when the union's storage type is
// chosen, so this 16-byte union still coerces to the int's eightbyte
// instead of widening to i64.
- cir.func @take_empty_over(%arg0: !rec_UEmptyOver) {
+ cir.func @take_empty_over(%arg0: !rec_UEmptyOver) requires_call_conv_lowering {
cir.return
}
@@ -517,14 +517,14 @@ module attributes {
// A union of nothing but an empty member classifies Ignore, the same as the
// member-less shape above.
- cir.func @take_empty_only(%arg0: !rec_UEmptyOnly) {
+ cir.func @take_empty_only(%arg0: !rec_UEmptyOnly) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_empty_only()
// Still Ignore at two eightbytes, where the empty member is over-aligned.
- cir.func @take_empty_over_only(%arg0: !rec_UEmptyOverOnly) {
+ cir.func @take_empty_over_only(%arg0: !rec_UEmptyOverOnly) requires_call_conv_lowering {
cir.return
}
@@ -532,7 +532,7 @@ module attributes {
// Skipping the empty member does not force an integer coercion. The
// member that remains decides the eightbyte's class.
- cir.func @take_empty_double(%arg0: !rec_UEmptyDouble) {
+ cir.func @take_empty_double(%arg0: !rec_UEmptyDouble) requires_call_conv_lowering {
cir.return
}
@@ -540,7 +540,7 @@ module attributes {
// Where the other member does fill the eightbyte there is nothing to narrow,
// so this stays i64.
- cir.func @take_empty_bytes(%arg0: !rec_UEmptyBytes) {
+ cir.func @take_empty_bytes(%arg0: !rec_UEmptyBytes) requires_call_conv_lowering {
cir.return
}
@@ -548,7 +548,7 @@ module attributes {
// The reduction breaks an alignment tie by size, so an array of empty
// records beats the one byte of data without holding any itself.
- cir.func @take_arr_empty(%arg0: !rec_UArrEmpty) {
+ cir.func @take_arr_empty(%arg0: !rec_UArrEmpty) requires_call_conv_lowering {
cir.return
}
@@ -557,7 +557,7 @@ module attributes {
// The same array spanning a whole eightbyte, where reading the union's size
// instead of its data would coerce to i64.
- cir.func @take_arr8_empty(%arg0: !rec_UArr8Empty) {
+ cir.func @take_arr8_empty(%arg0: !rec_UArr8Empty) requires_call_conv_lowering {
cir.return
}
@@ -565,14 +565,14 @@ module attributes {
// Past two eightbytes SysV says memory whatever the content, so the empty
// member changes nothing and the union is passed byval.
- cir.func @take_big_empty_int(%arg0: !rec_UBigEmptyInt) {
+ cir.func @take_big_empty_int(%arg0: !rec_UBigEmptyInt) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_big_empty_int(%arg0: !cir.ptr<!rec_UBigEmptyInt> {llvm.align = 32 : i64, llvm.byval = !rec_UBigEmptyInt, llvm.noundef})
// More than one empty member is skipped the same way.
- cir.func @take_two_empty(%arg0: !rec_UTwoEmpty) {
+ cir.func @take_two_empty(%arg0: !rec_UTwoEmpty) requires_call_conv_lowering {
cir.return
}
@@ -580,7 +580,7 @@ module attributes {
// An unnamed bit-field is storage no variant names, but it holds data for
// the ABI, so the union is classified from it and passed in a register.
- cir.func @take_empty_unnamed_bits(%arg0: !rec_UEmptyUnnamedBits) {
+ cir.func @take_empty_unnamed_bits(%arg0: !rec_UEmptyUnnamedBits) requires_call_conv_lowering {
cir.return
}
@@ -588,7 +588,7 @@ module attributes {
// The remaining member decides the class, so a pair of floats in one
// eightbyte still coerces to a vector rather than an integer.
- cir.func @take_empty_floats(%arg0: !rec_UEmptyFloats) {
+ cir.func @take_empty_floats(%arg0: !rec_UEmptyFloats) requires_call_conv_lowering {
cir.return
}
@@ -596,7 +596,7 @@ module attributes {
// A named bit-field access unit that spans the union is itself the data
// the coercion reads from, so it is accepted on its own.
- cir.func @take_bit_spans(%arg0: !rec_UBitSpans) {
+ cir.func @take_bit_spans(%arg0: !rec_UBitSpans) requires_call_conv_lowering {
cir.return
}
@@ -604,7 +604,7 @@ module attributes {
// Here the bit-field access unit does not span, but the long does, so the
// union is accepted from the long's eightbyte rather than the unit's.
- cir.func @take_bit_plus_long(%arg0: !rec_UBitPlusLong) {
+ cir.func @take_bit_plus_long(%arg0: !rec_UBitPlusLong) requires_call_conv_lowering {
cir.return
}
@@ -612,7 +612,7 @@ module attributes {
// The access unit is one byte where the union is four, and the `int` the
// bit-field was declared with is what accounts for the rest.
- cir.func @take_bit_extent(%arg0: !rec_UBitExtent) {
+ cir.func @take_bit_extent(%arg0: !rec_UBitExtent) requires_call_conv_lowering {
cir.return
}
@@ -620,7 +620,7 @@ module attributes {
// The declared `long long` reaches all 8 bytes where the sibling `int` and
// the 4-byte unit both stop at 4.
- cir.func @take_bit_extent_wide(%arg0: !rec_UBitExtentWide) {
+ cir.func @take_bit_extent_wide(%arg0: !rec_UBitExtentWide) requires_call_conv_lowering {
cir.return
}
@@ -628,7 +628,7 @@ module attributes {
// A 20-bit field takes a 3-byte unit, so the unit is an array rather than an
// integer.
- cir.func @take_bit_array_unit(%arg0: !rec_UBitArrayUnit) {
+ cir.func @take_bit_array_unit(%arg0: !rec_UBitArrayUnit) requires_call_conv_lowering {
cir.return
}
@@ -640,7 +640,7 @@ module attributes {
// Each variant of a union is its own access unit, so the two bit-fields here
// do not share one. The widest declaration among them is what counts.
- cir.func @take_two_bit_units(%arg0: !rec_UTwoBitUnits) {
+ cir.func @take_two_bit_units(%arg0: !rec_UTwoBitUnits) requires_call_conv_lowering {
cir.return
}
@@ -648,7 +648,7 @@ module attributes {
// An access unit of nothing but unnamed bit-fields is marked empty rather
// than bitfield.
- cir.func @take_unnamed_bit_extent(%arg0: !rec_UUnnamedBitExtent) {
+ cir.func @take_unnamed_bit_extent(%arg0: !rec_UUnnamedBitExtent) requires_call_conv_lowering {
cir.return
}
@@ -656,7 +656,7 @@ module attributes {
// The empty-record array covers the union but supplies no data, so the
// bit-field has to cover it too, which it does through its declared type.
- cir.func @take_bit_empty_span(%arg0: !rec_UBitEmptySpan) {
+ cir.func @take_bit_empty_span(%arg0: !rec_UBitEmptySpan) requires_call_conv_lowering {
cir.return
}
@@ -664,7 +664,7 @@ module attributes {
// Packed, so the one-byte unit covers this union without help from the
// declared `long long`.
- cir.func @take_bit_extent_packed(%arg0: !rec_UBitExtentPacked) {
+ cir.func @take_bit_extent_packed(%arg0: !rec_UBitExtentPacked) requires_call_conv_lowering {
cir.return
}
@@ -672,13 +672,13 @@ module attributes {
// Here neither the one-byte unit nor a sibling covers the two-byte union, so
// the declared `long long` is what covers it, overshooting by 6 bytes.
- cir.func @take_overshoot(%arg0: !rec_UOvershoot) {
+ cir.func @take_overshoot(%arg0: !rec_UOvershoot) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_overshoot(%arg0: !u16i)
- cir.func @ret_bit_array_unit(%arg0: !rec_UBitArrayUnit) -> !rec_UBitArrayUnit {
+ cir.func @ret_bit_array_unit(%arg0: !rec_UBitArrayUnit) -> !rec_UBitArrayUnit requires_call_conv_lowering {
%0 = cir.alloca "u" align(4) : !cir.ptr<!rec_UBitArrayUnit>
cir.store %arg0, %0 : !rec_UBitArrayUnit, !cir.ptr<!rec_UBitArrayUnit>
%1 = cir.load %0 : !cir.ptr<!rec_UBitArrayUnit>, !rec_UBitArrayUnit
@@ -693,7 +693,7 @@ module attributes {
// CHECK-NEXT: %[[RETVAL:.*]] = cir.load align(4) %[[RETCAST]] : !cir.ptr<!u32i>, !u32i
// CHECK-NEXT: cir.return %[[RETVAL]] : !u32i
- cir.func @call_bit_array_unit(%arg0: !rec_UBitArrayUnit) {
+ cir.func @call_bit_array_unit(%arg0: !rec_UBitArrayUnit) requires_call_conv_lowering {
cir.call @take_bit_array_unit(%arg0) : (!rec_UBitArrayUnit) -> ()
cir.return
}
@@ -707,7 +707,7 @@ module attributes {
// Both eightbytes classify INTEGER and are flattened into one argument each,
// so the empty member does not disturb a multi-eightbyte coercion.
- cir.func @take_empty_two_eightbytes(%arg0: !rec_UEmptyTwoEightbytes) {
+ cir.func @take_empty_two_eightbytes(%arg0: !rec_UEmptyTwoEightbytes) requires_call_conv_lowering {
cir.return
}
@@ -716,7 +716,7 @@ module attributes {
// SWithEmptyUnion embeds UEmptyInt as a member, so the struct's own
// eightbyte classification has to look through the union: this pins that
// the enclosing struct still coerces correctly, not just the bare union.
- cir.func @take_struct_with_empty_union(%arg0: !rec_SWithEmptyUnion) {
+ cir.func @take_struct_with_empty_union(%arg0: !rec_SWithEmptyUnion) requires_call_conv_lowering {
cir.return
}
@@ -726,44 +726,44 @@ module attributes {
// is what CIRGen emits for a [[no_unique_address]] variant. Neither mark
// selects which variants the classifier sees, so a shape repeated from
// earlier in this file is passed the same either way.
- cir.func @take_nua_empty_int(%arg0: !rec_UNuaEmptyInt) {
+ cir.func @take_nua_empty_int(%arg0: !rec_UNuaEmptyInt) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_empty_int(%arg0: !s32i)
// CHECK: %[[CAST:.*]] = cir.cast bitcast %{{.*}} : !cir.ptr<!s32i> -> !cir.ptr<!rec_UNuaEmptyInt>
- cir.func @take_nua_two_empty(%arg0: !rec_UNuaTwoEmpty) {
+ cir.func @take_nua_two_empty(%arg0: !rec_UNuaTwoEmpty) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_two_empty(%arg0: !s32i)
- cir.func @take_nua_empty_only(%arg0: !rec_UNuaEmptyOnly) {
+ cir.func @take_nua_empty_only(%arg0: !rec_UNuaEmptyOnly) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_empty_only()
- cir.func @take_nua_empty_double(%arg0: !rec_UNuaEmptyDouble) {
+ cir.func @take_nua_empty_double(%arg0: !rec_UNuaEmptyDouble) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_empty_double(%arg0: !cir.double)
- cir.func @take_nua_empty_floats(%arg0: !rec_UNuaEmptyFloats) {
+ cir.func @take_nua_empty_floats(%arg0: !rec_UNuaEmptyFloats) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_empty_floats(%arg0: !cir.vector<2 x !cir.float>)
- cir.func @take_nua_empty_two_eightbytes(%arg0: !rec_UNuaEmptyTwoEightbytes) {
+ cir.func @take_nua_empty_two_eightbytes(%arg0: !rec_UNuaEmptyTwoEightbytes) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_empty_two_eightbytes(%arg0: !u64i, %arg1: !u64i)
- cir.func @take_nua_big_empty_int(%arg0: !rec_UNuaBigEmptyInt) {
+ cir.func @take_nua_big_empty_int(%arg0: !rec_UNuaBigEmptyInt) requires_call_conv_lowering {
cir.return
}
@@ -772,13 +772,13 @@ module attributes {
// The empty member is the only one reaching the union's 16 declared bytes,
// so the spanning-member rule is satisfied by a member holding no data,
// and the low eightbyte is coerced from the int.
- cir.func @take_nua_empty_over(%arg0: !rec_UNuaEmptyOver) {
+ cir.func @take_nua_empty_over(%arg0: !rec_UNuaEmptyOver) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_empty_over(%arg0: !s32i)
- cir.func @take_nua_empty_over_only(%arg0: !rec_UNuaEmptyOverOnly) {
+ cir.func @take_nua_empty_over_only(%arg0: !rec_UNuaEmptyOverOnly) requires_call_conv_lowering {
cir.return
}
@@ -786,7 +786,7 @@ module attributes {
// The empty member sizes the union past two eightbytes, where SysV says
// memory whatever the content.
- cir.func @take_nua_big_empty_only(%arg0: !rec_UNuaBigEmptyOnly) {
+ cir.func @take_nua_big_empty_only(%arg0: !rec_UNuaBigEmptyOnly) requires_call_conv_lowering {
cir.return
}
@@ -794,7 +794,7 @@ module attributes {
// A zero-length array variant carries the `empty` mark without being a
// record, and supplies no bytes, so dropping it loses nothing.
- cir.func @take_zero_len_arr_union(%arg0: !rec_UZeroLenArr) {
+ cir.func @take_zero_len_arr_union(%arg0: !rec_UZeroLenArr) requires_call_conv_lowering {
cir.return
}
@@ -805,13 +805,13 @@ module attributes {
// data is still classified. For a variant that is not a bit-field access
// unit no source spells that, since CIRGen marks one `empty` only where it
// supplies no data, so these two
diff er only in that mark to pin the rule.
- cir.func @take_empty_mark_holds_data(%arg0: !rec_UEmptyMarkHoldsData) {
+ cir.func @take_empty_mark_holds_data(%arg0: !rec_UEmptyMarkHoldsData) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_empty_mark_holds_data(%arg0: !s32i)
- cir.func @take_data_mark_holds_data(%arg0: !rec_UDataMarkHoldsData) {
+ cir.func @take_data_mark_holds_data(%arg0: !rec_UDataMarkHoldsData) requires_call_conv_lowering {
cir.return
}
@@ -820,7 +820,7 @@ module attributes {
// A named access unit narrower than the int it holds sits alongside the
// empty member, so the spanning-data rule is satisfied by the plain int
// member instead.
- cir.func @take_nua_empty_bit_int(%arg0: !rec_UNuaEmptyBitInt) {
+ cir.func @take_nua_empty_bit_int(%arg0: !rec_UNuaEmptyBitInt) requires_call_conv_lowering {
cir.return
}
@@ -829,19 +829,19 @@ module attributes {
// The record layout still decides this, whatever its members are marked, so
// a union the ABI passes indirectly without byval reaches the pointer
// attributes take_no_regs pins rather than a coercion.
- cir.func @take_nua_empty_no_regs(%arg0: !rec_UNuaEmptyNoRegs) {
+ cir.func @take_nua_empty_no_regs(%arg0: !rec_UNuaEmptyNoRegs) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_nua_empty_no_regs(%arg0: !cir.ptr<!rec_UNuaEmptyNoRegs> {llvm.align = 4 : i64, llvm.dereferenceable = 4 : i64, llvm.nofreeobj, llvm.noundef})
- cir.func @take_struct_with_nua_empty_union(%arg0: !rec_SWithNuaEmptyUnion) {
+ cir.func @take_struct_with_nua_empty_union(%arg0: !rec_SWithNuaEmptyUnion) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_struct_with_nua_empty_union(%arg0: !u64i)
- cir.func @ret_nua_empty_int(%arg0: !rec_UNuaEmptyInt) -> !rec_UNuaEmptyInt {
+ cir.func @ret_nua_empty_int(%arg0: !rec_UNuaEmptyInt) -> !rec_UNuaEmptyInt requires_call_conv_lowering {
%0 = cir.alloca "u" align(4) : !cir.ptr<!rec_UNuaEmptyInt>
cir.store %arg0, %0 : !rec_UNuaEmptyInt, !cir.ptr<!rec_UNuaEmptyInt>
%1 = cir.load %0 : !cir.ptr<!rec_UNuaEmptyInt>, !rec_UNuaEmptyInt
@@ -851,7 +851,7 @@ module attributes {
// CHECK: cir.func{{.*}} @ret_nua_empty_int(%arg0: !s32i) -> !s32i
// CHECK: cir.return %{{.*}} : !s32i
- cir.func @ret_nua_empty_only() -> !rec_UNuaEmptyOnly {
+ cir.func @ret_nua_empty_only() -> !rec_UNuaEmptyOnly requires_call_conv_lowering {
%0 = cir.alloca "u" align(1) : !cir.ptr<!rec_UNuaEmptyOnly>
%1 = cir.load %0 : !cir.ptr<!rec_UNuaEmptyOnly>, !rec_UNuaEmptyOnly
cir.return %1 : !rec_UNuaEmptyOnly
@@ -860,7 +860,7 @@ module attributes {
// CHECK: cir.func{{.*}} @ret_nua_empty_only()
// CHECK: cir.return{{$}}
- cir.func @call_nua_empty_int(%arg0: !rec_UNuaEmptyInt) {
+ cir.func @call_nua_empty_int(%arg0: !rec_UNuaEmptyInt) requires_call_conv_lowering {
cir.call @take_nua_empty_int(%arg0) : (!rec_UNuaEmptyInt) -> ()
cir.return
}
@@ -870,7 +870,7 @@ module attributes {
// CHECK-NOT: {{cir.load .*, !rec_|cir.store .* : !rec_}}
// CHECK: cir.call @take_nua_empty_int(%{{[^,)]+}}) : (!s32i) -> ()
- cir.func @call_nua_big_empty_int(%arg0: !rec_UNuaBigEmptyInt) {
+ cir.func @call_nua_big_empty_int(%arg0: !rec_UNuaBigEmptyInt) requires_call_conv_lowering {
cir.call @take_nua_big_empty_int(%arg0) : (!rec_UNuaBigEmptyInt) -> ()
cir.return
}
@@ -881,7 +881,7 @@ module attributes {
// CHECK-NOT: {{cir.load .*, !rec_|cir.store .* : !rec_}}
// CHECK: cir.call @take_nua_big_empty_int(%[[BYVAL]]) : (!cir.ptr<!rec_UNuaBigEmptyInt> {llvm.align = 32 : i64, llvm.byval = !rec_UNuaBigEmptyInt, llvm.noundef}) -> ()
- cir.func @ret_nua_empty_floats(%arg0: !rec_UNuaEmptyFloats) -> !rec_UNuaEmptyFloats {
+ cir.func @ret_nua_empty_floats(%arg0: !rec_UNuaEmptyFloats) -> !rec_UNuaEmptyFloats requires_call_conv_lowering {
%0 = cir.alloca "u" align(4) : !cir.ptr<!rec_UNuaEmptyFloats>
cir.store %arg0, %0 : !rec_UNuaEmptyFloats, !cir.ptr<!rec_UNuaEmptyFloats>
%1 = cir.load %0 : !cir.ptr<!rec_UNuaEmptyFloats>, !rec_UNuaEmptyFloats
@@ -892,7 +892,7 @@ module attributes {
// Two eightbytes are returned as a tuple rather than flattened the way the
// argument side flattens them.
- cir.func @ret_nua_empty_two_eightbytes(%arg0: !rec_UNuaEmptyTwoEightbytes) -> !rec_UNuaEmptyTwoEightbytes {
+ cir.func @ret_nua_empty_two_eightbytes(%arg0: !rec_UNuaEmptyTwoEightbytes) -> !rec_UNuaEmptyTwoEightbytes requires_call_conv_lowering {
%0 = cir.alloca "u" align(1) : !cir.ptr<!rec_UNuaEmptyTwoEightbytes>
cir.store %arg0, %0 : !rec_UNuaEmptyTwoEightbytes, !cir.ptr<!rec_UNuaEmptyTwoEightbytes>
%1 = cir.load %0 : !cir.ptr<!rec_UNuaEmptyTwoEightbytes>, !rec_UNuaEmptyTwoEightbytes
@@ -901,7 +901,7 @@ module attributes {
// CHECK: cir.func{{.*}} @ret_nua_empty_two_eightbytes(%arg0: !u64i, %arg1: !u64i) -> !rec_anon_struct
- cir.func @call_nua_empty_two_eightbytes(%arg0: !rec_UNuaEmptyTwoEightbytes) {
+ cir.func @call_nua_empty_two_eightbytes(%arg0: !rec_UNuaEmptyTwoEightbytes) requires_call_conv_lowering {
cir.call @take_nua_empty_two_eightbytes(%arg0) : (!rec_UNuaEmptyTwoEightbytes) -> ()
cir.return
}
@@ -912,7 +912,7 @@ module attributes {
// CHECK: cir.call @take_nua_empty_two_eightbytes(%{{[^,)]+}}, %{{[^,)]+}}) : (!u64i, !u64i) -> ()
// A coerced union return round-trips through the coercion type.
- cir.func @ret_empty_int(%arg0: !rec_UEmptyInt) -> !rec_UEmptyInt {
+ cir.func @ret_empty_int(%arg0: !rec_UEmptyInt) -> !rec_UEmptyInt requires_call_conv_lowering {
%0 = cir.alloca "u" align(4) : !cir.ptr<!rec_UEmptyInt>
cir.store %arg0, %0 : !rec_UEmptyInt, !cir.ptr<!rec_UEmptyInt>
%1 = cir.load %0 : !cir.ptr<!rec_UEmptyInt>, !rec_UEmptyInt
@@ -923,7 +923,7 @@ module attributes {
// CHECK: cir.return %{{.*}} : !s32i
// A union of only empty members is dropped from the return as well.
- cir.func @ret_empty_only() -> !rec_UEmptyOnly {
+ cir.func @ret_empty_only() -> !rec_UEmptyOnly requires_call_conv_lowering {
%0 = cir.alloca "u" align(1) : !cir.ptr<!rec_UEmptyOnly>
%1 = cir.load %0 : !cir.ptr<!rec_UEmptyOnly>, !rec_UEmptyOnly
cir.return %1 : !rec_UEmptyOnly
@@ -933,7 +933,7 @@ module attributes {
// CHECK: cir.return{{$}}
// The call site coerces the same way the callee expects.
- cir.func @call_empty_int(%arg0: !rec_UEmptyInt) {
+ cir.func @call_empty_int(%arg0: !rec_UEmptyInt) requires_call_conv_lowering {
cir.call @take_empty_int(%arg0) : (!rec_UEmptyInt) -> ()
cir.return
}
@@ -945,7 +945,7 @@ module attributes {
// A union the record layout marks as unable to pass in registers goes
// indirect without byval, however small it is.
- cir.func @take_no_regs(%arg0: !rec_UNoRegs) {
+ cir.func @take_no_regs(%arg0: !rec_UNoRegs) requires_call_conv_lowering {
cir.return
}
@@ -954,7 +954,7 @@ module attributes {
// A union that covers itself only through a bit-field's declared type is
// classified like take_no_regs above, and its argument-passing kind still
// sends it to memory.
- cir.func @take_bit_no_regs(%arg0: !rec_UBitNoRegs) {
+ cir.func @take_bit_no_regs(%arg0: !rec_UBitNoRegs) requires_call_conv_lowering {
cir.return
}
@@ -962,7 +962,7 @@ module attributes {
// A struct member that is itself a union is mapped through the same union
// handling, so the enclosing 8-byte struct coerces to one i64.
- cir.func @take_struct_with_union(%arg0: !rec_SWithUnion) {
+ cir.func @take_struct_with_union(%arg0: !rec_SWithUnion) requires_call_conv_lowering {
cir.return
}
@@ -970,7 +970,7 @@ module attributes {
// CHECK: %[[CAST:.*]] = cir.cast bitcast %{{.*}} : !cir.ptr<!u64i> -> !cir.ptr<!rec_SWithUnion>
// A coerced union return round-trips through the coercion type.
- cir.func @ret_int_float(%arg0: !rec_UIntFloat) -> !rec_UIntFloat {
+ cir.func @ret_int_float(%arg0: !rec_UIntFloat) -> !rec_UIntFloat requires_call_conv_lowering {
%0 = cir.alloca "u" align(4) : !cir.ptr<!rec_UIntFloat>
cir.store %arg0, %0 : !rec_UIntFloat, !cir.ptr<!rec_UIntFloat>
%1 = cir.load %0 : !cir.ptr<!rec_UIntFloat>, !rec_UIntFloat
@@ -986,7 +986,7 @@ module attributes {
// CHECK-NEXT: cir.return %[[RET]] : !s32i
// A union return too large for registers uses the caller's sret slot.
- cir.func @ret_big(%arg0: !rec_UBig) -> !rec_UBig {
+ cir.func @ret_big(%arg0: !rec_UBig) -> !rec_UBig requires_call_conv_lowering {
%0 = cir.alloca "u" align(1) : !cir.ptr<!rec_UBig>
cir.store %arg0, %0 : !rec_UBig, !cir.ptr<!rec_UBig>
%1 = cir.load %0 : !cir.ptr<!rec_UBig>, !rec_UBig
@@ -1000,7 +1000,7 @@ module attributes {
// The call site coerces the union argument the same way the callee expects
// it.
- cir.func @call_int_float(%arg0: !rec_UIntFloat) {
+ cir.func @call_int_float(%arg0: !rec_UIntFloat) requires_call_conv_lowering {
cir.call @take_int_float(%arg0) : (!rec_UIntFloat) -> ()
cir.return
}
@@ -1017,7 +1017,7 @@ module attributes {
// CHECK: cir.call @take_int_float(%[[ARG]]) : (!s32i) -> ()
// Both eightbytes are decomposed at the call site.
- cir.func @call_two_eightbytes(%arg0: !rec_UTwoEightbytes) {
+ cir.func @call_two_eightbytes(%arg0: !rec_UTwoEightbytes) requires_call_conv_lowering {
cir.call @take_two_eightbytes(%arg0) : (!rec_UTwoEightbytes) -> ()
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-vaarg-valist-shape-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-vaarg-valist-shape-nyi.cir
index 9fe24dd68b58b5..0ecbd688cba558 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-vaarg-valist-shape-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-vaarg-valist-shape-nyi.cir
@@ -12,7 +12,7 @@ module attributes {
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>,
#dlti.dl_entry<i128, dense<128>: vector<2xi64>>>
} {
- cir.func @scalar_valist(%arg0: !cir.ptr<!cir.ptr<!s8i>>) -> !s32i {
+ cir.func @scalar_valist(%arg0: !cir.ptr<!cir.ptr<!s8i>>) -> !s32i requires_call_conv_lowering {
%0 = cir.va_arg %arg0 : (!cir.ptr<!cir.ptr<!s8i>>) -> !s32i
cir.return %0 : !s32i
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-call.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-call.cir
index 4001035b9ce9bc..9cc6bdc74853e6 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-call.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-call.cir
@@ -22,9 +22,9 @@ module attributes {
#dlti.dl_entry<f64, dense<64>: vector<2xi64>>>
} {
- cir.func private @variadic(!cir.ptr<!s8i>, ...) -> !s32i
- cir.func private @variadic_pair(!rec_Pair, ...) -> !s32i
- cir.func private @variadic_big(!cir.ptr<!s8i>, ...) -> !rec_Big
+ cir.func private @variadic(!cir.ptr<!s8i>, ...) -> !s32i requires_call_conv_lowering
+ cir.func private @variadic_pair(!rec_Pair, ...) -> !s32i requires_call_conv_lowering
+ cir.func private @variadic_big(!cir.ptr<!s8i>, ...) -> !rec_Big requires_call_conv_lowering
// A rewritten variadic declaration keeps its ellipsis.
// CHECK: cir.func private @variadic_pair(!u64i, ...) -> !s32i
@@ -32,7 +32,7 @@ module attributes {
// Passing nothing through the ellipsis leaves the call at the callee's
// declared parameters.
- cir.func @pass_none(%arg0: !cir.ptr<!s8i>) {
+ cir.func @pass_none(%arg0: !cir.ptr<!s8i>) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0) : (!cir.ptr<!s8i>) -> !s32i
cir.return
}
@@ -40,7 +40,7 @@ module attributes {
// CHECK: cir.func{{.*}} @pass_none(%arg0: !cir.ptr<!s8i>)
// CHECK: cir.call @variadic(%arg0) : (!cir.ptr<!s8i>) -> !s32i
- cir.func @pass_scalar(%arg0: !cir.ptr<!s8i>, %arg1: !s32i) {
+ cir.func @pass_scalar(%arg0: !cir.ptr<!s8i>, %arg1: !s32i) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1) : (!cir.ptr<!s8i>, !s32i) -> !s32i
cir.return
}
@@ -50,7 +50,7 @@ module attributes {
// An integer narrower than a word is extended at the ellipsis just as it is
// in a declared parameter position.
- cir.func @pass_narrow(%arg0: !cir.ptr<!s8i>, %arg1: !s8i) {
+ cir.func @pass_narrow(%arg0: !cir.ptr<!s8i>, %arg1: !s8i) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1) : (!cir.ptr<!s8i>, !s8i) -> !s32i
cir.return
}
@@ -58,7 +58,7 @@ module attributes {
// CHECK: cir.func{{.*}} @pass_narrow(%arg0: !cir.ptr<!s8i>, %arg1: !s8i {llvm.noundef, llvm.signext})
// CHECK: cir.call @variadic(%arg0, %arg1) : (!cir.ptr<!s8i>, !s8i {llvm.noundef, llvm.signext}) -> !s32i
- cir.func @pass_double(%arg0: !cir.ptr<!s8i>, %arg1: !cir.double) {
+ cir.func @pass_double(%arg0: !cir.ptr<!s8i>, %arg1: !cir.double) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1) : (!cir.ptr<!s8i>, !cir.double) -> !s32i
cir.return
}
@@ -68,7 +68,7 @@ module attributes {
// The format string consumes one INTEGER register, so the two eightbytes of
// this record still fit in registers and are passed flattened.
- cir.func @pass_two_early(%arg0: !cir.ptr<!s8i>, %arg1: !rec_Two) {
+ cir.func @pass_two_early(%arg0: !cir.ptr<!s8i>, %arg1: !rec_Two) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1) : (!cir.ptr<!s8i>, !rec_Two) -> !s32i
cir.return
}
@@ -78,7 +78,7 @@ module attributes {
// The same record after the format string and five ints have used all six
// INTEGER registers: it goes to memory instead, as a byval slot.
- cir.func @pass_two_exhausted(%arg0: !cir.ptr<!s8i>, %arg1: !s32i, %arg2: !rec_Two) {
+ cir.func @pass_two_exhausted(%arg0: !cir.ptr<!s8i>, %arg1: !s32i, %arg2: !rec_Two) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1, %arg1, %arg1, %arg1, %arg1, %arg2)
: (!cir.ptr<!s8i>, !s32i, !s32i, !s32i, !s32i, !s32i, !rec_Two) -> !s32i
cir.return
@@ -90,7 +90,7 @@ module attributes {
// A record larger than two eightbytes is memory class no matter how many
// registers are free.
- cir.func @pass_big(%arg0: !cir.ptr<!s8i>, %arg1: !rec_Big) {
+ cir.func @pass_big(%arg0: !cir.ptr<!s8i>, %arg1: !rec_Big) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1) : (!cir.ptr<!s8i>, !rec_Big) -> !s32i
cir.return
}
@@ -101,7 +101,7 @@ module attributes {
// An empty record occupies no register and is dropped, without displacing
// the argument behind it.
- cir.func @pass_empty(%arg0: !cir.ptr<!s8i>, %arg1: !rec_E0, %arg2: !s32i) {
+ cir.func @pass_empty(%arg0: !cir.ptr<!s8i>, %arg1: !rec_E0, %arg2: !s32i) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1, %arg2)
: (!cir.ptr<!s8i>, !rec_E0, !s32i) -> !s32i
cir.return
@@ -112,7 +112,7 @@ module attributes {
// An all-float record at the ellipsis coerces to the vector its eightbyte
// holds, the same as in a declared parameter position.
- cir.func @pass_all_float(%arg0: !cir.ptr<!s8i>, %arg1: !rec_FF) {
+ cir.func @pass_all_float(%arg0: !cir.ptr<!s8i>, %arg1: !rec_FF) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1) : (!cir.ptr<!s8i>, !rec_FF) -> !s32i
cir.return
}
@@ -123,7 +123,7 @@ module attributes {
// At this level a 256-bit vector is too wide for a register whether it is
// named or not, so both the declared parameter and the ellipsis argument
// carry the same byval slot.
- cir.func @pass_wide_vector(%arg0: !cir.ptr<!s8i>, %arg1: !cir.vector<8 x !cir.float>) {
+ cir.func @pass_wide_vector(%arg0: !cir.ptr<!s8i>, %arg1: !cir.vector<8 x !cir.float>) requires_call_conv_lowering {
%0 = cir.call @variadic(%arg0, %arg1)
: (!cir.ptr<!s8i>, !cir.vector<8 x !cir.float>) -> !s32i
cir.return
@@ -134,7 +134,7 @@ module attributes {
// A declared parameter is coerced the same way whether or not the call also
// passes ellipsis arguments.
- cir.func @pass_declared_coerced(%arg0: !rec_Pair, %arg1: !s32i) {
+ cir.func @pass_declared_coerced(%arg0: !rec_Pair, %arg1: !s32i) requires_call_conv_lowering {
%0 = cir.call @variadic_pair(%arg0, %arg1) : (!rec_Pair, !s32i) -> !s32i
cir.return
}
@@ -144,7 +144,7 @@ module attributes {
// An sret slot is prepended ahead of the declared parameters, so the
// ellipsis arguments shift right by one.
- cir.func @pass_sret_return(%arg0: !cir.ptr<!s8i>, %arg1: !s32i) -> !rec_Big {
+ cir.func @pass_sret_return(%arg0: !cir.ptr<!s8i>, %arg1: !s32i) -> !rec_Big requires_call_conv_lowering {
%0 = cir.call @variadic_big(%arg0, %arg1) : (!cir.ptr<!s8i>, !s32i) -> !rec_Big
cir.return %0 : !rec_Big
}
@@ -155,7 +155,7 @@ module attributes {
// An indirect variadic call whose ellipsis arguments all pass as written
// needs no rewrite, and the callee pointer keeps its ellipsis.
cir.func @indirect_scalar(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !s32i) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !s32i) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !s32i) -> !s32i
cir.return
@@ -167,7 +167,7 @@ module attributes {
// A void return is already its own wire form, so it does not by itself make
// the call need a rewrite.
cir.func @indirect_void(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...)>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !s32i) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !s32i) requires_call_conv_lowering {
cir.call %arg0(%arg1, %arg2)
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...)>>, !cir.ptr<!s8i>, !s32i) -> ()
cir.return
@@ -179,7 +179,7 @@ module attributes {
// Coercing the declared parameter rebuilds the callee pointer, whose pointee
// has to stay variadic or the lowered call loses its ellipsis.
cir.func @indirect_coerced(%arg0: !cir.ptr<!cir.func<(!rec_Pair, ...) -> !s32i>>,
- %arg1: !rec_Pair) {
+ %arg1: !rec_Pair) requires_call_conv_lowering {
%0 = cir.call %arg0(%arg1)
: (!cir.ptr<!cir.func<(!rec_Pair, ...) -> !s32i>>, !rec_Pair) -> !s32i
cir.return
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-nyi.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-nyi.cir
index a2aab9c43318b8..00d8225af6df8a 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-nyi.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-nyi.cir
@@ -12,12 +12,12 @@ module attributes {
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func no_proto private @kandr(!cir.ptr<!s8i>) -> !s32i
+ cir.func no_proto private @kandr(!cir.ptr<!s8i>) -> !s32i requires_call_conv_lowering
// A callee declared without a prototype takes more operands than it
// declares, but those extra arguments are named rather than passed through
// an ellipsis, so the variadic accounting does not apply to them.
- cir.func @extra_args_no_proto(%arg0: !cir.ptr<!s8i>, %arg1: !s32i) {
+ cir.func @extra_args_no_proto(%arg0: !cir.ptr<!s8i>, %arg1: !s32i) requires_call_conv_lowering {
%0 = cir.call @kandr(%arg0, %arg1) : (!cir.ptr<!s8i>, !s32i) -> !s32i
cir.return
}
@@ -42,7 +42,7 @@ module attributes {
// A type the classifier rejects at the ellipsis is reported on the call.
// The load keeps the i96 out of the enclosing function's signature.
cir.func @indirect_nyi(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !cir.ptr<!i96>) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !cir.ptr<!i96>) requires_call_conv_lowering {
%v = cir.load %arg2 : !cir.ptr<!i96>, !i96
// CHECK: :[[@LINE+1]]:10: error: 'cir.call' op calling-convention lowering not yet implemented for type '!cir.int<s, 96>'
%0 = cir.call %arg0(%arg1, %v)
@@ -71,7 +71,7 @@ module attributes {
// classified like a cir.call, but rebuilding a cir.try_call is not yet
// implemented.
cir.func @indirect_try_call(%arg0: !cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>,
- %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) {
+ %arg1: !cir.ptr<!s8i>, %arg2: !rec_Big) requires_call_conv_lowering {
// CHECK: :[[@LINE+1]]:10: error: 'cir.try_call' op TryCallOp not yet implemented in CallConvLowering
%0 = cir.try_call %arg0(%arg1, %arg2) ^bb1, ^bb2
: (!cir.ptr<!cir.func<(!cir.ptr<!s8i>, ...) -> !s32i>>, !cir.ptr<!s8i>, !rec_Big) -> !s32i
@@ -109,7 +109,7 @@ module attributes {
// the ellipsis, so the declared parameter's coercion is what needs the
// rewrite here, and rebuilding a cir.try_call is unimplemented.
cir.func @variadic_try_call_no_ellipsis(
- %arg0: !cir.ptr<!cir.func<(!rec_Pair, ...) -> !s32i>>, %arg1: !rec_Pair) {
+ %arg0: !cir.ptr<!cir.func<(!rec_Pair, ...) -> !s32i>>, %arg1: !rec_Pair) requires_call_conv_lowering {
%0 = cir.try_call %arg0(%arg1) ^bb1, ^bb2
: (!cir.ptr<!cir.func<(!rec_Pair, ...) -> !s32i>>, !rec_Pair) -> !s32i
^bb1:
@@ -143,13 +143,13 @@ module attributes {
#dlti.dl_entry<i64, dense<64>: vector<2xi64>>>
} {
- cir.func no_proto private @kandr_two(!rec_Pair, !rec_Pair) -> !s32i
+ cir.func no_proto private @kandr_two(!rec_Pair, !rec_Pair) -> !s32i requires_call_conv_lowering
// no_proto turns off the verifier's argument-count check in both directions,
// so a call can also pass fewer arguments than the callee declares. The
// classification has an entry per declared parameter with no operand to
// pair it with.
- cir.func @too_few_no_proto(%arg0: !rec_Pair) {
+ cir.func @too_few_no_proto(%arg0: !rec_Pair) requires_call_conv_lowering {
%0 = cir.call @kandr_two(%arg0) : (!rec_Pair) -> !s32i
cir.return
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-vector.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-vector.cir
index 3d6577bf5f37c2..002254b085c900 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-vector.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-vector.cir
@@ -25,7 +25,7 @@ module attributes {
// A 128-bit vector fills one xmm register and passes in its own type, so no
// coercion is inserted.
- cir.func @v128(%arg0: !cir.vector<4 x !cir.float>) -> !cir.vector<4 x !cir.float> {
+ cir.func @v128(%arg0: !cir.vector<4 x !cir.float>) -> !cir.vector<4 x !cir.float> requires_call_conv_lowering {
cir.return %arg0 : !cir.vector<4 x !cir.float>
}
@@ -34,14 +34,14 @@ module attributes {
// A one-element vector of long double fills one xmm register the same way,
// in either underlying format, and keeps its long double element.
- cir.func @v128_x87(%arg0: !cir.vector<1 x !cir.long_double<!cir.f80>>) -> !cir.vector<1 x !cir.long_double<!cir.f80>> {
+ cir.func @v128_x87(%arg0: !cir.vector<1 x !cir.long_double<!cir.f80>>) -> !cir.vector<1 x !cir.long_double<!cir.f80>> requires_call_conv_lowering {
cir.return %arg0 : !cir.vector<1 x !cir.long_double<!cir.f80>>
}
// CHECK: cir.func{{.*}} @v128_x87(%arg0: !cir.vector<1 x !cir.long_double<!cir.f80>>) -> !cir.vector<1 x !cir.long_double<!cir.f80>>
// CHECK-NEXT: cir.return %arg0
- cir.func @v128_quad(%arg0: !cir.vector<1 x !cir.long_double<!cir.f128>>) -> !cir.vector<1 x !cir.long_double<!cir.f128>> {
+ cir.func @v128_quad(%arg0: !cir.vector<1 x !cir.long_double<!cir.f128>>) -> !cir.vector<1 x !cir.long_double<!cir.f128>> requires_call_conv_lowering {
cir.return %arg0 : !cir.vector<1 x !cir.long_double<!cir.f128>>
}
@@ -51,14 +51,14 @@ module attributes {
// The classifier does not look inside a vector when picking the type for an
// SSE eightbyte, so it falls back to double rather than to the two-element
// vector that take_ff below gets for the same eightbyte.
- cir.func @v64(%arg0: !cir.vector<2 x !cir.float>) -> !cir.vector<2 x !cir.float> {
+ cir.func @v64(%arg0: !cir.vector<2 x !cir.float>) -> !cir.vector<2 x !cir.float> requires_call_conv_lowering {
cir.return %arg0 : !cir.vector<2 x !cir.float>
}
// CHECK: cir.func{{.*}} @v64(%arg0: !cir.double) -> !cir.double
// A 32-bit vector is passed as an integer, matching what gcc does.
- cir.func @v32(%arg0: !cir.vector<1 x !s32i>) -> !cir.vector<1 x !s32i> {
+ cir.func @v32(%arg0: !cir.vector<1 x !s32i>) -> !cir.vector<1 x !s32i> requires_call_conv_lowering {
cir.return %arg0 : !cir.vector<1 x !s32i>
}
@@ -67,7 +67,7 @@ module attributes {
// Without AVX a 256-bit vector exceeds the native vector size and goes to
// memory, and with AVX it stays in a register. The byval alignment is the
// greater of the vector's own alignment and 8.
- cir.func @v256(%arg0: !cir.vector<8 x !cir.float>) {
+ cir.func @v256(%arg0: !cir.vector<8 x !cir.float>) requires_call_conv_lowering {
cir.return
}
@@ -77,7 +77,7 @@ module attributes {
// A 512-bit vector needs the top level before it reaches a register, so this
// is the case that distinguishes avx from avx512.
- cir.func @v512(%arg0: !cir.vector<16 x !cir.float>) {
+ cir.func @v512(%arg0: !cir.vector<16 x !cir.float>) requires_call_conv_lowering {
cir.return
}
@@ -87,13 +87,13 @@ module attributes {
// Two floats in one eightbyte classify SSE, and the coercion type the
// classifier picks for that eightbyte is a vector.
- cir.func @take_ff(%arg0: !rec_FF) {
+ cir.func @take_ff(%arg0: !rec_FF) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_ff(%arg0: !cir.vector<2 x !cir.float>)
- cir.func @ret_ff() -> !rec_FF {
+ cir.func @ret_ff() -> !rec_FF requires_call_conv_lowering {
%0 = cir.alloca "r" align(4) : !cir.ptr<!rec_FF>
%1 = cir.load %0 : !cir.ptr<!rec_FF>, !rec_FF
cir.return %1 : !rec_FF
@@ -102,7 +102,7 @@ module attributes {
// CHECK: cir.func{{.*}} @ret_ff() -> !cir.vector<2 x !cir.float>
// The same holds for an all-float array.
- cir.func @take_farr(%arg0: !cir.array<!cir.float x 2>) {
+ cir.func @take_farr(%arg0: !cir.array<!cir.float x 2>) requires_call_conv_lowering {
cir.return
}
@@ -110,7 +110,7 @@ module attributes {
// Three floats span two eightbytes, so the coercion is a record whose first
// field is the vector covering the first two.
- cir.func @take_f3(%arg0: !rec_F3) {
+ cir.func @take_f3(%arg0: !rec_F3) requires_call_conv_lowering {
cir.return
}
@@ -118,7 +118,7 @@ module attributes {
// A union whose widest member is an all-float array reaches the same vector
// coercion through the union path.
- cir.func @take_union_floats(%arg0: !rec_UFloats) {
+ cir.func @take_union_floats(%arg0: !rec_UFloats) requires_call_conv_lowering {
cir.return
}
@@ -126,7 +126,7 @@ module attributes {
// A bool vector is packed one bit per element, so four bools occupy one byte
// and are passed as an i8, which keeps noundef.
- cir.func @vbool4(%arg0: !cir.vector<4 x !cir.bool> {llvm.noundef}) -> (!cir.vector<4 x !cir.bool> {llvm.noundef}) {
+ cir.func @vbool4(%arg0: !cir.vector<4 x !cir.bool> {llvm.noundef}) -> (!cir.vector<4 x !cir.bool> {llvm.noundef}) requires_call_conv_lowering {
cir.return %arg0 : !cir.vector<4 x !cir.bool>
}
@@ -135,13 +135,13 @@ module attributes {
// Twenty-four bools are passed as an i32, whose top byte is undefined, so
// noundef is dropped from the argument and the return at both the
// definition and the call.
- cir.func @vbool24(%arg0: !cir.vector<24 x !cir.bool> {llvm.noundef}) -> (!cir.vector<24 x !cir.bool> {llvm.noundef}) {
+ cir.func @vbool24(%arg0: !cir.vector<24 x !cir.bool> {llvm.noundef}) -> (!cir.vector<24 x !cir.bool> {llvm.noundef}) requires_call_conv_lowering {
cir.return %arg0 : !cir.vector<24 x !cir.bool>
}
// CHECK: cir.func{{.*}} @vbool24(%arg0: !u32i) -> !u32i
- cir.func @call_vbool24(%arg0: !cir.vector<24 x !cir.bool>) -> !cir.vector<24 x !cir.bool> {
+ cir.func @call_vbool24(%arg0: !cir.vector<24 x !cir.bool>) -> !cir.vector<24 x !cir.bool> requires_call_conv_lowering {
%0 = cir.call @vbool24(%arg0) : (!cir.vector<24 x !cir.bool> {llvm.noundef}) -> (!cir.vector<24 x !cir.bool> {llvm.noundef})
cir.return %0 : !cir.vector<24 x !cir.bool>
}
@@ -151,13 +151,13 @@ module attributes {
// A record holding only the vector, directly or in a one-element array, has
// the vector's 16-byte alloc size, so it passes as the vector.
- cir.func @take_sf3(%arg0: !rec_SF3) {
+ cir.func @take_sf3(%arg0: !rec_SF3) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_sf3(%arg0: !cir.vector<3 x !cir.float>)
- cir.func @take_af3(%arg0: !rec_AF3) {
+ cir.func @take_af3(%arg0: !rec_AF3) requires_call_conv_lowering {
cir.return
}
@@ -166,7 +166,7 @@ module attributes {
// Two elements take 32 bytes, and an array wider than 128 bits stays in
// registers only when it holds a single element that wide, so this goes to
// memory even with AVX.
- cir.func @take_a2f3(%arg0: !rec_A2F3) {
+ cir.func @take_a2f3(%arg0: !rec_A2F3) requires_call_conv_lowering {
cir.return
}
@@ -174,7 +174,7 @@ module attributes {
// AVX: cir.func{{.*}} @take_a2f3(%arg0: !cir.ptr<!rec_A2F3> {llvm.align = 16 : i64, llvm.byval = !rec_A2F3, llvm.noundef})
// AVX512: cir.func{{.*}} @take_a2f3(%arg0: !cir.ptr<!rec_A2F3> {llvm.align = 16 : i64, llvm.byval = !rec_A2F3, llvm.noundef})
- cir.func @call_v128(%arg0: !cir.vector<4 x !cir.float>) -> !cir.vector<4 x !cir.float> {
+ cir.func @call_v128(%arg0: !cir.vector<4 x !cir.float>) -> !cir.vector<4 x !cir.float> requires_call_conv_lowering {
%0 = cir.call @v128(%arg0) : (!cir.vector<4 x !cir.float>) -> !cir.vector<4 x !cir.float>
cir.return %0 : !cir.vector<4 x !cir.float>
}
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-vptr.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-vptr.cir
index 117778ad88bd44..ea1bb73629e504 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-vptr.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-vptr.cir
@@ -58,7 +58,7 @@ module attributes {
// A lone vtable pointer is a scalar in its own right, and passes Direct in
// its natural type the way any other pointer does.
- cir.func @take_bare_vptr(%arg0: !cir.vptr) -> !cir.vptr {
+ cir.func @take_bare_vptr(%arg0: !cir.vptr) -> !cir.vptr requires_call_conv_lowering {
cir.return %arg0 : !cir.vptr
}
@@ -68,7 +68,7 @@ module attributes {
// A record holding nothing but a vtable pointer fills one eightbyte, which
// classifies INTEGER and coerces to the pointer occupying it.
- cir.func @take_vp(%arg0: !rec_VP) {
+ cir.func @take_vp(%arg0: !rec_VP) requires_call_conv_lowering {
cir.return
}
@@ -80,7 +80,7 @@ module attributes {
// The vtable pointer owns the first eightbyte and the long owns the second,
// so the record passes as a pointer and an integer register.
- cir.func @take_vp_long(%arg0: !rec_VPLong) -> !s64i {
+ cir.func @take_vp_long(%arg0: !rec_VPLong) -> !s64i requires_call_conv_lowering {
%0 = cir.alloca "v" align(8) : !cir.ptr<!rec_VPLong>
cir.store %arg0, %0 : !rec_VPLong, !cir.ptr<!rec_VPLong>
%1 = cir.get_member %0[1] {name = "x"} : !cir.ptr<!rec_VPLong> -> !cir.ptr<!s64i>
@@ -101,7 +101,7 @@ module attributes {
// Two ints share the second eightbyte behind the vtable pointer, so that
// eightbyte coerces to i64 while the first stays a pointer.
- cir.func @take_vp_two_int(%arg0: !rec_VPTwoInt) {
+ cir.func @take_vp_two_int(%arg0: !rec_VPTwoInt) requires_call_conv_lowering {
cir.return
}
@@ -109,14 +109,14 @@ module attributes {
// LLVM: define void @take_vp_two_int(ptr %{{[^,]+}}, i64 %{{[^,)]+}})
// A vtable pointer in the second eightbyte rather than the first.
- cir.func @take_long_vp(%arg0: !rec_LongVP) {
+ cir.func @take_long_vp(%arg0: !rec_LongVP) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_long_vp(%arg0: !s64i, %arg1: !cir.ptr<!void>)
// LLVM: define void @take_long_vp(i64 %{{[^,]+}}, ptr %{{[^,)]+}})
- cir.func @ret_long_vp() -> !rec_LongVP {
+ cir.func @ret_long_vp() -> !rec_LongVP requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_LongVP>
%1 = cir.load %0 : !cir.ptr<!rec_LongVP>, !rec_LongVP
cir.return %1 : !rec_LongVP
@@ -127,14 +127,14 @@ module attributes {
// A double behind the vtable pointer makes the second eightbyte SSE, so the
// two eightbytes land in registers of
diff erent classes.
- cir.func @take_vp_double(%arg0: !rec_VPDouble) {
+ cir.func @take_vp_double(%arg0: !rec_VPDouble) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_vp_double(%arg0: !cir.ptr<!void>, %arg1: !cir.double)
// LLVM: define void @take_vp_double(ptr %{{[^,]+}}, double %{{[^,)]+}})
- cir.func @ret_vp_double() -> !rec_VPDouble {
+ cir.func @ret_vp_double() -> !rec_VPDouble requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_VPDouble>
%1 = cir.load %0 : !cir.ptr<!rec_VPDouble>, !rec_VPDouble
cir.return %1 : !rec_VPDouble
@@ -144,7 +144,7 @@ module attributes {
// LLVM: define { ptr, double } @ret_vp_double()
// Reached by recursing through the array element type.
- cir.func @take_vp_arr(%arg0: !rec_VPArr) {
+ cir.func @take_vp_arr(%arg0: !rec_VPArr) requires_call_conv_lowering {
cir.return
}
@@ -153,7 +153,7 @@ module attributes {
// A union reduces to one member before classification, so the vtable pointer
// has to survive that reduction.
- cir.func @take_union_vp(%arg0: !rec_UVP) {
+ cir.func @take_union_vp(%arg0: !rec_UVP) requires_call_conv_lowering {
cir.return
}
@@ -161,7 +161,7 @@ module attributes {
// LLVM: define void @take_union_vp(ptr %{{[^,)]+}})
// VPLong returned comes back in two registers.
- cir.func @ret_vp_long() -> !rec_VPLong {
+ cir.func @ret_vp_long() -> !rec_VPLong requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_VPLong>
%1 = cir.load %0 : !cir.ptr<!rec_VPLong>, !rec_VPLong
cir.return %1 : !rec_VPLong
@@ -175,7 +175,7 @@ module attributes {
// LLVM: define { ptr, i64 } @ret_vp_long()
// A single eightbyte comes back in the one return register holding it.
- cir.func @ret_vp() -> !rec_VP {
+ cir.func @ret_vp() -> !rec_VP requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_VP>
%1 = cir.load %0 : !cir.ptr<!rec_VP>, !rec_VP
cir.return %1 : !rec_VP
@@ -187,7 +187,7 @@ module attributes {
// Past two eightbytes SysV says memory whatever the eightbytes hold. A
// record eligible for registers reaches memory by the byval path, not the
// non-byval path a cannot-pass-in-registers record takes.
- cir.func @take_vp_big(%arg0: !rec_VPBig) {
+ cir.func @take_vp_big(%arg0: !rec_VPBig) requires_call_conv_lowering {
cir.return
}
@@ -195,7 +195,7 @@ module attributes {
// LLVM: define void @take_vp_big(ptr noundef byval(%struct.VPBig) align 8 %{{[^,)]+}})
// Returned at that size it uses sret instead.
- cir.func @ret_vp_big() -> !rec_VPBig {
+ cir.func @ret_vp_big() -> !rec_VPBig requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_VPBig>
%1 = cir.load %0 : !cir.ptr<!rec_VPBig>, !rec_VPBig
cir.return %1 : !rec_VPBig
@@ -207,7 +207,7 @@ module attributes {
// A declared argument-passing kind of cannot-pass-in-registers sends the
// record to memory whatever its eightbytes classify as, which is the path
// every polymorphic C++ class takes.
- cir.func @take_vp_no_regs(%arg0: !rec_VPNoRegs) {
+ cir.func @take_vp_no_regs(%arg0: !rec_VPNoRegs) requires_call_conv_lowering {
cir.return
}
@@ -215,7 +215,7 @@ module attributes {
// LLVM: define void @take_vp_no_regs(ptr nofreeobj noundef align 8 dead_on_return dereferenceable(16) %{{[^,)]+}})
// The same record returned takes sret rather than the non-byval form.
- cir.func @ret_vp_no_regs() -> !rec_VPNoRegs {
+ cir.func @ret_vp_no_regs() -> !rec_VPNoRegs requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_VPNoRegs>
%1 = cir.load %0 : !cir.ptr<!rec_VPNoRegs>, !rec_VPNoRegs
cir.return %1 : !rec_VPNoRegs
@@ -225,7 +225,7 @@ module attributes {
// LLVM: define void @ret_vp_no_regs(ptr dead_on_unwind noalias writable sret(%struct.VPNoRegs) align 8 %{{[^,)]+}})
// A call site is decomposed into the same two registers the callee now takes.
- cir.func @caller(%arg0: !rec_VPLong) -> !s64i {
+ cir.func @caller(%arg0: !rec_VPLong) -> !s64i requires_call_conv_lowering {
%0 = cir.call @take_vp_long(%arg0) : (!rec_VPLong) -> !s64i
cir.return %0 : !s64i
}
@@ -239,14 +239,14 @@ module attributes {
// A polymorphic class with tail padding lowers to a packed record, since
// CIRGen marks that packed as a layout fallback. Its vtable-pointer
// eightbyte still coerces to a pointer, the same as an unpacked one.
- cir.func @take_poly(%arg0: !rec_Poly) {
+ cir.func @take_poly(%arg0: !rec_Poly) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_poly(%arg0: !cir.ptr<!void>, %arg1: !s32i)
// LLVM: define void @take_poly(ptr %{{[^,]+}}, i32 %{{[^,)]+}})
- cir.func @ret_poly() -> !rec_Poly {
+ cir.func @ret_poly() -> !rec_Poly requires_call_conv_lowering {
%0 = cir.alloca "r" align(8) : !cir.ptr<!rec_Poly>
%1 = cir.load %0 : !cir.ptr<!rec_Poly>, !rec_Poly
cir.return %1 : !rec_Poly
diff --git a/clang/test/CIR/Transforms/abi-lowering/x86_64-wide-floats.cir b/clang/test/CIR/Transforms/abi-lowering/x86_64-wide-floats.cir
index 99b0347c220f35..6471123297698c 100644
--- a/clang/test/CIR/Transforms/abi-lowering/x86_64-wide-floats.cir
+++ b/clang/test/CIR/Transforms/abi-lowering/x86_64-wide-floats.cir
@@ -15,14 +15,14 @@ module attributes {
} {
// A half occupies one SSE eightbyte and passes in its natural type.
- cir.func @half(%arg0: !cir.f16) -> !cir.f16 {
+ cir.func @half(%arg0: !cir.f16) -> !cir.f16 requires_call_conv_lowering {
cir.return %arg0 : !cir.f16
}
// CHECK: cir.func{{.*}} @half(%arg0: !cir.f16) -> !cir.f16
// bfloat16 classifies SSE the same way.
- cir.func @bfloat(%arg0: !cir.bf16) -> !cir.bf16 {
+ cir.func @bfloat(%arg0: !cir.bf16) -> !cir.bf16 requires_call_conv_lowering {
cir.return %arg0 : !cir.bf16
}
@@ -30,7 +30,7 @@ module attributes {
// f128 spans an SSE/SSEUP pair, which still passes in one xmm register pair
// rather than memory, so the signature is unchanged.
- cir.func @quad(%arg0: !cir.f128) -> !cir.f128 {
+ cir.func @quad(%arg0: !cir.f128) -> !cir.f128 requires_call_conv_lowering {
cir.return %arg0 : !cir.f128
}
@@ -38,14 +38,14 @@ module attributes {
// x87 long double is the X87/X87UP pair: returned in st0, and passed in
// memory only once it sits inside an aggregate.
- cir.func @x87(%arg0: !cir.long_double<!cir.f80>) -> !cir.long_double<!cir.f80> {
+ cir.func @x87(%arg0: !cir.long_double<!cir.f80>) -> !cir.long_double<!cir.f80> requires_call_conv_lowering {
cir.return %arg0 : !cir.long_double<!cir.f80>
}
// CHECK: cir.func{{.*}} @x87(%arg0: !cir.long_double<!cir.f80>) -> !cir.long_double<!cir.f80>
// A bare f80 without the long_double wrapper classifies identically.
- cir.func @raw_f80(%arg0: !cir.f80) -> !cir.f80 {
+ cir.func @raw_f80(%arg0: !cir.f80) -> !cir.f80 requires_call_conv_lowering {
cir.return %arg0 : !cir.f80
}
@@ -53,13 +53,13 @@ module attributes {
// A struct holding an x87 long double merges to MEMORY, so the argument is
// byval.
- cir.func @take_sld(%arg0: !rec_SLD) {
+ cir.func @take_sld(%arg0: !rec_SLD) requires_call_conv_lowering {
cir.return
}
// CHECK: cir.func{{.*}} @take_sld(%arg0: !cir.ptr<!rec_SLD> {{.*}}llvm.byval = !rec_SLD{{.*}})
- cir.func @call_half(%arg0: !cir.f16) -> !cir.f16 {
+ cir.func @call_half(%arg0: !cir.f16) -> !cir.f16 requires_call_conv_lowering {
%0 = cir.call @half(%arg0) : (!cir.f16) -> !cir.f16
cir.return %0 : !cir.f16
}
More information about the cfe-commits
mailing list