llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangir

Author: Adam Smith (adams381)

<details>
<summary>Changes</summary>

x86_64 calling-convention lowering has been opt-in behind 
`-clangir-enable-call-conv-lowering` since it landed, so nothing reaches the 
pass unless a test asks for it. The ClangIR default path therefore emits 
high-level signatures that do not match SysV: a 32-byte struct return stays 
first-class instead of going out through `sret`, and a one-eightbyte struct 
argument is passed as a record instead of being coerced to `i64`.

This change turns the pass on by default for x86_64 and adds 
`-clangir-disable-call-conv-lowering` to turn it back off. The last flag on the 
command line wins, so a build can disable the pass globally and re-enable it 
for one translation unit.

Flipping the default breaks 147 of 949 CIR tests.  37 tests are CHECK 
regenerations where lowering moved toward classic CodeGen.  110 tests are 
quarantined by adding the disable flag to the RUN lines that turn the ClangIR 
pipeline on, each with a TODO naming the gate that blocks it.  These are the 
known failures at this time:

- 41 vector types
- 30 parameters of an empty or tag class
- 10 the builtin `i32` in the Itanium EH personality signature
- 8 padded, packed, and over-aligned records
- 7 the `!cir.long_double` wrapper with f16 and f128
- 6 `_Complex`
- 3 `_BitInt` wider than 128 bits
- 5 more naming two gates at once.

Assisted-by: Cursor / claude-opus-5


---

Patch is 281.53 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/215026.diff


152 Files Affected:

- (modified) clang/docs/CIR/ABILowering.rst (+14) 
- (modified) clang/include/clang/Frontend/FrontendOptions.h (+4-3) 
- (modified) clang/include/clang/Options/Options.td (+13-2) 
- (modified) clang/lib/CIR/FrontendAction/CIRGenAction.cpp (+1-2) 
- (modified) clang/test/CIR/CodeGen/arg-attrs.cpp (+5-4) 
- (modified) clang/test/CIR/CodeGen/array-ctor.cpp (+5-3) 
- (modified) clang/test/CIR/CodeGen/array-init-loop-exprs.cpp (+2-2) 
- (modified) clang/test/CIR/CodeGen/atomic.c (+7-4) 
- (modified) clang/test/CIR/CodeGen/attr-noundef.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/bind-temporary-lvalue.cpp (+4-9) 
- (modified) clang/test/CIR/CodeGen/bitfields.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/bitint-split-storage-nyi.c (+6-4) 
- (modified) clang/test/CIR/CodeGen/bitint.c (+4-2) 
- (modified) clang/test/CIR/CodeGen/builtin-atomic-is-lock-free.c (+7-7) 
- (modified) clang/test/CIR/CodeGen/builtins-x86.c (+4-2) 
- (added) clang/test/CIR/CodeGen/call-conv-lowering-flag.c (+28) 
- (modified) clang/test/CIR/CodeGen/call.c (+56-18) 
- (modified) clang/test/CIR/CodeGen/call.cpp (+38-8) 
- (modified) clang/test/CIR/CodeGen/cast.c (+24-5) 
- (modified) clang/test/CIR/CodeGen/catch-in-loop.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper-eh.cpp 
(+4-2) 
- (modified) clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cleanup-conditional.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cleanup-derived-to-base-ref.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cleanup-scope-goto-out.cpp (+4-4) 
- (modified) clang/test/CIR/CodeGen/cleanup-scope-goto-within.cpp (+2-2) 
- (modified) clang/test/CIR/CodeGen/cleanup-scope-throw-caught.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cleanup.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGen/complex-cast.cpp (+5-3) 
- (modified) clang/test/CIR/CodeGen/complex.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/convert-incomplete-type.cpp (+5-4) 
- (modified) clang/test/CIR/CodeGen/ctor-try-body.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cxx-rewritten-binary-operator.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cxx23-explicit-object-member.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/cxx2b-static-call-operator.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/default-func-attrs-invoke.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/delete-destroying.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/dtors.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/enum-bool.cpp (+13-24) 
- (modified) clang/test/CIR/CodeGen/forrange.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGen/global-decomp-decls.cpp (+14-6) 
- (modified) clang/test/CIR/CodeGen/if.cpp (+2-2) 
- (modified) clang/test/CIR/CodeGen/instantiate-init.cpp (+17-2) 
- (modified) clang/test/CIR/CodeGen/invoke-attrs.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/label.c (+5-5) 
- (modified) clang/test/CIR/CodeGen/lambda-dtor-field.cpp (+15-12) 
- (modified) clang/test/CIR/CodeGen/lambda-static-invoker-agg-return.cpp 
(+8-14) 
- (modified) clang/test/CIR/CodeGen/lambda.cpp (+41-21) 
- (modified) clang/test/CIR/CodeGen/long-double-inc-dec.cpp (+8-6) 
- (modified) clang/test/CIR/CodeGen/loop-cond-cleanup.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/loop-cond-var-cleanup.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/mem-expr-fn.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/new-delete-deactivation.cpp (+5-6) 
- (modified) clang/test/CIR/CodeGen/new-null.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/nofpclass.c (+4-2) 
- (modified) clang/test/CIR/CodeGen/non-odr-use-const-bool.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/non-scalar-lval-return.cpp (+24-8) 
- (modified) clang/test/CIR/CodeGen/nrvo.cpp (+5-3) 
- (modified) clang/test/CIR/CodeGen/pack-indexing.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/paren-list-agg-init.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/partial-array-cleanup.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/pointer-to-member-func-cast.cpp (+45-38) 
- (modified) clang/test/CIR/CodeGen/pointer-to-member-func-cmp.cpp (+24-12) 
- (modified) clang/test/CIR/CodeGen/record-type-metadata.cpp (+4-1) 
- (modified) clang/test/CIR/CodeGen/ret-attrs.cpp (+5-3) 
- (modified) clang/test/CIR/CodeGen/struct.cpp (+11-4) 
- (modified) clang/test/CIR/CodeGen/temp-param-obj-decl.cpp (+6-4) 
- (modified) clang/test/CIR/CodeGen/ternary-throw.cpp (+6-2) 
- (modified) clang/test/CIR/CodeGen/three-way-cmp.cpp (+5-3) 
- (modified) clang/test/CIR/CodeGen/thunks.cpp (+9-12) 
- (modified) clang/test/CIR/CodeGen/trivial-abi.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/try-catch-all-with-cleanup.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/try-catch-non-trivial-copy.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/try-catch.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/try-no-throwing-calls.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/unary.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/union-agg-init.c (+15-8) 
- (modified) clang/test/CIR/CodeGen/union-agg-init.cpp (+22-7) 
- (modified) clang/test/CIR/CodeGen/union.c (+4-2) 
- (modified) clang/test/CIR/CodeGen/union.cpp (+11-10) 
- (modified) clang/test/CIR/CodeGen/var-arg-aggregate.c (+4-2) 
- (modified) clang/test/CIR/CodeGen/vector-binop-overflow.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/vector-convert-to-bool.c (+4-2) 
- (modified) clang/test/CIR/CodeGen/vector-ext.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/vector.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGen/virtual-fn-calls-eh.cpp (+1-1) 
- (modified) clang/test/CIR/CodeGen/virtual-function-calls.cpp (+1-1) 
- (modified) clang/test/CIR/CodeGen/vtable-linkage-explicit-instantiation.cpp 
(+4-2) 
- (modified) clang/test/CIR/CodeGen/vtable-nyi-nonconvertible-functype.cpp 
(+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/align-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx-builtins.c (+10-8) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx-shuffle-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx10_2_512bf16-builtins.c 
(+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx10_2bf16-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx2-builtins.c (+10-8) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512-reduceIntrin.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512-reduceMinMaxIntrin.c 
(+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512-select-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512bw-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512dq-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512f-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512f16c-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512fp16-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi2-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vl-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vlbw-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vldq-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vlfp16-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vlvbmi2-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vlvp2intersect-builtins.c 
(+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/avx512vp2intersect-builtins.c 
(+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/cmp-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/keylocker.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/permd-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/sqrt-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/sse-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/sse2-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/sse41-builtins.c (+10-8) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/ssse3-builtins.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/vec-set-builtins.c (+6-4) 
- (modified) clang/test/CIR/CodeGenBuiltins/X86/xop-builtins.c (+10-8) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-bit.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-call.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-constant-p.c (+3-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-fcmp-sse.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-float.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-isfpclass.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-reduce-bitwise.c (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtin-undef-rvalue.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtins-elementwise-bool-nyi.c 
(+3-1) 
- (modified) clang/test/CIR/CodeGenBuiltins/builtins-floating-point.c (+5-3) 
- (modified) clang/test/CIR/CodeGenCUDA/device-stub.cu (+2-2) 
- (modified) clang/test/CIR/CodeGenCUDA/kernel-call.cu (+5-4) 
- (modified) clang/test/CIR/CodeGenCXX/typeid-most-derived.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGenCXX/typeid.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGenCXX/uncopyable-args.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGenCXX/x86_64-arguments.cpp (+5-2) 
- (modified) clang/test/CIR/CodeGenCoroutines/coro-exceptions.cpp (+4-1) 
- (modified) clang/test/CIR/CodeGenCoroutines/coro-task.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/atomic-update.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/atomic-write.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/declare-copy.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/declare-copyin.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/declare-copyout.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/declare-create.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/declare-deviceresident.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenOpenACC/declare-present.cpp (+4-2) 
- (modified) clang/test/CIR/CodeGenOpenACC/routine-bind.cpp (+3-1) 
- (modified) clang/test/CIR/CodeGenSYCL/kernel-call-stmt.cpp (+4-2) 
- (modified) clang/test/CIR/func-simple.cpp (+1-1) 


``````````diff
diff --git a/clang/docs/CIR/ABILowering.rst b/clang/docs/CIR/ABILowering.rst
index 1b788cade4dc3..287fdd69c80ee 100644
--- a/clang/docs/CIR/ABILowering.rst
+++ b/clang/docs/CIR/ABILowering.rst
@@ -568,6 +568,20 @@ The pass takes one of two driver modes via pass options:
 
 Exactly one of the two options must be set.
 
+Enabling the Pass
+-----------------
+
+``cir-call-conv-lowering`` runs by default whenever ClangIR code generation is
+enabled on an x86_64 target.  On every other triple the pipeline omits the
+pass, because x86_64 System V is the only classifier implemented so far, and
+signatures reach the LLVM dialect in their high-level form.
+
+``-clangir-disable-call-conv-lowering`` turns the pass off and
+``-clangir-enable-call-conv-lowering`` turns it back on.  The last one on the
+command line wins, so a build can disable the pass globally and re-enable it
+for a single translation unit.  Both are ``-cc1`` options, so reach them from
+the driver through ``-Xclang``.
+
 Open Questions
 ==============
 
diff --git a/clang/include/clang/Frontend/FrontendOptions.h 
b/clang/include/clang/Frontend/FrontendOptions.h
index 3d410c0d7deef..b85cf4c007862 100644
--- a/clang/include/clang/Frontend/FrontendOptions.h
+++ b/clang/include/clang/Frontend/FrontendOptions.h
@@ -423,9 +423,10 @@ class FrontendOptions {
   LLVM_PREFERRED_TYPE(bool)
   unsigned ClangIREnableIdiomRecognizer : 1;
 
-  /// Enable Clang IR (CIR) calling-convention lowering
+  /// Run the Clang IR (CIR) calling-convention lowering pass.  A no-op on
+  /// targets whose calling convention is not yet implemented.
   LLVM_PREFERRED_TYPE(bool)
-  unsigned ClangIREnableCallConvLowering : 1;
+  unsigned ClangIRCallConvLowering : 1;
 
   /// Enable ClangIR library optimization.
   /// Set when -fclangir-lib-opt or -fclangir-lib-opt= was passed.
@@ -569,7 +570,7 @@ class FrontendOptions {
         EmitPrettySymbolGraphs(false), GenReducedBMI(false),
         UseClangIRPipeline(false), ClangIRDisablePasses(false),
         ClangIRDisableCIRVerifier(false), ClangIREnableIdiomRecognizer(false),
-        ClangIREnableCallConvLowering(false), ClangIRLibOptEnabled(false),
+        ClangIRCallConvLowering(true), ClangIRLibOptEnabled(false),
         TimeTraceGranularity(500), TimeTraceVerbose(false) {}
 
   /// getInputKindForExtension - Return the appropriate input kind for a file
diff --git a/clang/include/clang/Options/Options.td 
b/clang/include/clang/Options/Options.td
index cf66ee3e52f2d..4c5aaa6fa052a 100644
--- a/clang/include/clang/Options/Options.td
+++ b/clang/include/clang/Options/Options.td
@@ -3467,10 +3467,21 @@ def clangir_enable_idiom_recognizer : Flag<["-"], 
"clangir-enable-idiom-recogniz
   HelpText<"ClangIR: Enable Idiom Recognizer pass">,
   MarshallingInfoFlag<FrontendOpts<"ClangIREnableIdiomRecognizer">>;
 
+// The enable/disable pair below is spelled out rather than generated by
+// BoolOption, which can only generate an X / no-X pair.
 def clangir_enable_call_conv_lowering : Flag<["-"], 
"clangir-enable-call-conv-lowering">,
   Visibility<[ClangOption, CC1Option]>,
-  HelpText<"ClangIR: Enable calling-convention lowering pass (x86_64 only)">,
-  MarshallingInfoFlag<FrontendOpts<"ClangIREnableCallConvLowering">>;
+  HelpText<"ClangIR: Enable calling-convention lowering pass (x86_64 only, on "
+           "by default)">,
+  MarshallingInfoBooleanFlag<FrontendOpts<"ClangIRCallConvLowering">, "true",
+                             "true", "false",
+                             "clangir_disable_call_conv_lowering">;
+def clangir_disable_call_conv_lowering : Flag<["-"], 
"clangir-disable-call-conv-lowering">,
+  Visibility<[ClangOption, CC1Option]>,
+  HelpText<"ClangIR: Disable calling-convention lowering pass (x86_64 only)">,
+  MarshallingInfoBooleanFlag<FrontendOpts<"ClangIRCallConvLowering">, "true",
+                             "false", "true",
+                             "clangir_enable_call_conv_lowering">;
 
 def clangir_lib_opt_EQ : Joined<["-"], "clangir-lib-opt=">,
   Visibility<[ClangOption, CC1Option]>, Group<f_Group>, Values<"all">,
diff --git a/clang/lib/CIR/FrontendAction/CIRGenAction.cpp 
b/clang/lib/CIR/FrontendAction/CIRGenAction.cpp
index 42baa948d9698..f679724583cde 100644
--- a/clang/lib/CIR/FrontendAction/CIRGenAction.cpp
+++ b/clang/lib/CIR/FrontendAction/CIRGenAction.cpp
@@ -144,8 +144,7 @@ class CIRGenConsumer : public clang::ASTConsumer {
       if (runCIRToCIRPasses(
               MlirModule, MlirCtx, C, !FEOptions.ClangIRDisableCIRVerifier,
               FEOptions.ClangIREnableIdiomRecognizer, CGO.OptimizationLevel > 
0,
-              EnableLibOpt, LibOptOptions,
-              FEOptions.ClangIREnableCallConvLowering)
+              EnableLibOpt, LibOptOptions, FEOptions.ClangIRCallConvLowering)
               .failed()) {
         CI.getDiagnostics().Report(diag::err_cir_to_cir_transform_failed);
         return;
diff --git a/clang/test/CIR/CodeGen/arg-attrs.cpp 
b/clang/test/CIR/CodeGen/arg-attrs.cpp
index 6856cb13659e4..5a6987a4c3484 100644
--- a/clang/test/CIR/CodeGen/arg-attrs.cpp
+++ b/clang/test/CIR/CodeGen/arg-attrs.cpp
@@ -18,8 +18,9 @@ void Struct::this_func(){}
   // CIR: cir.func {{.*}}@_ZN6Struct9this_funcEv(%{{.*}}: 
!cir.ptr<!rec_Struct> {llvm.align = 4 : i64, llvm.dereferenceable = 20 : i64, 
llvm.nonnull, llvm.noundef} {{.*}}) {{.*}} {
   // BOTH: define {{.*}}void @_ZN6Struct9this_funcEv(ptr noundef nonnull align 
4 dereferenceable(20) %{{.*}})
 void Struct::arg_attr(Struct s, int &i, Incomplete &j){}
-  // CIR: cir.func {{.*}}@_ZN6Struct8arg_attrES_RiR10Incomplete(%{{.*}}: 
!cir.ptr<!rec_Struct> {llvm.align = 4 : i64, llvm.dereferenceable = 20 : i64, 
llvm.nonnull, llvm.noundef} {{.*}}, %{{.*}}: !rec_Struct {{.*}}, %{{.*}}: 
!cir.ptr<!s32i> {llvm.align = 4 : i64, llvm.dereferenceable = 4 : i64, 
llvm.nonnull, llvm.noundef} {{.*}}, %arg3: !cir.ptr<!rec_Incomplete> 
{llvm.align = 1 : i64, llvm.nonnull, llvm.noundef} {{.*}}) {{.*}} {
-  // LLVM: define {{.*}}void @_ZN6Struct8arg_attrES_RiR10Incomplete(ptr 
noundef nonnull align 4 dereferenceable(20) %{{.*}}, %struct.Struct %{{.*}}, 
ptr noundef nonnull align 4 dereferenceable(4) %{{.*}}, ptr noundef nonnull 
align 1 %{{.*}})
+  // CIR: cir.func {{.*}}@_ZN6Struct8arg_attrES_RiR10Incomplete(%{{[^,)]+}}: 
!cir.ptr<!rec_Struct> {llvm.align = 4 : i64, llvm.dereferenceable = 20 : i64, 
llvm.nonnull, llvm.noundef} {{.*}}, %{{[^,)]+}}: !cir.ptr<!rec_Struct> 
{llvm.align = 8 : i64, llvm.byval = !rec_Struct, llvm.noalias, llvm.noundef} 
{{.*}}, %{{[^,)]+}}: !cir.ptr<!s32i> {llvm.align = 4 : i64, 
llvm.dereferenceable = 4 : i64, llvm.nonnull, llvm.noundef} {{.*}}, %arg3: 
!cir.ptr<!rec_Incomplete> {llvm.align = 1 : i64, llvm.nonnull, llvm.noundef} 
{{.*}}) {{.*}} {
+  // TODO(cir): CIR adds noalias to a byval argument where classic does not.
+  // LLVM: define {{.*}}void @_ZN6Struct8arg_attrES_RiR10Incomplete(ptr 
noundef nonnull align 4 dereferenceable(20) %{{[^,)]+}}, ptr noalias noundef 
byval(%struct.Struct) align 8 %{{[^,)]+}}, ptr noundef nonnull align 4 
dereferenceable(4) %{{[^,)]+}}, ptr noundef nonnull align 1 %{{[^,)]+}})
   // OGCG: define {{.*}}void @_ZN6Struct8arg_attrES_RiR10Incomplete(ptr 
noundef nonnull align 4 dereferenceable(20) %{{.*}}, ptr noundef 
byval(%struct.Struct) align 8 %{{.*}}, ptr noundef nonnull align 4 
dereferenceable(4) %{{.*}}, ptr noundef nonnull align 1 %{{.*}})
 
 struct __attribute__((aligned(32))) Aligned32 {
@@ -51,8 +52,8 @@ void caller(Struct s, int i, Incomplete &inc) {
   // CIR: cir.call @_ZN6Struct9this_funcEv(%{{.*}}) : (!cir.ptr<!rec_Struct> 
{llvm.align = 4 : i64, llvm.dereferenceable = 20 : i64, llvm.nonnull, 
llvm.noundef})
   // BOTH: call void @_ZN6Struct9this_funcEv(ptr noundef nonnull align 4 
dereferenceable(20) %{{.*}})
   s.arg_attr(s, i, inc);
-  // CIR: cir.call @_ZN6Struct8arg_attrES_RiR10Incomplete(%{{.*}}, %{{.*}}, 
%{{.*}}, %{{.*}}) : (!cir.ptr<!rec_Struct> {llvm.align = 4 : i64, 
llvm.dereferenceable = 20 : i64, llvm.nonnull, llvm.noundef}, !rec_Struct, 
!cir.ptr<!s32i> {llvm.align = 4 : i64, llvm.dereferenceable = 4 : i64, 
llvm.nonnull, llvm.noundef}, !cir.ptr<!rec_Incomplete> {llvm.align = 1 : i64, 
llvm.nonnull, llvm.noundef})
-  // LLVM: call void @_ZN6Struct8arg_attrES_RiR10Incomplete(ptr noundef 
nonnull align 4 dereferenceable(20) %{{.*}}, %struct.Struct %{{.*}}, ptr 
noundef nonnull align 4 dereferenceable(4) %{{.*}}, ptr noundef nonnull align 1 
%{{.*}})
+  // CIR: cir.call @_ZN6Struct8arg_attrES_RiR10Incomplete(%{{.*}}, %{{.*}}, 
%{{.*}}, %{{.*}}) : (!cir.ptr<!rec_Struct> {llvm.align = 4 : i64, 
llvm.dereferenceable = 20 : i64, llvm.nonnull, llvm.noundef}, 
!cir.ptr<!rec_Struct> {llvm.align = 8 : i64, llvm.byval = !rec_Struct, 
llvm.noalias, llvm.noundef}, !cir.ptr<!s32i> {llvm.align = 4 : i64, 
llvm.dereferenceable = 4 : i64, llvm.nonnull, llvm.noundef}, 
!cir.ptr<!rec_Incomplete> {llvm.align = 1 : i64, llvm.nonnull, llvm.noundef})
+  // LLVM: call void @_ZN6Struct8arg_attrES_RiR10Incomplete(ptr noundef 
nonnull align 4 dereferenceable(20) %{{.*}}, ptr noalias noundef 
byval(%struct.Struct) align 8 %{{.*}}, ptr noundef nonnull align 4 
dereferenceable(4) %{{.*}}, ptr noundef nonnull align 1 %{{.*}})
   // OGCG: call void @_ZN6Struct8arg_attrES_RiR10Incomplete(ptr noundef 
nonnull align 4 dereferenceable(20) %{{.*}}, ptr noundef byval(%struct.Struct) 
align 8 %{{.*}}, ptr noundef nonnull align 4 dereferenceable(4) %{{.*}}, ptr 
noundef nonnull align 1 %{{.*}})
 }
 
diff --git a/clang/test/CIR/CodeGen/array-ctor.cpp 
b/clang/test/CIR/CodeGen/array-ctor.cpp
index 3d94a36a60d70..b661f78157c76 100644
--- a/clang/test/CIR/CodeGen/array-ctor.cpp
+++ b/clang/test/CIR/CodeGen/array-ctor.cpp
@@ -1,7 +1,9 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -emit-cir -mmlir --mlir-print-ir-before=cir-lowering-prepare %s -o -  
2>&1 | FileCheck --check-prefixes=CIR-BEFORE-LPP %s
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -emit-cir %s -o %t.cir
+// TODO(cir): drop -clangir-disable-call-conv-lowering once CallConvLowering
+// supports parameters of an empty or tag class.
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -clangir-disable-call-conv-lowering -emit-cir -mmlir 
--mlir-print-ir-before=cir-lowering-prepare %s -o -  2>&1 | FileCheck 
--check-prefixes=CIR-BEFORE-LPP %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -clangir-disable-call-conv-lowering -emit-cir %s -o %t.cir
 // RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -clangir-disable-call-conv-lowering -emit-llvm %s -o %t-cir.ll
 // RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-emit-llvm %s -o %t.ll
 // RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
diff --git a/clang/test/CIR/CodeGen/array-init-loop-exprs.cpp 
b/clang/test/CIR/CodeGen/array-init-loop-exprs.cpp
index 25ffaca4a6807..b1a9c54147a31 100644
--- a/clang/test/CIR/CodeGen/array-init-loop-exprs.cpp
+++ b/clang/test/CIR/CodeGen/array-init-loop-exprs.cpp
@@ -87,10 +87,10 @@ struct HasNonTrivialArray {
 
 // LLVM-LABEL: define {{.*}}@_ZN18HasNonTrivialArrayC1ERKS_(
 // LLVM: call void @_ZN18HasNonTrivialArrayC2ERKS_(
-// LLVM-LABEL: define dso_local %struct.HasNonTrivialArray @make_copy(
+// LLVM-LABEL: define dso_local void @make_copy(ptr dead_on_unwind noalias 
writable sret(%struct.HasNonTrivialArray) align 4 %{{[^,)]+}}, ptr noundef 
nonnull align 4 dereferenceable(12) %{{[^,)]+}})
 // LLVM: call void @_ZN18HasNonTrivialArrayC1ERKS_(
 
-// OGCG-LABEL: define {{.*}}@make_copy(
+// OGCG-LABEL: define dso_local void @make_copy(ptr dead_on_unwind noalias 
writable sret(%struct.HasNonTrivialArray) align 4 %{{[^,)]+}}, ptr noundef 
nonnull align 4 dereferenceable(12) %{{[^,)]+}})
 // OGCG: call void @_ZN18HasNonTrivialArrayC1ERKS_(
 //
 // OGCG-LABEL: define {{.*}}@_ZN18HasNonTrivialArrayC1ERKS_(
diff --git a/clang/test/CIR/CodeGen/atomic.c b/clang/test/CIR/CodeGen/atomic.c
index d6b93c387f2bd..a8a7779e83256 100644
--- a/clang/test/CIR/CodeGen/atomic.c
+++ b/clang/test/CIR/CodeGen/atomic.c
@@ -3744,8 +3744,8 @@ typedef struct S {
 
 void store_atomic_different_size(S a) {
   // CIR-LABEL: @store_atomic_different_size
-  // LLVM-LABEL: @store_atomic_different_size
-  // OGCG-LABEL: @store_atomic_different_size
+  // LLVM-LABEL: define dso_local void @store_atomic_different_size(i24 
%{{[^,)]+}})
+  // OGCG-LABEL: define dso_local void @store_atomic_different_size(i24 
%{{[^,)]+}})
 
   _Atomic(S) b;
   __c11_atomic_store(&b, a, __ATOMIC_SEQ_CST);
@@ -3770,12 +3770,15 @@ void store_atomic_different_size(S a) {
 
  // FIXME(cir): The difference below is due to ABI lowering not being fully 
implemented for CIR.
 
+ // LLVM: %[[COERCE:.*]] = alloca i24, i64 1, align 4
+ // LLVM: store i24 %{{.+}}, ptr %[[COERCE]], align 4
+ // LLVM: %[[A:.*]] = load %struct.S, ptr %[[COERCE]], align 1
  // LLVM: %[[A_ADDR:.*]] = alloca %struct.S, i64 1, align 1
  // LLVM: %[[B_ADDR:.*]] = alloca { %struct.S, [1 x i8] }, i64 1, align 4
  // LLVM: %[[A_ATOMIC_TMP_ADDR:.*]] = alloca %struct.S, i64 1, align 1
  // LLVM: %[[ATOMIC_TMP_ADDR:.*]] = alloca { %struct.S, [1 x i8] }, i64 1, 
align 4
- // LLVM: store %struct.S %[[A:.*]], ptr %[[A_ADDR]], align 1
- // LLVM: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %4, ptr align 1 
%[[A_ADDR]], i64 3, i1 false)
+ // LLVM: store %struct.S %[[A]], ptr %[[A_ADDR]], align 1
+ // LLVM: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %[[A_ATOMIC_TMP_ADDR]], 
ptr align 1 %[[A_ADDR]], i64 3, i1 false)
  // LLVM: call void @llvm.memset.p0.i64(ptr align 1 %[[A_ATOMIC_TMP_ADDR]], i8 
0, i64 4, i1 false)
  // LLVM: call void @llvm.memcpy.p0.p0.i64(ptr %[[ATOMIC_TMP_ADDR]], ptr 
%[[A_ATOMIC_TMP_ADDR]], i64 3, i1 false)
  // LLVM: %[[ATOMIC_TMP:.*]] = load i32, ptr %[[ATOMIC_TMP_ADDR]], align 4
diff --git a/clang/test/CIR/CodeGen/attr-noundef.cpp 
b/clang/test/CIR/CodeGen/attr-noundef.cpp
index 390559b4f8ae9..9052c9dea11a0 100644
--- a/clang/test/CIR/CodeGen/attr-noundef.cpp
+++ b/clang/test/CIR/CodeGen/attr-noundef.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -fclangir -emit-cir %s -o 
%t.cir
+// TODO(cir): drop -clangir-disable-call-conv-lowering once CallConvLowering
+// supports vector types.
+// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -fclangir 
-clangir-disable-call-conv-lowering -emit-cir %s -o %t.cir
 // RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
-// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -fclangir -emit-llvm %s -o 
%t-cir.ll
+// RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -fclangir 
-clangir-disable-call-conv-lowering -emit-llvm %s -o %t-cir.ll
 // RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
 // RUN: %clang_cc1 -triple x86_64-gnu-linux -x c++ -emit-llvm %s -o %t.ll
 // RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
diff --git a/clang/test/CIR/CodeGen/bind-temporary-lvalue.cpp 
b/clang/test/CIR/CodeGen/bind-temporary-lvalue.cpp
index 53c6de30397b4..44893f3f9cab0 100644
--- a/clang/test/CIR/CodeGen/bind-temporary-lvalue.cpp
+++ b/clang/test/CIR/CodeGen/bind-temporary-lvalue.cpp
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -std=c++03 -triple x86_64-unknown-linux-gnu -fclangir 
-emit-cir %s -o %t.cir
 // RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
 // RUN: %clang_cc1 -std=c++03 -triple x86_64-unknown-linux-gnu -fclangir 
-emit-llvm %s -o %t-cir.ll
-// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefixes=LLVM,LLVMCIR
+// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
 // RUN: %clang_cc1 -std=c++03 -triple x86_64-unknown-linux-gnu -emit-llvm %s 
-o %t.ll
-// RUN: FileCheck --input-file=%t.ll %s --check-prefixes=LLVM,OGCG
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=LLVM
 
 struct S {
   ~S();
@@ -17,8 +17,7 @@ int f() { return getS().x; }
 // CIR: cir.func {{.*}}@_Z1fv()
 // CIR:   %[[RET:.*]] = cir.alloca "__retval"
 // CIR:   %[[TMP:.*]] = cir.alloca "temp.lvalue"
-// CIR:   %[[CALL:.*]] = cir.call @_Z4getSv() : () -> !rec_S
-// CIR:   cir.store{{.*}} %[[CALL]], %[[TMP]]
+// CIR:   cir.call @_Z4getSv(%[[TMP]]) : (!cir.ptr<!rec_S> {llvm.align = 4 : 
i64, llvm.dead_on_unwind, llvm.sret = !rec_S, llvm.writable}) -> ()
 // CIR:   cir.cleanup.scope {
 // CIR:     %[[X:.*]] = cir.get_member %[[TMP]][0] {name = "x"} : 
!cir.ptr<!rec_S> -> !cir.ptr<!s32i>
 // CIR:     %[[VAL:.*]] = cir.load{{.*}} %[[X]] : !cir.ptr<!s32i>, !s32i
@@ -29,13 +28,9 @@ int f() { return getS().x; }
 // CIR:   %[[RES:.*]] = cir.load %[[RET]] : !cir.ptr<!s32i>, !s32i
 // CIR:   cir.return %[[RES]]
 
-// FIXME(cir): The difference below is due to ABI lowering not being 
implemented for CIR.
-
 // LLVM:      define {{.*}}@_Z1fv()
 // LLVM:        %[[TMP:.*]] = alloca %struct.S
-// LLVMCIR:     %[[CALL:.*]] = call %struct.S @_Z4getSv()
-// LLVMCIR:     store %struct.S %[[CALL]], ptr %[[TMP]]
-// OGCG:        call void @_Z4getSv(ptr {{.*}} sret(%struct.S) {{.*}} %[[TMP]])
+// LLVM:        call void @_Z4getSv(ptr dead_on_unwind writable 
sret(%struct.S) align 4 %[[TMP]])
 // LLVM:        %[[X:.*]] = getelementptr inbounds {{.*}} %struct.S, ptr 
%[[TMP]], i32 0, i32 0
 // LLVM:        %[[VAL:.*]] = load i32, ptr %[[X]]
 // LLVM:        call void @_ZN1SD1Ev(ptr {{.*}} %[[TMP]])
diff --git a/clang/test/CIR/CodeGen/bitfields.cpp 
b/clang/test/CIR/CodeGen/bitfields.cpp
index 2117d2848a531..53b1ed85a662a 100644
--- a/clang/test/CIR/CodeGen/bitfields.cpp
+++ b/clang/test/CIR/CodeGen/bitfields.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir 
-emit-cir %s -o %t.cir
+// TODO(cir): drop -clangir-disable-call-conv-lowering once CallConvLowering
+// supports padded, packed, and over-aligned record shapes.
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-disable-call-conv-lowering -emit-cir %s -o %t.cir
 // RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir 
-emit-llvm %s -o %t-cir.ll
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-disable-call-conv-lowering -emit-llvm %s -o %t-cir.ll
 // RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -emit-llvm %s 
-o %t.ll
 // RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
diff --git a/clang/test/CIR/CodeGen/bitint-split-storage-nyi.c 
b/clang/test/CIR/CodeGen/bitint-split-storage-nyi.c
index ee9fc168124e6..786617ff02975 100644
--- a/clang/test/CIR/CodeGen/bitint-split-storage-nyi.c
+++ b/clang/test/CIR/CodeGen/bitint-split-storage-nyi.c
@@ -1,7 +1,9 @@
-// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm 
-DGLOBAL %s -o - 2>&1 | FileCheck %s --check-prefix=GLOBAL
-// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm 
-DALLOCA %s -o - 2>&1 | FileCheck %s --check-prefix=ALLOCA
-// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm 
-DSTORE %s -o - 2>&1 | FileCheck %s --check-prefix=STORE
-// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm 
-DLOAD %s -o - 2>&1 | FileCheck %s --check-prefix=LOAD
+// TODO(cir): drop -clangir-disable-call-conv-lowering once CallConvLowering
+// supports _BitInt wider than 128 bits.
+// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-disable-call-conv-lowering -emit-llvm -DGLOBAL %s -o - 2>&1 | 
FileCheck %s --check-prefix=GLOBAL
+// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-disable-call-conv-lowering -emit-llvm -DALLOCA %s -o - 2>&1 | 
FileCheck %s --check-prefix=ALLOCA
+// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-disable-call-conv-lowering -emit-llvm -DSTORE %s -o - 2>&1 | FileCheck 
%s --check-prefix=STORE
+// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-disable-call-conv-lowering -emit-llvm -DLOAD %s -o - 2>&1 | FileCheck 
%s --check-prefix=LOAD
 
 #ifdef GLOBAL
 signed _BitInt(129) g129 = 1;
diff --git a/clang/test/CIR/CodeGen/bitint.c b/clang/test/CIR/CodeGen/bitint.c
index ef67366571138..0a1fa721c0778 100644
--- a/clang/test/CIR/CodeGen/bitint.c
+++ b/clang/test/CIR/CodeGen/bitint.c
@@ -1,6 +1...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/215026
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to