================
@@ -0,0 +1,116 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++17 -fclangir 
-Wno-unused-value -emit-cir -mmlir -mlir-print-ir-before=cir-cxxabi-lowering %s 
-o %t.cir 2> %t-before.cir
+// RUN: FileCheck --check-prefix=CIR,CIR-BEFORE --input-file=%t-before.cir %s
+// RUN: FileCheck --check-prefix=CIR,CIR-AFTER --input-file=%t.cir %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++17 -fclangir 
-Wno-unused-value -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --check-prefix=LLVM,LLVMCIR --input-file=%t-cir.ll %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++17 
-Wno-unused-value -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=LLVM,OGCG --input-file=%t.ll %s
+
+// 'S' doesn't end up in the 'after' IR because it loses its uses.
+// CIR-BEFORE-DAG: !rec_S = !cir.struct<"S" {!s32i}>
+
+// CIR-BEFORE-DAG: !rec_inner_aggregate = !cir.union<"inner_aggregate" 
{!cir.data_member<!s32i in !rec_S>, !s32i}>
+// CIR-AFTER-DAG:  !rec_inner_aggregate = !cir.union<"inner_aggregate" {!s64i, 
!s32i}>
+// LLVM-DAG: %union.inner_aggregate = type { i64 }
+
+// CIR-BEFORE-DAG: !rec_inner_aggregate2 = !cir.union<"inner_aggregate2" 
{!s32i, !cir.data_member<!s32i in !rec_S>}>
+// CIR-AFTER-DAG:  !rec_inner_aggregate2 = !cir.union<"inner_aggregate2" 
{!s32i, !s64i}>
+// In LLVM, inner_aggregate2 was lowered to a literal, so the type went away.
+
+// CIR-BEFORE-DAG: !rec_outer_aggregate = !cir.union<"outer_aggregate" 
{!cir.data_member<!s32i in !rec_S>, !s32i}>
+// CIR-AFTER-DAG:  !rec_outer_aggregate = !cir.union<"outer_aggregate" {!s64i, 
!s32i}>
+// LLVM-DAG: %union.outer_aggregate = type { i64 }
+
+// CIR-BEFORE-DAG: !rec_outer_aggregate2 = !cir.union<"outer_aggregate2" 
{!s32i, !cir.data_member<!s32i in !rec_S>}>
+// CIR-AFTER-DAG:  !rec_outer_aggregate2 = !cir.union<"outer_aggregate2" 
{!s32i, !s64i}>
+// LLVM-DAG: %union.inner_aggregate2 = type { i64 }
+
+// CIR-BEFORE-DAG: !rec_outer_aggregate3 = !cir.union<"outer_aggregate3" 
{!cir.data_member<!s32i in !rec_S>, !s32i}>
+// CIR-AFTER-DAG:  !rec_outer_aggregate3 = !cir.union<"outer_aggregate3" 
{!s64i, !s32i}>
+// LLVM-DAG: %union.outer_aggregate3 = type { i64 }
+
+// This gets promoted to a constant, so it is up here.
+// CIR-AFTER-DAG: cir.global "private" constant cir_private 
@__const._Z1fv.inner_a2 = #cir.const_record<{#cir.int<12> : !s32i}> : 
!rec_inner_aggregate2
+// LLVM-DAG: @__const._Z1fv.inner_a2 = private {{.*}}constant { i32, [4 x i8] 
} { i32 12, [4 x i8] undef }
----------------
erichkeane wrote:

Note this is going to fail(it gets lowered to a single i64 with this patch + 
trunk), until #210146 gets merged.  I'll make sure tehse are serialized 
correctly.

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

Reply via email to