================
@@ -0,0 +1,94 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-enable-call-conv-lowering -emit-cir %s -o %t.cir
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+// RUN: FileCheck --check-prefix=CIRGLOBAL --input-file=%t.cir %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir 
-clangir-enable-call-conv-lowering -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --check-prefixes=LLVM,LLVM-CIR --input-file=%t-cir.ll %s
+// RUN: FileCheck --check-prefix=DECL --input-file=%t-cir.ll %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefixes=LLVM,LLVM-OGCG --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=DECL --input-file=%t.ll %s
+
+// Module-level items, which the two backends order differently against the
+// function definitions, so DECL has no label blocks to be constrained by.
+// DECL-DAG: declare void @make_big(ptr dead_on_unwind writable 
sret(%struct.Big) align 8, i32 noundef)
+// DECL-DAG: declare i64 @make_pair(i32 noundef)
+// DECL-DAG: @g_big = global ptr @make_big, align 8
+// DECL-DAG: @g_arr = global [1 x ptr] [ptr @make_big], align 8
+// DECL-DAG: @g_rec = global %struct.HolderS { ptr @make_big }, align 8
+
+typedef struct { long a, b, c, d; } Big;
+typedef struct { int x, y; } Pair2;
+
+Big make_big(int);
+Pair2 make_pair(int);
+
+typedef Big (*BigFP)(int);
+typedef Pair2 (*PairFP)(int);
+
+// Global initializers hold a GlobalViewAttr, not a cir.get_global.
+BigFP g_big = make_big;
+BigFP g_arr[1] = { make_big };
+struct HolderS { BigFP p; };
+struct HolderS g_rec = { make_big };
+
+// CIRGLOBAL-DAG: cir.global external @g_big = #cir.global_view<@make_big> : 
!cir.ptr<!cir.func<(!s32i) -> !rec_Big>>
----------------
andykaylor wrote:

I really don't like the fact that we're leaving this global value with the 
wrong type. Is there no way we can fix that?

What happens to code that calls using this global? Do we create a bitcast 
before the call?

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

Reply via email to