[clang] [CIR] Avoid duplicate ABI result extension attributes (PR #237558)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 20:05:54 PST 2026


================
@@ -0,0 +1,68 @@
+
+// RUN: cir-opt %s -cir-call-conv-lowering="classification-attr=test_classify" \
+// RUN:   | FileCheck %s
+
+!s8i = !cir.int<s, 8>
+!u8i = !cir.int<u, 8>
+
+#extend_signed_return = {
+  return = { kind = "extend",
+             coerced_type = !cir.int<s, 32>,
+             sign_extend = true },
+  args = [ ]
+}
+
+#extend_unsigned_return = {
+  return = { kind = "extend",
+             coerced_type = !cir.int<u, 32>,
+             sign_extend = false },
+  args = [ ]
+}
+
+module attributes {
+  dlti.dl_spec = #dlti.dl_spec<
+    #dlti.dl_entry<i8, dense<8>: vector<2xi64>>,
+    #dlti.dl_entry<i32, dense<32>: vector<2xi64>>>
+} {
+  // An existing zeroext must be replaced with signext.
+  cir.func @returns_s8() -> (!s8i {llvm.zeroext})
----------------
Siya-05 wrote:

Good point. I traced the return attributes through constructFunctionReturnAttributes() and couldn't find a frontend path that generates this combination. The test explicitly constructs conflicting attributes to exercise the defensive handling in updateResAttrs().

Should we reject this combination during verification instead?

https://github.com/llvm/llvm-project/pull/237558


More information about the cfe-commits mailing list