diff options
Diffstat (limited to 'clang/test/CIR/CodeGen')
25 files changed, 243 insertions, 120 deletions
diff --git a/clang/test/CIR/CodeGen/array.cpp b/clang/test/CIR/CodeGen/array.cpp index d7488bf..82add4b 100644 --- a/clang/test/CIR/CodeGen/array.cpp +++ b/clang/test/CIR/CodeGen/array.cpp @@ -123,7 +123,7 @@ void func() { // CIR: %[[TMP:.*]] = cir.load{{.*}} %[[ELE_PTR]] : !cir.ptr<!s32i>, !s32i // CIR" cir.store %[[TMP]], %[[INIT_2]] : !s32i, !cir.ptr<!s32i> -// LLVM: define{{.*}} void @_Z4funcv() +// LLVM: define{{.*}} void @_Z4funcv(){{.*}} // LLVM-NEXT: %[[ARR:.*]] = alloca [10 x i32], i64 1, align 16 // LLVM-NEXT: %[[INIT:.*]] = alloca i32, i64 1, align 4 // LLVM-NEXT: %[[INIT_2:.*]] = alloca i32, i64 1, align 4 @@ -174,7 +174,7 @@ void func2() { // CIR: cir.condition(%[[CMP]]) // CIR: } -// LLVM: define{{.*}} void @_Z5func2v() +// LLVM: define{{.*}} void @_Z5func2v(){{.*}} // LLVM: %[[ARR:.*]] = alloca [2 x i32], i64 1, align 4 // LLVM: %[[TMP:.*]] = alloca ptr, i64 1, align 8 // LLVM: %[[ARR_PTR:.*]] = getelementptr i32, ptr %[[ARR]], i32 0 @@ -224,7 +224,7 @@ void func3() { // CIR: %[[ELE_TMP:.*]] = cir.load{{.*}} %[[ELE_PTR]] : !cir.ptr<!s32i>, !s32i // CIR: cir.store{{.*}} %[[ELE_TMP]], %[[INIT]] : !s32i, !cir.ptr<!s32i> -// LLVM: define{{.*}} void @_Z5func3v() +// LLVM: define{{.*}} void @_Z5func3v(){{.*}} // LLVM: %[[ARR:.*]] = alloca [2 x i32], i64 1, align 4 // LLVM: %[[IDX:.*]] = alloca i32, i64 1, align 4 // LLVM: %[[INIT:.*]] = alloca i32, i64 1, align 4 @@ -276,7 +276,7 @@ void func4() { // CIR: %[[TMP:.*]] = cir.load{{.*}} %[[ELE_0]] : !cir.ptr<!s32i>, !s32i // CIR: cir.store{{.*}} %[[TMP]], %[[INIT]] : !s32i, !cir.ptr<!s32i> -// LLVM: define{{.*}} void @_Z5func4v() +// LLVM: define{{.*}} void @_Z5func4v(){{.*}} // LLVM: %[[ARR:.*]] = alloca [2 x [1 x i32]], i64 1, align 4 // LLVM: %[[INIT:.*]] = alloca i32, i64 1, align 4 // LLVM: %[[ARR_PTR:.*]] = getelementptr [1 x i32], ptr %[[ARR]], i32 0 @@ -329,7 +329,7 @@ void func5() { // CIR: cir.condition(%[[CMP]]) // CIR: } -// LLVM: define{{.*}} void @_Z5func5v() +// LLVM: define{{.*}} void @_Z5func5v(){{.*}} // LLVM: %[[ARR:.*]] = alloca [2 x [1 x i32]], i64 1, align 4 // LLVM: %[[TMP:.*]] = alloca ptr, i64 1, align 8 // LLVM: %[[ARR_PTR:.*]] = getelementptr [1 x i32], ptr %[[ARR]], i32 0 @@ -372,7 +372,7 @@ void func6() { // CIR: %[[V1:.*]] = cir.const #cir.int<5> : !s32i // CIR: cir.store{{.*}} %[[V1]], %[[ELE_PTR]] : !s32i, !cir.ptr<!s32i> -// LLVM: define{{.*}} void @_Z5func6v() +// LLVM: define{{.*}} void @_Z5func6v(){{.*}} // LLVM: %[[VAR:.*]] = alloca i32, i64 1, align 4 // LLVM: %[[ARR:.*]] = alloca [2 x i32], i64 1, align 4 // LLVM: store i32 4, ptr %[[VAR]], align 4 @@ -414,7 +414,7 @@ void func7() { // CIR: cir.condition(%[[CMP]]) // CIR: } -// LLVM: define{{.*}} void @_Z5func7v() +// LLVM: define{{.*}} void @_Z5func7v(){{.*}} // LLVM: %[[ARR:.*]] = alloca [1 x ptr], i64 1, align 8 // LLVM: %[[TMP:.*]] = alloca ptr, i64 1, align 8 // LLVM: %[[ARR_PTR:.*]] = getelementptr ptr, ptr %[[ARR]], i32 0 @@ -458,7 +458,7 @@ void func8(int arr[10]) { // CIR: %[[TMP_4:.*]] = cir.load{{.*}} %[[ELE_1]] : !cir.ptr<!s32i>, !s32i // CIR: cir.store{{.*}} %[[TMP_4]], %[[INIT_2]] : !s32i, !cir.ptr<!s32i> -// LLVM: define{{.*}} void @_Z5func8Pi(ptr %[[ARG:.*]]) +// LLVM: define{{.*}} void @_Z5func8Pi(ptr %[[ARG:.*]]){{.*}} // LLVM: %[[ARR:.*]] = alloca ptr, i64 1, align 8 // LLVM: %[[INIT:.*]] = alloca i32, i64 1, align 4 // LLVM: %[[INIT_2:.*]] = alloca i32, i64 1, align 4 @@ -502,7 +502,7 @@ void func9(int arr[10][5]) { // CIR: %[[TMP_2:.*]] = cir.load{{.*}} %[[ARR_1_2]] : !cir.ptr<!s32i>, !s32i // CIR: cir.store{{.*}} %[[TMP_2]], %[[INIT]] : !s32i, !cir.ptr<!s32i> -// LLVM: define{{.*}} void @_Z5func9PA5_i(ptr %[[ARG:.*]]) +// LLVM: define{{.*}} void @_Z5func9PA5_i(ptr %[[ARG:.*]]){{.*}} // LLVM: %[[ARR:.*]] = alloca ptr, i64 1, align 8 // LLVM: %[[INIT:.*]] = alloca i32, i64 1, align 4 // LLVM: store ptr %[[ARG]], ptr %[[ARR]], align 8 @@ -536,7 +536,7 @@ void func10(int *a) { // CIR: %[[TMP_2:.*]] = cir.load{{.*}} %[[ELE]] : !cir.ptr<!s32i>, !s32i // CIR: cir.store{{.*}} %[[TMP_2]], %[[INIT]] : !s32i, !cir.ptr<!s32i> -// LLVM: define{{.*}} void @_Z6func10Pi(ptr %[[ARG:.*]]) { +// LLVM: define{{.*}} void @_Z6func10Pi(ptr %[[ARG:.*]]){{.*}} { // LLVM: %[[ARR:.*]] = alloca ptr, i64 1, align 8 // LLVM: %[[INIT:.*]] = alloca i32, i64 1, align 4 // LLVM: store ptr %[[ARG]], ptr %[[ARR]], align 8 diff --git a/clang/test/CIR/CodeGen/assign-operator.cpp b/clang/test/CIR/CodeGen/assign-operator.cpp index 1089d4b..66d4b48 100644 --- a/clang/test/CIR/CodeGen/assign-operator.cpp +++ b/clang/test/CIR/CodeGen/assign-operator.cpp @@ -20,7 +20,7 @@ void a() { // CIR: %[[ONE_CAST:.*]] = cir.cast integral %[[ONE]] : !u32i -> !s32i // CIR: %[[RET:.*]] = cir.call @_ZN1xaSEi(%[[A_ADDR]], %[[ONE_CAST]]) : (!cir.ptr<!rec_x>, !s32i) -> !s32i -// LLVM: define{{.*}} @_Z1av() +// LLVM: define{{.*}} @_Z1av(){{.*}} // OGCG: define{{.*}} @_Z1av() void f(int i, int j) { @@ -121,7 +121,7 @@ void copy_ref_to_ref(E &e1, E &e2) { // CIR: %[[D1_REF_2:.*]] = cir.call @_ZN1DaSERKS_(%[[D1_REF]], %[[D2_REF]]) // CIR: cir.return -// LLVM: define{{.*}} void @_Z15copy_ref_to_refR1ES0_(ptr %[[ARG0:.*]], ptr %[[ARG1:.*]]) { +// LLVM: define{{.*}} void @_Z15copy_ref_to_refR1ES0_(ptr %[[ARG0:.*]], ptr %[[ARG1:.*]]){{.*}} { // LLVM: %[[E1_ADDR:.*]] = alloca ptr // LLVM: %[[E2_ADDR:.*]] = alloca ptr // LLVM: store ptr %[[ARG0]], ptr %[[E1_ADDR]] diff --git a/clang/test/CIR/CodeGen/binassign.c b/clang/test/CIR/CodeGen/binassign.c index 65bea4d..dab9879 100644 --- a/clang/test/CIR/CodeGen/binassign.c +++ b/clang/test/CIR/CodeGen/binassign.c @@ -17,7 +17,7 @@ void binary_assign(void) { i = 42; } -// CIR-LABEL: cir.func{{.*}} @binary_assign() { +// CIR-LABEL: cir.func{{.*}} @binary_assign() // CIR: %[[B:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["b"] // CIR: %[[C:.*]] = cir.alloca !s8i, !cir.ptr<!s8i>, ["c"] // CIR: %[[F:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["f"] @@ -33,7 +33,7 @@ void binary_assign(void) { // CIR: cir.store{{.*}} %[[INT_VAL]], %[[I]] : !s32i, !cir.ptr<!s32i> // CIR: cir.return -// LLVM-LABEL: define {{.*}}void @binary_assign() { +// LLVM-LABEL: define {{.*}}void @binary_assign(){{.*}} { // LLVM: %[[B_PTR:.*]] = alloca i8 // LLVM: %[[C_PTR:.*]] = alloca i8 // LLVM: %[[F_PTR:.*]] = alloca float diff --git a/clang/test/CIR/CodeGen/bitfields_be.c b/clang/test/CIR/CodeGen/bitfields_be.c index 77741ba..3e1f054 100644 --- a/clang/test/CIR/CodeGen/bitfields_be.c +++ b/clang/test/CIR/CodeGen/bitfields_be.c @@ -27,7 +27,7 @@ int init(S* s) { //CIR: [[TMP2:%.*]] = cir.get_member [[TMP1]][0] {name = "c"} : !cir.ptr<!rec_S> -> !cir.ptr<!u32i> //CIR: [[TMP3:%.*]] = cir.get_bitfield align(4) (#bfi_c, [[TMP2]] : !cir.ptr<!u32i>) -> !s32i -//LLVM: define dso_local i32 @init(ptr %0) { +//LLVM: define dso_local i32 @init(ptr %0){{.*}} { //LLVM: [[TMP0:%.*]] = alloca ptr, i64 1, align 8 //LLVM: [[TMP1:%.*]] = alloca i32, i64 1, align 4 //LLVM: [[TMP2:%.*]] = load ptr, ptr [[TMP0]], align 8 @@ -59,7 +59,7 @@ void load(S* s) { // CIR: %[[GET0:.*]] = cir.get_member %[[VAL0]][0] {name = "a"} : !cir.ptr<!rec_S> -> !cir.ptr<!u32i> // CIR: %[[SET0:.*]] = cir.set_bitfield align(4) (#bfi_a, %[[GET0]] : !cir.ptr<!u32i>, %[[MIN1]] : !s32i) -> !s32i -// LLVM: define dso_local void @load +// LLVM: define dso_local void @load{{.*}}{{.*}} // LLVM: %[[PTR0:.*]] = load ptr // LLVM: %[[GET0:.*]] = getelementptr %struct.S, ptr %[[PTR0]], i32 0, i32 0 // LLVM: %[[VAL0:.*]] = load i32, ptr %[[GET0]], align 4 diff --git a/clang/test/CIR/CodeGen/builtin_call.cpp b/clang/test/CIR/CodeGen/builtin_call.cpp index a30df97..a08a784 100644 --- a/clang/test/CIR/CodeGen/builtin_call.cpp +++ b/clang/test/CIR/CodeGen/builtin_call.cpp @@ -82,7 +82,7 @@ void library_builtins() { __builtin_abort(); } -// CIR: cir.func{{.*}} @_Z16library_builtinsv() { +// CIR: cir.func{{.*}} @_Z16library_builtinsv() // CIR: %[[NULL:.+]] = cir.const #cir.ptr<null> : !cir.ptr<!s8i> // CIR: cir.call @printf(%[[NULL]]) nothrow : (!cir.ptr<!s8i>) -> !s32i // CIR: cir.call @abort() nothrow : () -> () diff --git a/clang/test/CIR/CodeGen/builtin_printf.cpp b/clang/test/CIR/CodeGen/builtin_printf.cpp index 898984a..7200df1 100644 --- a/clang/test/CIR/CodeGen/builtin_printf.cpp +++ b/clang/test/CIR/CodeGen/builtin_printf.cpp @@ -20,7 +20,7 @@ void func(char const * const str, int i) { // CIR: cir.func{{.*}} @printf(!cir.ptr<!s8i>, ...) -> !s32i -// CIR: cir.func{{.*}} @_Z4funcPKci(%[[arg0:.+]]: !cir.ptr<!s8i>{{.*}}, %[[arg1:.+]]: !s32i{{.*}}) { +// CIR: cir.func{{.*}} @_Z4funcPKci(%[[arg0:.+]]: !cir.ptr<!s8i>{{.*}}, %[[arg1:.+]]: !s32i // CIR: %[[str_ptr:.+]] = cir.alloca !cir.ptr<!s8i>, !cir.ptr<!cir.ptr<!s8i>>, ["str", init, const] // CIR: %[[i_ptr:.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["i", init] // CIR: cir.store %[[arg0]], %[[str_ptr]] : !cir.ptr<!s8i>, !cir.ptr<!cir.ptr<!s8i>> diff --git a/clang/test/CIR/CodeGen/call.c b/clang/test/CIR/CodeGen/call.c index 9d516c6..d780e37 100644 --- a/clang/test/CIR/CodeGen/call.c +++ b/clang/test/CIR/CodeGen/call.c @@ -16,11 +16,11 @@ void f2(void) { f1(s); } -// CIR-LABEL: cir.func{{.*}} @f2() +// CIR-LABEL: cir.func{{.*}} @f2(){{.*}} { // CIR: %[[S:.+]] = cir.load align(4) %{{.+}} : !cir.ptr<!rec_S>, !rec_S // CIR-NEXT: cir.call @f1(%[[S]]) : (!rec_S) -> () -// LLVM-LABEL: define{{.*}} void @f2() +// LLVM-LABEL: define{{.*}} void @f2(){{.*}} // LLVM: %[[S:.+]] = load %struct.S, ptr %{{.+}}, align 4 // LLVM-NEXT: call void @f1(%struct.S %[[S]]) @@ -33,11 +33,11 @@ void f4(void) { struct S s = f3(); } -// CIR-LABEL: cir.func{{.*}} @f4() { +// CIR-LABEL: cir.func{{.*}} @f4(){{.*}} { // CIR: %[[S:.+]] = cir.call @f3() : () -> !rec_S // CIR-NEXT: cir.store align(4) %[[S]], %{{.+}} : !rec_S, !cir.ptr<!rec_S> -// LLVM-LABEL: define{{.*}} void @f4() { +// LLVM-LABEL: define{{.*}} void @f4(){{.*}} { // LLVM: %[[S:.+]] = call %struct.S @f3() // LLVM-NEXT: store %struct.S %[[S]], ptr %{{.+}}, align 4 @@ -57,11 +57,11 @@ void f7(void) { f5(b); } -// CIR-LABEL: cir.func{{.*}} @f7() +// CIR-LABEL: cir.func{{.*}} @f7(){{.*}} { // CIR: %[[B:.+]] = cir.load align(4) %{{.+}} : !cir.ptr<!rec_Big>, !rec_Big // CIR-NEXT: cir.call @f5(%[[B]]) : (!rec_Big) -> () -// LLVM-LABEL: define{{.*}} void @f7() { +// LLVM-LABEL: define{{.*}} void @f7(){{.*}} { // LLVM: %[[B:.+]] = load %struct.Big, ptr %{{.+}}, align 4 // LLVM-NEXT: call void @f5(%struct.Big %[[B]]) @@ -73,11 +73,11 @@ void f8(void) { struct Big b = f6(); } -// CIR-LABEL: cir.func{{.*}} @f8() +// CIR-LABEL: cir.func{{.*}} @f8(){{.*}} { // CIR: %[[B:.+]] = cir.call @f6() : () -> !rec_Big // CIR: cir.store align(4) %[[B]], %{{.+}} : !rec_Big, !cir.ptr<!rec_Big> -// LLVM-LABEL: define{{.*}} void @f8() { +// LLVM-LABEL: define{{.*}} void @f8(){{.*}} { // LLVM: %[[B:.+]] = call %struct.Big @f6() // LLVM-NEXT: store %struct.Big %[[B]], ptr %{{.+}}, align 4 @@ -89,14 +89,14 @@ void f9(void) { f1(f3()); } -// CIR-LABEL: cir.func{{.*}} @f9() +// CIR-LABEL: cir.func{{.*}} @f9(){{.*}} { // CIR: %[[SLOT:.+]] = cir.alloca !rec_S, !cir.ptr<!rec_S>, ["agg.tmp0"] {alignment = 4 : i64} // CIR-NEXT: %[[RET:.+]] = cir.call @f3() : () -> !rec_S // CIR-NEXT: cir.store align(4) %[[RET]], %[[SLOT]] : !rec_S, !cir.ptr<!rec_S> // CIR-NEXT: %[[ARG:.+]] = cir.load align(4) %[[SLOT]] : !cir.ptr<!rec_S>, !rec_S // CIR-NEXT: cir.call @f1(%[[ARG]]) : (!rec_S) -> () -// LLVM-LABEL: define{{.*}} void @f9() { +// LLVM-LABEL: define{{.*}} void @f9(){{.*}} { // LLVM: %[[SLOT:.+]] = alloca %struct.S, i64 1, align 4 // LLVM-NEXT: %[[RET:.+]] = call %struct.S @f3() // LLVM-NEXT: store %struct.S %[[RET]], ptr %[[SLOT]], align 4 @@ -116,13 +116,13 @@ int f12(void) { return f10(1) + f11(2); } -// CIR-LABEL: cir.func{{.*}} @f12() -> !s32i +// CIR-LABEL: cir.func{{.*}} @f12() -> !s32i{{.*}} { // CIR: %[[A:.+]] = cir.const #cir.int<1> : !s32i // CIR-NEXT: %{{.+}} = cir.call @f10(%[[A]]) side_effect(pure) : (!s32i) -> !s32i // CIR-NEXT: %[[B:.+]] = cir.const #cir.int<2> : !s32i // CIR-NEXT: %{{.+}} = cir.call @f11(%[[B]]) side_effect(const) : (!s32i) -> !s32i -// LLVM-LABEL: define{{.*}} i32 @f12() +// LLVM-LABEL: define{{.*}} i32 @f12(){{.*}} // LLVM: %{{.+}} = call i32 @f10(i32 1) #[[ATTR0:.+]] // LLVM-NEXT: %{{.+}} = call i32 @f11(i32 2) #[[ATTR1:.+]] diff --git a/clang/test/CIR/CodeGen/call.cpp b/clang/test/CIR/CodeGen/call.cpp index 3e8cfc1..affa8af 100644 --- a/clang/test/CIR/CodeGen/call.cpp +++ b/clang/test/CIR/CodeGen/call.cpp @@ -12,7 +12,7 @@ void f2() { // CIR-LABEL: cir.func{{.*}} @_Z2f2v // CIR: cir.call @_Z2f1v() : () -> () -// LLVM-LABEL: define{{.*}} void @_Z2f2v() { +// LLVM-LABEL: define{{.*}} void @_Z2f2v(){{.*}} { // LLVM: call void @_Z2f1v() int f3() { return 2; } @@ -25,7 +25,7 @@ int f4() { // CIR-LABEL: cir.func{{.*}} @_Z2f4v() -> !s32i // CIR: cir.call @_Z2f3v() : () -> !s32i -// LLVM-LABEL: define{{.*}} i32 @_Z2f4v() { +// LLVM-LABEL: define{{.*}} i32 @_Z2f4v(){{.*}} { // LLVM: %{{.+}} = call i32 @_Z2f3v() int f5(int a, int *b, bool c); @@ -40,7 +40,7 @@ int f6() { // CIR-NEXT: %[[#c:]] = cir.const #false // CIR-NEXT: %{{.+}} = cir.call @_Z2f5iPib(%[[#a]], %[[#b:]], %[[#c]]) : (!s32i, !cir.ptr<!s32i>, !cir.bool) -> !s32i -// LLVM-LABEL: define{{.*}} i32 @_Z2f6v() { +// LLVM-LABEL: define{{.*}} i32 @_Z2f6v(){{.*}} { // LLVM: %{{.+}} = call i32 @_Z2f5iPib(i32 2, ptr %{{.+}}, i1 false) int f7(int (*ptr)(int, int)) { @@ -67,7 +67,7 @@ void f9() { // CIR: cir.call @_Z2f8iz(%{{.+}}) : (!s32i) -> () // CIR: cir.call @_Z2f8iz(%{{.+}}, %{{.+}}, %{{.+}}, %{{.+}}) : (!s32i, !s32i, !s32i, !s32i) -> () -// LLVM-LABEL: define{{.*}} void @_Z2f9v() +// LLVM-LABEL: define{{.*}} void @_Z2f9v(){{.*}} // LLVM: call void (i32, ...) @_Z2f8iz(i32 1) // LLVM: call void (i32, ...) @_Z2f8iz(i32 1, i32 2, i32 3, i32 4) @@ -85,7 +85,7 @@ void f11() { // CIR: %[[#s:]] = cir.call @_Z3f10v() : () -> !rec_S // CIR-NEXT: cir.store align(4) %[[#s]], %{{.+}} : !rec_S, !cir.ptr<!rec_S> -// LLVM-LABEL: define{{.*}} void @_Z3f11v() +// LLVM-LABEL: define{{.*}} void @_Z3f11v(){{.*}} // LLVM: %[[#s:]] = call %struct.S @_Z3f10v() // LLVM-NEXT: store %struct.S %[[#s]], ptr %{{.+}}, align 4 @@ -98,7 +98,7 @@ void f12() { // CIR-NEXT: %[[#ret:]] = cir.call @_Z3f10v() : () -> !rec_S // CIR-NEXT: cir.store align(4) %[[#ret]], %[[#slot]] : !rec_S, !cir.ptr<!rec_S> -// LLVM-LABEL: define{{.*}} void @_Z3f12v() { +// LLVM-LABEL: define{{.*}} void @_Z3f12v(){{.*}} { // LLVM: %[[#slot:]] = alloca %struct.S, i64 1, align 4 // LLVM-NEXT: %[[#ret:]] = call %struct.S @_Z3f10v() // LLVM-NEXT: store %struct.S %[[#ret]], ptr %[[#slot]], align 4 @@ -112,7 +112,7 @@ void f14() { // CIR: cir.call @_Z3f13v() nothrow : () -> () // CIR: } -// LLVM-LABEL: define{{.+}} void @_Z3f14v() +// LLVM-LABEL: define{{.+}} void @_Z3f14v(){{.*}} // LLVM: call void @_Z3f13v() #[[LLVM_ATTR_0:.+]] // LLVM: } @@ -126,7 +126,7 @@ void f16() { // CIR-NEXT: %{{.+}} = cir.call @_Z3f15v() : () -> !s32i // CIR: } -// LLVM-LABEL: define{{.+}} void @_Z3f16v() { +// LLVM-LABEL: define{{.+}} void @_Z3f16v(){{.*}} { // LLVM-NEXT: %{{.+}} = call i32 @_Z3f15v() // LLVM: } diff --git a/clang/test/CIR/CodeGen/cmp.cpp b/clang/test/CIR/CodeGen/cmp.cpp index 7e32d16..1871f94 100644 --- a/clang/test/CIR/CodeGen/cmp.cpp +++ b/clang/test/CIR/CodeGen/cmp.cpp @@ -45,7 +45,7 @@ void c0(int a, int b) { // CIR: %[[B6:.*]] = cir.load{{.*}} %[[B_PTR]] // CIR: %{{.*}} = cir.cmp(eq, %[[A6]], %[[B6]]) : !s32i, !cir.bool -// LLVM-LABEL: define{{.*}} void @_Z2c0ii(i32 %0, i32 %1) { +// LLVM-LABEL: define{{.*}} void @_Z2c0ii(i32 %0, i32 %1){{.*}} { // LLVM: %[[PTR1:.*]] = alloca i32, i64 1 // LLVM: %[[PTR2:.*]] = alloca i32, i64 1 // LLVM: %[[BOOL_PTR:.*]] = alloca i8, i64 1 @@ -170,7 +170,7 @@ void c0_unsigned(unsigned int a, unsigned int b) { // CIR: %[[UB6:.*]] = cir.load{{.*}} %[[U_B_PTR]] // CIR: %{{.*}} = cir.cmp(eq, %[[UA6]], %[[UB6]]) : !u32i, !cir.bool -// LLVM-LABEL: define{{.*}} void @_Z11c0_unsignedjj(i32 %0, i32 %1) { +// LLVM-LABEL: define{{.*}} void @_Z11c0_unsignedjj(i32 %0, i32 %1){{.*}} { // LLVM: %[[U_PTR1:.*]] = alloca i32, i64 1 // LLVM: %[[U_PTR2:.*]] = alloca i32, i64 1 // LLVM: %[[U_BOOL_PTR:.*]] = alloca i8, i64 1 @@ -265,7 +265,7 @@ void c0_float(float a, float b) { x = a == b; } -// CIR-LABEL: cir.func{{.*}} @_Z8c0_floatff(%arg0: !cir.float{{.*}}, %arg1: !cir.float{{.*}}) { +// CIR-LABEL: cir.func{{.*}} @_Z8c0_floatff(%arg0: !cir.float{{.*}}, %arg1: !cir.float{{.*}}) // CIR: %[[A_PTR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["a", init] // CIR: %[[B_PTR:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["b", init] // CIR: %[[X_PTR:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["x", init] @@ -303,7 +303,7 @@ void c0_float(float a, float b) { // CIR: %[[CMP6:.*]] = cir.cmp(eq, %[[A6]], %[[B6]]) : !cir.float, !cir.bool // CIR: cir.store{{.*}} %[[CMP6]], %[[X_PTR]] : !cir.bool, !cir.ptr<!cir.bool> -// LLVM-LABEL: define{{.*}} void @_Z8c0_floatff(float %0, float %1) { +// LLVM-LABEL: define{{.*}} void @_Z8c0_floatff(float %0, float %1){{.*}} { // LLVM: %[[A_PTR:.*]] = alloca float // LLVM: %[[B_PTR:.*]] = alloca float // LLVM: store float %0, ptr %[[A_PTR]] @@ -346,7 +346,7 @@ void pointer_cmp(int *a, int *b) { x = a != b; } -// CIR-LABEL: cir.func{{.*}} @_Z11pointer_cmpPiS_(%arg0: !cir.ptr<!s32i>{{.*}}, %arg1: !cir.ptr<!s32i>{{.*}}) { +// CIR-LABEL: cir.func{{.*}} @_Z11pointer_cmpPiS_(%arg0: !cir.ptr<!s32i>{{.*}}, %arg1: !cir.ptr<!s32i>{{.*}}){{.*}} { // CIR: %[[A_PTR:.*]] = cir.alloca !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>, ["a", init] // CIR: %[[B_PTR:.*]] = cir.alloca !cir.ptr<!s32i>, !cir.ptr<!cir.ptr<!s32i>>, ["b", init] @@ -360,7 +360,7 @@ void pointer_cmp(int *a, int *b) { // CIR: cir.cmp(eq, {{.*}}, {{.*}}) : !cir.ptr<!s32i>, !cir.bool // CIR: cir.cmp(ne, {{.*}}, {{.*}}) : !cir.ptr<!s32i>, !cir.bool -// LLVM-LABEL: define{{.*}} void @_Z11pointer_cmpPiS_(ptr %0, ptr %1) { +// LLVM-LABEL: define{{.*}} void @_Z11pointer_cmpPiS_(ptr %0, ptr %1){{.*}} { // LLVM: %[[A_PTR:.*]] = alloca ptr // LLVM: %[[B_PTR:.*]] = alloca ptr // LLVM: store ptr %0, ptr %[[A_PTR]] @@ -401,7 +401,7 @@ void bool_cmp(bool a, bool b) { x = a != b; } -// CIR-LABEL: cir.func{{.*}} @_Z8bool_cmpbb(%arg0: !cir.bool{{.*}}, %arg1: !cir.bool{{.*}}) { +// CIR-LABEL: cir.func{{.*}} @_Z8bool_cmpbb(%arg0: !cir.bool{{.*}}, %arg1: !cir.bool{{.*}}){{.*}} { // CIR: %[[A_PTR:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["a", init] // CIR: %[[B_PTR:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["b", init] // CIR: %[[X_PTR:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["x", init] @@ -419,7 +419,7 @@ void bool_cmp(bool a, bool b) { // CIR: cir.cmp(eq // CIR: cir.cmp(ne -// LLVM-LABEL: define{{.*}} void @_Z8bool_cmpbb(i1 %0, i1 %1) { +// LLVM-LABEL: define{{.*}} void @_Z8bool_cmpbb(i1 %0, i1 %1){{.*}} { // LLVM: %[[A_PTR:.*]] = alloca i8 // LLVM: %[[B_PTR:.*]] = alloca i8 // LLVM: %[[X_PTR:.*]] = alloca i8 diff --git a/clang/test/CIR/CodeGen/comma.c b/clang/test/CIR/CodeGen/comma.c index cc26a3f..c0bc442 100644 --- a/clang/test/CIR/CodeGen/comma.c +++ b/clang/test/CIR/CodeGen/comma.c @@ -16,7 +16,7 @@ void comma(void) { i = 100, 200; } -// CIR-LABEL: cir.func{{.*}} @comma() { +// CIR-LABEL: cir.func{{.*}} @comma() // CIR: %[[B:.*]] = cir.alloca !cir.bool, !cir.ptr<!cir.bool>, ["b"] // CIR: %[[C:.*]] = cir.alloca !s8i, !cir.ptr<!s8i>, ["c"] // CIR: %[[F:.*]] = cir.alloca !cir.float, !cir.ptr<!cir.float>, ["f"] @@ -34,7 +34,7 @@ void comma(void) { // CIR: cir.store{{.*}} %[[HUNDRED]], %[[I]] : !s32i, !cir.ptr<!s32i> // CIR: cir.return -// LLVM-LABEL: define {{.*}}void @comma() { +// LLVM-LABEL: define {{.*}}void @comma(){{.*}} { // LLVM: %[[B_PTR:.*]] = alloca i8 // LLVM: %[[C_PTR:.*]] = alloca i8 // LLVM: %[[F_PTR:.*]] = alloca float diff --git a/clang/test/CIR/CodeGen/ctor.cpp b/clang/test/CIR/CodeGen/ctor.cpp index 2b06bb0..238e415 100644 --- a/clang/test/CIR/CodeGen/ctor.cpp +++ b/clang/test/CIR/CodeGen/ctor.cpp @@ -49,7 +49,7 @@ void bar() { // CHECK: cir.func{{.*}} @_ZN13VariadicStrukC1Eiz(%arg0: !cir.ptr<!rec_VariadicStruk> // CHECK-SAME: %arg1: !s32i -// CHECK-SAME: ...) { +// CHECK-SAME: ...){{.*}} { // CHECK-NEXT: %[[THIS_ADDR:.*]] = cir.alloca {{.*}} ["this", init] // CHECK-NEXT: %[[N_ADDR:.*]] = cir.alloca {{.*}} ["n", init] // CHECK-NEXT: cir.store %arg0, %[[THIS_ADDR]] diff --git a/clang/test/CIR/CodeGen/dtors.cpp b/clang/test/CIR/CodeGen/dtors.cpp index 7fb0975..cb3886b 100644 --- a/clang/test/CIR/CodeGen/dtors.cpp +++ b/clang/test/CIR/CodeGen/dtors.cpp @@ -17,7 +17,7 @@ void test_temporary_dtor() { // CIR: %[[ALLOCA:.*]] = cir.alloca !rec_A, !cir.ptr<!rec_A>, ["agg.tmp0"] // CIR: cir.call @_ZN1AD1Ev(%[[ALLOCA]]) nothrow : (!cir.ptr<!rec_A>) -> () -// LLVM: define dso_local void @_Z19test_temporary_dtorv() +// LLVM: define dso_local void @_Z19test_temporary_dtorv(){{.*}} // LLVM: %[[ALLOCA:.*]] = alloca %struct.A, i64 1, align 1 // LLVM: call void @_ZN1AD1Ev(ptr %[[ALLOCA]]) @@ -55,7 +55,7 @@ bool test_temp_or() { return make_temp(1) || make_temp(2); } // CIR: cir.yield %[[TERNARY]] : !cir.bool // CIR: } : !cir.bool -// LLVM: define{{.*}} i1 @_Z12test_temp_orv() { +// LLVM: define{{.*}} i1 @_Z12test_temp_orv(){{.*}} { // LLVM: %[[REF_TMP0:.*]] = alloca %struct.B // LLVM: %[[REF_TMP1:.*]] = alloca %struct.B // LLVM: br label %[[LOR_BEGIN:.*]] @@ -125,7 +125,7 @@ bool test_temp_and() { return make_temp(1) && make_temp(2); } // CIR: cir.yield %[[TERNARY]] : !cir.bool // CIR: } : !cir.bool -// LLVM: define{{.*}} i1 @_Z13test_temp_andv() { +// LLVM: define{{.*}} i1 @_Z13test_temp_andv(){{.*}} { // LLVM: %[[REF_TMP0:.*]] = alloca %struct.B // LLVM: %[[REF_TMP1:.*]] = alloca %struct.B // LLVM: br label %[[LAND_BEGIN:.*]] @@ -199,7 +199,7 @@ void test_nested_dtor() { // CIR: cir.func{{.*}} @_Z16test_nested_dtorv() // CIR: cir.call @_ZN1DD2Ev(%{{.*}}) -// LLVM: define {{.*}} void @_Z16test_nested_dtorv() +// LLVM: define {{.*}} void @_Z16test_nested_dtorv(){{.*}} // LLVM: call void @_ZN1DD2Ev(ptr %{{.*}}) // OGCG: define {{.*}} void @_Z16test_nested_dtorv() @@ -236,7 +236,7 @@ void test_base_dtor_call() { // CIR: cir.func {{.*}} @_Z19test_base_dtor_callv() // cir.call @_ZN1FD2Ev(%{{.*}}) nothrow : (!cir.ptr<!rec_F>) -> () -// LLVM: define {{.*}} void @_Z19test_base_dtor_callv() +// LLVM: define {{.*}} void @_Z19test_base_dtor_callv(){{.*}} // LLVM: call void @_ZN1FD2Ev(ptr %{{.*}}) // OGCG: define {{.*}} void @_Z19test_base_dtor_callv() diff --git a/clang/test/CIR/CodeGen/inline-attributes.cpp b/clang/test/CIR/CodeGen/inline-attributes.cpp new file mode 100644 index 0000000..fab4010 --- /dev/null +++ b/clang/test/CIR/CodeGen/inline-attributes.cpp @@ -0,0 +1,75 @@ +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -O1 -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -O1 -fclangir -emit-llvm %s -o %t-cir.ll +// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -O1 -emit-llvm %s -o %t.ll +// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s + +extern int global_var; + +__attribute__((always_inline)) inline int always_inline_function(int x) { + return x * 2 + global_var; +} + +inline int inline_hint_function(int x) { + return x - 1 + global_var; +} + +__attribute__((noinline)) int noinline_function(int x) { + return x / 2 + global_var; +} + +int regular_function(int x) { + return x + 1 + global_var; +} + +// Force emission of all functions with function pointers +int (*always_inline_ptr)(int) = &always_inline_function; +int (*inline_hint_ptr)(int) = &inline_hint_function; +int (*noinline_ptr)(int) = &noinline_function; +int (*regular_ptr)(int) = ®ular_function; + +// CIR-LABEL: cir.func dso_local @_Z17noinline_functioni(%arg0: !s32i {{.*}}) -> !s32i inline(never) + +// CIR-LABEL: cir.func dso_local @_Z16regular_functioni(%arg0: !s32i {{.*}}) -> !s32i +// CIR-NOT: inline(never) +// CIR-NOT: inline(always) +// CIR-NOT: inline(hint) +// CIR-SAME: { + +// CIR-LABEL: cir.func {{.*}}@_Z22always_inline_functioni(%arg0: !s32i {{.*}}) -> !s32i inline(always) + +// CIR-LABEL: cir.func {{.*}}@_Z20inline_hint_functioni(%arg0: !s32i {{.*}}) -> !s32i inline(hint) + +// LLVM: ; Function Attrs:{{.*}} noinline +// LLVM: define{{.*}} i32 @_Z17noinline_functioni + +// LLVM: ; Function Attrs: +// LLVM-NOT: noinline +// LLVM-NOT: alwaysinline +// LLVM-NOT: inlinehint +// LLVM-SAME: {{$}} +// LLVM: define{{.*}} i32 @_Z16regular_functioni + +// LLVM: ; Function Attrs:{{.*}} alwaysinline +// LLVM: define{{.*}} i32 @_Z22always_inline_functioni + +// LLVM: ; Function Attrs:{{.*}} inlinehint +// LLVM: define{{.*}} i32 @_Z20inline_hint_functioni + +// OGCG: ; Function Attrs:{{.*}} noinline +// OGCG: define{{.*}} i32 @_Z17noinline_functioni + +// OGCG: ; Function Attrs: +// OGCG-NOT: noinline +// OGCG-NOT: alwaysinline +// OGCG-NOT: inlinehint +// OGCG-SAME: {{$}} +// OGCG: define{{.*}} i32 @_Z16regular_functioni + +// OGCG: ; Function Attrs:{{.*}} alwaysinline +// OGCG: define{{.*}} i32 @_Z22always_inline_functioni + +// OGCG: ; Function Attrs:{{.*}} inlinehint +// OGCG: define{{.*}} i32 @_Z20inline_hint_functioni + diff --git a/clang/test/CIR/CodeGen/label.c b/clang/test/CIR/CodeGen/label.c index f5345ef..fd3c7f2 100644 --- a/clang/test/CIR/CodeGen/label.c +++ b/clang/test/CIR/CodeGen/label.c @@ -41,7 +41,7 @@ labelC: // CIR: cir.label "labelC" // CIR: cir.return -// LLVM: define dso_local void @multiple_labels() +// LLVM: define dso_local void @multiple_labels(){{.*}} // LLVM: br label %1 // LLVM: 1: // LLVM: br label %2 @@ -73,7 +73,7 @@ labelD: // CIR: } // CIR: cir.return -// LLVM: define dso_local void @label_in_if +// LLVM: define dso_local void @label_in_if{{.*}} // LLVM: br label %3 // LLVM: 3: // LLVM: [[LOAD:%.*]] = load i32, ptr [[COND:%.*]], align 4 @@ -115,7 +115,7 @@ void after_return() { // CIR: cir.label "label" // CIR: cir.br ^bb1 -// LLVM: define dso_local void @after_return +// LLVM: define dso_local void @after_return{{.*}} // LLVM: br label %1 // LLVM: 1: // LLVM: ret void @@ -139,7 +139,7 @@ void after_unreachable() { // CIR: cir.label "label" // CIR: cir.return -// LLVM: define dso_local void @after_unreachable +// LLVM: define dso_local void @after_unreachable{{.*}} // LLVM: unreachable // LLVM: 1: // LLVM: ret void @@ -188,7 +188,7 @@ void foo() { // CIR: ^bb1: // CIR: cir.label "label" -// LLVM:define dso_local void @foo() { +// LLVM: define dso_local void @foo(){{.*}} { // LLVM: [[ALLOC:%.*]] = alloca %struct.S, i64 1, align 1 // LLVM: br label %2 // LLVM:2: diff --git a/clang/test/CIR/CodeGen/lambda-static-invoker.cpp b/clang/test/CIR/CodeGen/lambda-static-invoker.cpp index 15d768e..e7d199b 100644 --- a/clang/test/CIR/CodeGen/lambda-static-invoker.cpp +++ b/clang/test/CIR/CodeGen/lambda-static-invoker.cpp @@ -50,7 +50,7 @@ int g3() { // CIR: %[[RET:.*]] = cir.load %[[RETVAL]] // CIR: cir.return %[[RET]] -// LLVM: define internal i32 @"_ZZ2g3vENK3$_0clERKi"(ptr %[[THIS_ARG:.*]], ptr %[[REF_I_ARG:.*]]) { +// LLVM: define internal i32 @"_ZZ2g3vENK3$_0clERKi"(ptr %[[THIS_ARG:.*]], ptr %[[REF_I_ARG:.*]]){{.*}} { // LLVM: %[[THIS_ALLOCA:.*]] = alloca ptr // LLVM: %[[REF_I_ALLOCA:.*]] = alloca ptr // LLVM: %[[RETVAL:.*]] = alloca i32 @@ -66,7 +66,7 @@ int g3() { // In OGCG, the _ZZ2g3vENK3$_0clERKi function is emitted after _ZZ2g3vEN3$_08__invokeERKi, see below. // lambda invoker -// CIR: cir.func internal private dso_local @_ZZ2g3vEN3$_08__invokeERKi(%[[REF_I_ARG:.*]]: !cir.ptr<!s32i> {{.*}}) -> !s32i { +// CIR: cir.func internal private dso_local @_ZZ2g3vEN3$_08__invokeERKi(%[[REF_I_ARG:.*]]: !cir.ptr<!s32i> {{.*}}) -> !s32i{{.*}} { // CIR: %[[REF_I_ALLOCA:.*]] = cir.alloca {{.*}} ["i", init, const] // CIR: %[[RETVAL:.*]] = cir.alloca {{.*}} ["__retval"] // CIR: %[[LAM_ALLOCA:.*]] = cir.alloca ![[REC_LAM_G3]], !cir.ptr<![[REC_LAM_G3]]>, ["unused.capture"] @@ -77,7 +77,7 @@ int g3() { // CIR: %[[RET:.*]] = cir.load %[[RETVAL]] // CIR: cir.return %[[RET]] -// LLVM: define internal i32 @"_ZZ2g3vEN3$_08__invokeERKi"(ptr %[[REF_I_ARG:.*]]) { +// LLVM: define internal i32 @"_ZZ2g3vEN3$_08__invokeERKi"(ptr %[[REF_I_ARG:.*]]){{.*}} { // LLVM: %[[REF_I_ALLOCA:.*]] = alloca ptr // LLVM: %[[RETVAL:.*]] = alloca i32 // LLVM: %[[LAM_ALLOCA:.*]] = alloca %[[REC_LAM_G3:.*]], @@ -91,7 +91,7 @@ int g3() { // In OGCG, the _ZZ2g3vEN3$_08__invokeERKi function is emitted after _ZN1A3barEv, see below. // lambda operator int (*)(int const&)() -// CIR: cir.func internal private dso_local @_ZZ2g3vENK3$_0cvPFiRKiEEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_G3]]> {{.*}}) -> !cir.ptr<!cir.func<(!cir.ptr<!s32i>) -> !s32i>> { +// CIR: cir.func internal private dso_local @_ZZ2g3vENK3$_0cvPFiRKiEEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_G3]]> {{.*}}) -> !cir.ptr<!cir.func<(!cir.ptr<!s32i>) -> !s32i>>{{.*}} { // CIR: %[[THIS_ALLOCA:.*]] = cir.alloca !cir.ptr<![[REC_LAM_G3]]>, !cir.ptr<!cir.ptr<![[REC_LAM_G3]]>>, ["this", init] // CIR: %[[RETVAL:.*]] = cir.alloca !cir.ptr<!cir.func<(!cir.ptr<!s32i>) -> !s32i>>, !cir.ptr<!cir.ptr<!cir.func<(!cir.ptr<!s32i>) -> !s32i>>>, ["__retval"] // CIR: cir.store %[[THIS_ARG]], %[[THIS_ALLOCA]] @@ -101,7 +101,7 @@ int g3() { // CIR: %[[RET:.*]] = cir.load %[[RETVAL]] // CIR: cir.return %[[RET]] -// LLVM: define internal ptr @"_ZZ2g3vENK3$_0cvPFiRKiEEv"(ptr %[[THIS_ARG:.*]]) { +// LLVM: define internal ptr @"_ZZ2g3vENK3$_0cvPFiRKiEEv"(ptr %[[THIS_ARG:.*]]){{.*}} { // LLVM: %[[THIS_ALLOCA:.*]] = alloca ptr // LLVM: %[[RETVAL:.*]] = alloca ptr // LLVM: store ptr %[[THIS_ARG]], ptr %[[THIS_ALLOCA]] @@ -112,7 +112,7 @@ int g3() { // In OGCG, the _ZZ2g3vENK3$_0cvPFiRKiEEv function is emitted just after the _Z2g3v function, see above. -// CIR: cir.func{{.*}} @_Z2g3v() -> !s32i { +// CIR: cir.func{{.*}} @_Z2g3v() -> !s32i{{.*}} { // CIR: %[[RETVAL:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] // CIR: %[[FN_ADDR:.*]] = cir.alloca !cir.ptr<!cir.func<(!cir.ptr<!s32i>) -> !s32i>>, !cir.ptr<!cir.ptr<!cir.func<(!cir.ptr<!s32i>) -> !s32i>>>, ["fn", init] // CIR: %[[TASK:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["task", init] @@ -145,7 +145,7 @@ int g3() { // CIR: cir.return %[[RET]] // CIR: } -// LLVM: define dso_local i32 @_Z2g3v() { +// LLVM: define dso_local i32 @_Z2g3v(){{.*}} { // LLVM: %[[LAM_ALLOCA:.*]] = alloca %[[REC_LAM_G3]] // LLVM: %[[REF_TMP1:.*]] = alloca i32 // LLVM: %[[RETVAL:.*]] = alloca i32 diff --git a/clang/test/CIR/CodeGen/lambda.cpp b/clang/test/CIR/CodeGen/lambda.cpp index 033adc6..0c32ceb1 100644 --- a/clang/test/CIR/CodeGen/lambda.cpp +++ b/clang/test/CIR/CodeGen/lambda.cpp @@ -13,13 +13,13 @@ void fn() { a(); } -// CIR: cir.func lambda internal private dso_local @_ZZ2fnvENK3$_0clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_FN_A:.*]]> {{.*}}) +// CIR: cir.func lambda internal private dso_local @_ZZ2fnvENK3$_0clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_FN_A:.*]]> {{.*}}) {{.*}} { // CIR: %[[THIS:.*]] = cir.alloca !cir.ptr<![[REC_LAM_FN_A]]>, !cir.ptr<!cir.ptr<![[REC_LAM_FN_A]]>>, ["this", init] // CIR: cir.store %[[THIS_ARG]], %[[THIS]] // CIR: cir.load %[[THIS]] // CIR: cir.return -// CIR: cir.func dso_local @_Z2fnv() +// CIR: cir.func dso_local @_Z2fnv() {{.*}} { // CIR: %[[A:.*]] = cir.alloca ![[REC_LAM_FN_A]], !cir.ptr<![[REC_LAM_FN_A]]>, ["a"] // CIR: cir.call @_ZZ2fnvENK3$_0clEv(%[[A]]) @@ -52,7 +52,7 @@ void l0() { a(); } -// CIR: cir.func lambda internal private dso_local @_ZZ2l0vENK3$_0clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_L0_A:.*]]> {{.*}}) +// CIR: cir.func lambda internal private dso_local @_ZZ2l0vENK3$_0clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_L0_A:.*]]> {{.*}}) {{.*}} { // CIR: %[[THIS_ADDR:.*]] = cir.alloca !cir.ptr<![[REC_LAM_L0_A]]>, !cir.ptr<!cir.ptr<![[REC_LAM_L0_A]]>>, ["this", init] {alignment = 8 : i64} // CIR: cir.store %[[THIS_ARG]], %[[THIS_ADDR]] // CIR: %[[THIS:.*]] = cir.load %[[THIS_ADDR]] @@ -66,7 +66,7 @@ void l0() { // CIR: cir.store{{.*}} %[[I_PLUS_ONE]], %[[I_ADDR]] // CIR: cir.return -// CIR: cir.func {{.*}} @_Z2l0v() +// CIR: cir.func {{.*}} @_Z2l0v() {{.*}} { // CIR: %[[I:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["i"] // CIR: %[[A:.*]] = cir.alloca ![[REC_LAM_L0_A]], !cir.ptr<![[REC_LAM_L0_A]]>, ["a", init] // CIR: %[[I_ADDR:.*]] = cir.get_member %[[A]][0] {name = "i"} @@ -124,7 +124,7 @@ auto g() { }; } -// CIR: cir.func dso_local @_Z1gv() -> ![[REC_LAM_G:.*]] { +// CIR: cir.func dso_local @_Z1gv() -> ![[REC_LAM_G:.*]] {{.*}} { // CIR: %[[RETVAL:.*]] = cir.alloca ![[REC_LAM_G]], !cir.ptr<![[REC_LAM_G]]>, ["__retval"] // CIR: %[[I_ADDR:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["i", init] // CIR: %[[TWELVE:.*]] = cir.const #cir.int<12> : !s32i @@ -166,7 +166,7 @@ auto g2() { } // Should be same as above because of NRVO -// CIR: cir.func dso_local @_Z2g2v() -> ![[REC_LAM_G2:.*]] { +// CIR: cir.func dso_local @_Z2g2v() -> ![[REC_LAM_G2:.*]] {{.*}} { // CIR: %[[RETVAL:.*]] = cir.alloca ![[REC_LAM_G2]], !cir.ptr<![[REC_LAM_G2]]>, ["__retval", init] // CIR: %[[I_ADDR:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["i", init] // CIR: %[[TWELVE:.*]] = cir.const #cir.int<12> : !s32i @@ -199,7 +199,7 @@ int f() { return g2()(); } -// CIR:cir.func lambda internal private dso_local @_ZZ2g2vENK3$_0clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_G2]]> {{.*}}) -> !s32i +// CIR:cir.func lambda internal private dso_local @_ZZ2g2vENK3$_0clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_G2]]> {{.*}}) -> !s32i {{.*}} { // CIR: %[[THIS_ADDR:.*]] = cir.alloca !cir.ptr<![[REC_LAM_G2]]>, !cir.ptr<!cir.ptr<![[REC_LAM_G2]]>>, ["this", init] // CIR: %[[RETVAL:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] // CIR: cir.store %[[THIS_ARG]], %[[THIS_ADDR]] @@ -217,7 +217,7 @@ int f() { // CIR: %[[RET:.*]] = cir.load %[[RETVAL]] // CIR: cir.return %[[RET]] -// CIR: cir.func dso_local @_Z1fv() -> !s32i +// CIR: cir.func dso_local @_Z1fv() -> !s32i {{.*}} { // CIR: %[[RETVAL:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] // CIR: %[[SCOPE_RET:.*]] = cir.scope { // CIR: %[[TMP:.*]] = cir.alloca ![[REC_LAM_G2]], !cir.ptr<![[REC_LAM_G2]]>, ["ref.tmp0"] @@ -301,7 +301,7 @@ struct A { // OGCG: call noundef i32 @_ZN1A3barEv(ptr {{.*}} %[[A_THIS]]) // lambda operator() in foo() -// CIR: cir.func lambda comdat linkonce_odr @_ZZN1A3fooEvENKUlvE_clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_A:.*]]> {{.*}}) +// CIR: cir.func lambda comdat linkonce_odr @_ZZN1A3fooEvENKUlvE_clEv(%[[THIS_ARG:.*]]: !cir.ptr<![[REC_LAM_A:.*]]> {{.*}}) {{.*}} { // CIR: %[[THIS_ADDR:.*]] = cir.alloca !cir.ptr<![[REC_LAM_A]]>, !cir.ptr<!cir.ptr<![[REC_LAM_A]]>>, ["this", init] // CIR: %[[RETVAL:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] // CIR: cir.store{{.*}} %[[THIS_ARG]], %[[THIS_ADDR]] @@ -328,7 +328,7 @@ struct A { // The function above is defined after _ZN1A3barEv in OGCG, see below. // A::foo() -// CIR: cir.func {{.*}} @_ZN1A3fooEv(%[[THIS_ARG:.*]]: !cir.ptr<!rec_A> {{.*}}) -> !s32i +// CIR: cir.func {{.*}} @_ZN1A3fooEv(%[[THIS_ARG:.*]]: !cir.ptr<!rec_A> {{.*}}) -> !s32i {{.*}} { // CIR: %[[THIS_ADDR:.*]] = cir.alloca !cir.ptr<!rec_A>, !cir.ptr<!cir.ptr<!rec_A>>, ["this", init] // CIR: %[[RETVAL:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] // CIR: cir.store %[[THIS_ARG]], %[[THIS_ADDR]] @@ -373,7 +373,7 @@ struct A { // OGCG: ret i32 %[[LAM_RET]] // lambda operator() in bar() -// CIR: cir.func {{.*}} @_ZZN1A3barEvENKUlvE_clEv(%[[THIS_ARG2:.*]]: !cir.ptr<![[REC_LAM_PTR_A:.*]]> {{.*}}) -> !s32i +// CIR: cir.func {{.*}} @_ZZN1A3barEvENKUlvE_clEv(%[[THIS_ARG2:.*]]: !cir.ptr<![[REC_LAM_PTR_A:.*]]> {{.*}}) -> !s32i {{.*}} { // CIR: %[[THIS_ADDR:.*]] = cir.alloca !cir.ptr<![[REC_LAM_PTR_A]]>, !cir.ptr<!cir.ptr<![[REC_LAM_PTR_A]]>>, ["this", init] // CIR: %[[RETVAL:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] // CIR: cir.store{{.*}} %[[THIS_ARG]], %[[THIS_ADDR]] @@ -402,7 +402,7 @@ struct A { // The function above is defined after _ZZN1A3fooEvENKUlvE_clEv in OGCG, see below. // A::bar() -// CIR: cir.func {{.*}} @_ZN1A3barEv(%[[THIS_ARG:.*]]: !cir.ptr<!rec_A> {{.*}}) -> !s32i +// CIR: cir.func {{.*}} @_ZN1A3barEv(%[[THIS_ARG:.*]]: !cir.ptr<!rec_A> {{.*}}) -> !s32i {{.*}} { // CIR: %[[THIS_ADDR:.*]] = cir.alloca !cir.ptr<!rec_A>, !cir.ptr<!cir.ptr<!rec_A>>, ["this", init] // CIR: %[[RETVAL:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] // CIR: cir.store %[[THIS_ARG]], %[[THIS_ADDR]] @@ -472,7 +472,7 @@ int test_lambda_this1(){ return x+y; } -// CIR: cir.func {{.*}} @_Z17test_lambda_this1v +// CIR: cir.func {{.*}} @_Z17test_lambda_this1v{{.*}} { // CIR: cir.call @_ZN1AC1Ev(%[[A_THIS:.*]]){{.*}} : (!cir.ptr<!rec_A>) -> () // CIR: cir.call @_ZN1A3fooEv(%[[A_THIS]]){{.*}} : (!cir.ptr<!rec_A>) -> !s32i // CIR: cir.call @_ZN1A3barEv(%[[A_THIS]]){{.*}} : (!cir.ptr<!rec_A>) -> !s32i diff --git a/clang/test/CIR/CodeGen/linkage-spec.cpp b/clang/test/CIR/CodeGen/linkage-spec.cpp index eb6c7b0..1affecd 100644 --- a/clang/test/CIR/CodeGen/linkage-spec.cpp +++ b/clang/test/CIR/CodeGen/linkage-spec.cpp @@ -1,42 +1,42 @@ // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - 2>&1 | FileCheck %s extern "C" void TopLevelC(){} -// CHECK: cir.func{{.*}} @TopLevelC() { +// CHECK: cir.func dso_local @TopLevelC() inline(never) { extern "C++" void TopLevelCpp(){} -// CHECK: cir.func{{.*}} @_Z11TopLevelCppv() { +// CHECK: cir.func dso_local @_Z11TopLevelCppv() inline(never) { extern "C++" { void ExternCppEmpty(){} - // CHECK: cir.func{{.*}} @_Z14ExternCppEmptyv() { + // CHECK: cir.func dso_local @_Z14ExternCppEmptyv() inline(never) { extern "C" void ExternCpp_C(){} - // CHECK: cir.func{{.*}} @ExternCpp_C() { + // CHECK: cir.func dso_local @ExternCpp_C() inline(never) { extern "C++" void ExternCpp_Cpp(){} - // CHECK: cir.func{{.*}} @_Z13ExternCpp_Cppv() { + // CHECK: cir.func dso_local @_Z13ExternCpp_Cppv() inline(never) { extern "C" { void ExternCpp_CEmpty(){} - // CHECK: cir.func{{.*}} @ExternCpp_CEmpty() { + // CHECK: cir.func dso_local @ExternCpp_CEmpty() inline(never) { extern "C" void ExternCpp_C_C(){} - // CHECK: cir.func{{.*}} @ExternCpp_C_C() { + // CHECK: cir.func dso_local @ExternCpp_C_C() inline(never) { extern "C++" void ExternCpp_C_Cpp(){} - // CHECK: cir.func{{.*}} @_Z15ExternCpp_C_Cppv() { + // CHECK: cir.func dso_local @_Z15ExternCpp_C_Cppv() inline(never) { } } extern "C" { void ExternCEmpty(){} - // CHECK: cir.func{{.*}} @ExternCEmpty() { + // CHECK: cir.func dso_local @ExternCEmpty() inline(never) { extern "C" void ExternC_C(){} - // CHECK: cir.func{{.*}} @ExternC_C() { + // CHECK: cir.func dso_local @ExternC_C() inline(never) { extern "C++" void ExternC_Cpp(){} - // CHECK: cir.func{{.*}} @_Z11ExternC_Cppv() { + // CHECK: cir.func dso_local @_Z11ExternC_Cppv() inline(never) { extern "C++" { void ExternC_CppEmpty(){} - // CHECK: cir.func{{.*}} @_Z16ExternC_CppEmptyv() { + // CHECK: cir.func dso_local @_Z16ExternC_CppEmptyv() inline(never) { extern "C" void ExternC_Cpp_C(){} - // CHECK: cir.func{{.*}} @ExternC_Cpp_C() { + // CHECK: cir.func dso_local @ExternC_Cpp_C() inline(never) { extern "C++" void ExternC_Cpp_Cpp(){} - // CHECK: cir.func{{.*}} @_Z15ExternC_Cpp_Cppv() { + // CHECK: cir.func dso_local @_Z15ExternC_Cpp_Cppv() inline(never) { } } diff --git a/clang/test/CIR/CodeGen/loop.cpp b/clang/test/CIR/CodeGen/loop.cpp index b932f9d..3d28666 100644 --- a/clang/test/CIR/CodeGen/loop.cpp +++ b/clang/test/CIR/CodeGen/loop.cpp @@ -24,7 +24,7 @@ void l0() { // CIR: cir.return // CIR: } -// LLVM: define{{.*}} void @_Z2l0v() +// LLVM: define{{.*}} void @_Z2l0v(){{.*}} // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: // LLVM: br label %[[LABEL2:.*]] @@ -67,7 +67,7 @@ void l1() { // CIR-NEXT: cir.return // CIR-NEXT: } -// LLVM: define{{.*}} void @_Z2l1v() +// LLVM: define{{.*}} void @_Z2l1v(){{.*}} // LLVM: %[[I:.*]] = alloca i32, i64 1, align 4 // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: @@ -117,7 +117,7 @@ void l2() { // CIR-NEXT: cir.return // CIR-NEXT: } -// LLVM: define{{.*}} void @_Z2l2v() +// LLVM: define{{.*}} void @_Z2l2v(){{.*}} // LLVM: %[[I:.*]] = alloca i32, i64 1, align 4 // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: @@ -165,7 +165,7 @@ void l3() { // CIR-NEXT: cir.return // CIR-NEXT: } -// LLVM: define{{.*}} void @_Z2l3v() +// LLVM: define{{.*}} void @_Z2l3v(){{.*}} // LLVM: %[[I:.*]] = alloca i32, i64 1, align 4 // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: @@ -231,7 +231,7 @@ void l4() { // CIR: } // CIR: } -// LLVM: define{{.*}} void @_Z2l4v() { +// LLVM: define{{.*}} void @_Z2l4v(){{.*}} { // LLVM: %[[RANGE_ADDR:.*]] = alloca ptr // LLVM: %[[BEGIN_ADDR:.*]] = alloca ptr // LLVM: %[[END_ADDR:.*]] = alloca ptr @@ -355,7 +355,7 @@ void l5() { // CIR: } // CIR: } -// LLVM: define{{.*}} void @_Z2l5v() { +// LLVM: define{{.*}} void @_Z2l5v(){{.*}} { // LLVM: %[[ARR_ADDR:.*]] = alloca [4 x i32] // LLVM: %[[RANGE_ADDR:.*]] = alloca ptr // LLVM: %[[BEGIN_ADDR:.*]] = alloca ptr @@ -448,7 +448,7 @@ void test_do_while_false() { // CIR-NEXT: %[[FALSE:.*]] = cir.cast int_to_bool %[[ZERO]] : !s32i -> !cir.bool // CIR-NEXT: cir.condition(%[[FALSE]]) -// LLVM: define{{.*}} void @_Z19test_do_while_falsev() +// LLVM: define{{.*}} void @_Z19test_do_while_falsev(){{.*}} // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: // LLVM: br label %[[LABEL3:.*]] @@ -486,7 +486,7 @@ void test_empty_while_true() { // CIR-NEXT: } // CIR-NEXT: cir.yield -// LLVM: define{{.*}} void @_Z21test_empty_while_truev() +// LLVM: define{{.*}} void @_Z21test_empty_while_truev(){{.*}} // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: // LLVM: br label %[[LABEL2:.*]] @@ -539,7 +539,7 @@ void unreachable_after_continue() { // CIR: cir.return // CIR: } -// LLVM: define{{.*}} void @_Z26unreachable_after_continuev() +// LLVM: define{{.*}} void @_Z26unreachable_after_continuev(){{.*}} // LLVM: %[[X:.*]] = alloca i32, i64 1, align 4 // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: @@ -599,7 +599,7 @@ void unreachable_after_break() { // CIR: cir.return // CIR: } -// LLVM: define{{.*}} void @_Z23unreachable_after_breakv() +// LLVM: define{{.*}} void @_Z23unreachable_after_breakv(){{.*}} // LLVM: %[[X:.*]] = alloca i32, i64 1, align 4 // LLVM: br label %[[LABEL1:.*]] // LLVM: [[LABEL1]]: diff --git a/clang/test/CIR/CodeGen/member-functions.cpp b/clang/test/CIR/CodeGen/member-functions.cpp index 8be2c7f..d46345db 100644 --- a/clang/test/CIR/CodeGen/member-functions.cpp +++ b/clang/test/CIR/CodeGen/member-functions.cpp @@ -19,7 +19,7 @@ void C::f() {} void C::f2(int a, int b) {} -// CIR: cir.func{{.*}} @_ZN1C2f2Eii(%[[THIS_ARG:.*]]: !cir.ptr<!rec_C> {{.*}}, %[[A_ARG:.*]]: !s32i {{.*}}, %[[B_ARG:.*]]: !s32i {{.*}}) { +// CIR: cir.func{{.*}} @_ZN1C2f2Eii(%[[THIS_ARG:.*]]: !cir.ptr<!rec_C> {{.*}}, %[[A_ARG:.*]]: !s32i {{.*}}, %[[B_ARG:.*]]: !s32i {{.*}}) // CIR-NEXT: %[[THIS_ADDR:.*]] = cir.alloca !cir.ptr<!rec_C>, !cir.ptr<!cir.ptr<!rec_C>>, ["this", init] // CIR-NEXT: %[[A_ADDR:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["a", init] // CIR-NEXT: %[[B_ADDR:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["b", init] @@ -36,7 +36,7 @@ void test1() { c.f2(1, 2); } -// CIR: cir.func{{.*}} @_Z5test1v() { +// CIR: cir.func{{.*}} @_Z5test1v() // CIR-NEXT: %[[C_ADDR:.*]] = cir.alloca !rec_C, !cir.ptr<!rec_C>, ["c"] // CIR-NEXT: cir.call @_ZN1C1fEv(%[[C_ADDR]]) : (!cir.ptr<!rec_C>) -> () // CIR-NEXT: %[[ONE:.*]] = cir.const #cir.int<1> : !s32i diff --git a/clang/test/CIR/CodeGen/nrvo.cpp b/clang/test/CIR/CodeGen/nrvo.cpp index 72c39d7..ce08c79 100644 --- a/clang/test/CIR/CodeGen/nrvo.cpp +++ b/clang/test/CIR/CodeGen/nrvo.cpp @@ -22,13 +22,13 @@ struct S f1() { return s; } -// CIR: cir.func{{.*}} @_Z2f1v() -> !rec_S { +// CIR: cir.func{{.*}} @_Z2f1v() -> !rec_S // CIR-NEXT: %[[RETVAL:.*]] = cir.alloca !rec_S, !cir.ptr<!rec_S>, ["__retval", init] // CIR-NEXT: cir.call @_ZN1SC1Ev(%[[RETVAL]]) : (!cir.ptr<!rec_S>) -> () // CIR-NEXT: %[[RET:.*]] = cir.load %[[RETVAL]] : !cir.ptr<!rec_S>, !rec_S // CIR-NEXT: cir.return %[[RET]] -// CIR-NOELIDE: cir.func{{.*}} @_Z2f1v() -> !rec_S { +// CIR-NOELIDE: cir.func{{.*}} @_Z2f1v() -> !rec_S // CIR-NOELIDE-NEXT: %[[RETVAL:.*]] = cir.alloca !rec_S, !cir.ptr<!rec_S>, ["__retval"] // CIR-NOELIDE-NEXT: %[[S:.*]] = cir.alloca !rec_S, !cir.ptr<!rec_S>, ["s", init] // CIR-NOELIDE-NEXT: cir.call @_ZN1SC1Ev(%[[S]]) : (!cir.ptr<!rec_S>) -> () diff --git a/clang/test/CIR/CodeGen/ternary.cpp b/clang/test/CIR/CodeGen/ternary.cpp index eb38ee3..e7b7270 100644 --- a/clang/test/CIR/CodeGen/ternary.cpp +++ b/clang/test/CIR/CodeGen/ternary.cpp @@ -10,7 +10,7 @@ int x(int y) { } // CIR-LABEL: cir.func{{.*}} @_Z1xi( -// CIR-SAME: %[[ARG0:.*]]: !s32i {{.*}}) -> !s32i { +// CIR-SAME: %[[ARG0:.*]]: !s32i {{.*}}) -> !s32i // CIR: [[Y:%.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["y", init] {alignment = 4 : i64} // CIR: [[RETVAL:%.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] {alignment = 4 : i64} // CIR: cir.store %[[ARG0]], [[Y]] : !s32i, !cir.ptr<!s32i> @@ -52,7 +52,7 @@ int foo(int a, int b) { } // CIR-LABEL: cir.func{{.*}} @_Z3fooii( -// CIR-SAME: %[[ARG0:.*]]: !s32i {{.*}}, %[[ARG1:.*]]: !s32i {{.*}}) -> !s32i { +// CIR-SAME: %[[ARG0:.*]]: !s32i {{.*}}, %[[ARG1:.*]]: !s32i {{.*}}) -> !s32i // CIR: [[A:%.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["a", init] {alignment = 4 : i64} // CIR: [[B:%.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["b", init] {alignment = 4 : i64} // CIR: [[RETVAL:%.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"] {alignment = 4 : i64} diff --git a/clang/test/CIR/CodeGen/throws.cpp b/clang/test/CIR/CodeGen/throws.cpp index 89cb072..53af1ef 100644 --- a/clang/test/CIR/CodeGen/throws.cpp +++ b/clang/test/CIR/CodeGen/throws.cpp @@ -196,3 +196,51 @@ void throw_ext_vector_type() { // OGCG: store <4 x i32> %[[TMP_A]], ptr %[[EXCEPTION_ADDR]], align 16 // OGCG: call void @__cxa_throw(ptr %[[EXCEPTION_ADDR]], ptr @_ZTIDv4_i, ptr null) // OGCG: unreachable + +void throw_enum_expr() { + enum Test { + TestA, + TestB + }; + throw Test::TestA; +} + +// CIR: %[[EXCEPTION_ADDR:.*]] = cir.alloc.exception 4 -> !cir.ptr<!u32i> +// CIR: %[[EXCEPTION_VALUE:.*]] = cir.const #cir.int<0> : !u32i +// CIR: cir.store{{.*}} %[[EXCEPTION_VALUE]], %[[EXCEPTION_ADDR]] : !u32i, !cir.ptr<!u32i> +// CIR: cir.throw %[[EXCEPTION_ADDR]] : !cir.ptr<!u32i>, @_ZTIZ15throw_enum_exprvE4Test +// CIR: cir.unreachable + +// LLVM: %[[EXCEPTION_ADDR:.*]] = call ptr @__cxa_allocate_exception(i64 4) +// LLVM: store i32 0, ptr %[[EXCEPTION_ADDR]], align 16 +// LLVM: call void @__cxa_throw(ptr %[[EXCEPTION_ADDR]], ptr @_ZTIZ15throw_enum_exprvE4Test, ptr null) +// LLVM: unreachable + +// OGCG: %[[EXCEPTION_ADDR:.*]] = call ptr @__cxa_allocate_exception(i64 4) +// OGCG: store i32 0, ptr %[[EXCEPTION_ADDR]], align 16 +// OGCG: call void @__cxa_throw(ptr %[[EXCEPTION_ADDR]], ptr @_ZTIZ15throw_enum_exprvE4Test, ptr null) +// OGCG: unreachable + +void throw_enum_class_expr() { + enum class Test { + TestA, + TestB + }; + throw Test::TestA; +} + +// CIR: %[[EXCEPTION_ADDR:.*]] = cir.alloc.exception 4 -> !cir.ptr<!s32i> +// CIR: %[[EXCEPTION_VALUE:.*]] = cir.const #cir.int<0> : !s32i +// CIR: cir.store{{.*}} %[[EXCEPTION_VALUE]], %[[EXCEPTION_ADDR]] : !s32i, !cir.ptr<!s32i> +// CIR: cir.throw %[[EXCEPTION_ADDR]] : !cir.ptr<!s32i>, @_ZTIZ21throw_enum_class_exprvE4Test +// CIR: cir.unreachable + +// LLVM: %[[EXCEPTION_ADDR:.*]] = call ptr @__cxa_allocate_exception(i64 4) +// LLVM: store i32 0, ptr %[[EXCEPTION_ADDR]], align 16 +// LLVM: call void @__cxa_throw(ptr %[[EXCEPTION_ADDR]], ptr @_ZTIZ21throw_enum_class_exprvE4Test, ptr null) +// LLVM: unreachable + +// OGCG: %[[EXCEPTION_ADDR:.*]] = call ptr @__cxa_allocate_exception(i64 4) +// OGCG: store i32 0, ptr %[[EXCEPTION_ADDR]], align 16 +// OGCG: call void @__cxa_throw(ptr %[[EXCEPTION_ADDR]], ptr @_ZTIZ21throw_enum_class_exprvE4Test, ptr null) +// OGCG: unreachable diff --git a/clang/test/CIR/CodeGen/vbase.cpp b/clang/test/CIR/CodeGen/vbase.cpp index 9e42323..8fcb2a4 100644 --- a/clang/test/CIR/CodeGen/vbase.cpp +++ b/clang/test/CIR/CodeGen/vbase.cpp @@ -57,7 +57,7 @@ void ppp() { B b; } // OGCG: @_ZTV1B = linkonce_odr unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr inttoptr (i64 12 to ptr), ptr null, ptr @_ZTI1B] }, comdat, align 8 -// CIR: cir.func {{.*}}@_Z1fv() { +// CIR: cir.func {{.*}}@_Z1fv() // CIR: %[[D:.+]] = cir.alloca !rec_Derived, !cir.ptr<!rec_Derived>, ["d", init] // CIR: cir.call @_ZN7DerivedC1Ev(%[[D]]) nothrow : (!cir.ptr<!rec_Derived>) -> () // CIR: %[[VPTR_PTR:.+]] = cir.vtable.get_vptr %[[D]] : !cir.ptr<!rec_Derived> -> !cir.ptr<!cir.vptr> @@ -78,7 +78,7 @@ void ppp() { B b; } // CIR: cir.call %[[FN]](%[[BASE_THIS]]) : (!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>, !cir.ptr<!rec_Base>) -> () // CIR: cir.return -// CIR: cir.func {{.*}}@_Z1gv() { +// CIR: cir.func {{.*}}@_Z1gv() // CIR: %[[DF:.+]] = cir.alloca !rec_DerivedFinal, !cir.ptr<!rec_DerivedFinal>, ["df", init] // CIR: cir.call @_ZN12DerivedFinalC1Ev(%[[DF]]) nothrow : (!cir.ptr<!rec_DerivedFinal>) -> () // CIR: %[[BASE_THIS_2:.+]] = cir.base_class_addr %[[DF]] : !cir.ptr<!rec_DerivedFinal> nonnull [0] -> !cir.ptr<!rec_Base> @@ -89,7 +89,7 @@ void ppp() { B b; } // CIR: cir.call %[[FN_2]](%[[BASE_THIS_2]]) : (!cir.ptr<!cir.func<(!cir.ptr<!rec_Base>)>>, !cir.ptr<!rec_Base>) -> () // CIR: cir.return -// LLVM: define {{.*}}void @_Z1fv() +// LLVM: define {{.*}}void @_Z1fv(){{.*}} // LLVM: %[[D:.+]] = alloca {{.*}} // LLVM: call void @_ZN7DerivedC1Ev(ptr %[[D]]) // LLVM: %[[VPTR_ADDR:.+]] = load ptr, ptr %[[D]] @@ -102,7 +102,7 @@ void ppp() { B b; } // LLVM: call void %[[VFN]](ptr %[[ADJ_THIS]]) // LLVM: ret void -// LLVM: define {{.*}}void @_Z1gv() +// LLVM: define {{.*}}void @_Z1gv(){{.*}} // LLVM: %[[DF:.+]] = alloca {{.*}} // LLVM: call void @_ZN12DerivedFinalC1Ev(ptr %[[DF]]) // LLVM: %[[VPTR2:.+]] = load ptr, ptr %[[DF]] @@ -138,7 +138,7 @@ void ppp() { B b; } // CIR: cir.store align(8) %[[VTABLE]], %[[B_VPTR]] : !cir.vptr, !cir.ptr<!cir.vptr> // CIR: cir.return -// LLVM: define{{.*}} void @_ZN1BC1Ev(ptr %[[THIS_ARG:.*]]) { +// LLVM: define{{.*}} void @_ZN1BC1Ev(ptr %[[THIS_ARG:.*]]){{.*}} { // LLVM: %[[THIS_ADDR:.*]] = alloca ptr // LLVM: store ptr %[[THIS_ARG]], ptr %[[THIS_ADDR]] // LLVM: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]] diff --git a/clang/test/CIR/CodeGen/vla.c b/clang/test/CIR/CodeGen/vla.c index e2adf45..b22c704 100644 --- a/clang/test/CIR/CodeGen/vla.c +++ b/clang/test/CIR/CodeGen/vla.c @@ -21,7 +21,7 @@ void f0(int len) { // CIR: %[[STACK_RESTORE_PTR:.*]] = cir.load{{.*}} %[[SAVED_STACK]] // CIR: cir.stackrestore %[[STACK_RESTORE_PTR]] -// LLVM: define{{.*}} void @f0(i32 %[[LEN_ARG:.*]]) { +// LLVM: define{{.*}} void @f0(i32 %[[LEN_ARG:.*]]) // LLVM: %[[LEN_ADDR:.*]] = alloca i32 // LLVM: %[[SAVED_STACK:.*]] = alloca ptr // LLVM: store i32 %[[LEN_ARG]], ptr %[[LEN_ADDR]] @@ -68,7 +68,7 @@ void f1(int len) { // CIR: %[[STACK_RESTORE_PTR:.*]] = cir.load{{.*}} %[[SAVED_STACK]] // CIR: cir.stackrestore %[[STACK_RESTORE_PTR]] -// LLVM: define{{.*}} void @f1(i32 %[[LEN_ARG:.*]]) { +// LLVM: define{{.*}} void @f1(i32 %[[LEN_ARG:.*]]) // LLVM: %[[LEN_ADDR:.*]] = alloca i32 // LLVM: %[[SAVED_STACK:.*]] = alloca ptr // LLVM: store i32 %[[LEN_ARG]], ptr %[[LEN_ADDR]] @@ -116,7 +116,7 @@ void f2(int len) { // CIR: %[[STACK_RESTORE_PTR:.*]] = cir.load{{.*}} %[[SAVED_STACK]] // CIR: cir.stackrestore %[[STACK_RESTORE_PTR]] -// LLVM: define{{.*}} void @f2(i32 %[[LEN_ARG:.*]]) { +// LLVM: define{{.*}} void @f2(i32 %[[LEN_ARG:.*]]) // LLVM: %[[LEN_ADDR:.*]] = alloca i32 // LLVM: %[[SAVED_STACK:.*]] = alloca ptr // LLVM: store i32 %[[LEN_ARG]], ptr %[[LEN_ADDR]] @@ -191,7 +191,7 @@ void f3(unsigned len) { // CIR: %[[STACK_RESTORE_PTR:.*]] = cir.load{{.*}} %[[SAVED_STACK]] // CIR: cir.stackrestore %[[STACK_RESTORE_PTR]] -// LLVM: define{{.*}} void @f3(i32 %[[LEN_ARG:.*]]) { +// LLVM: define{{.*}} void @f3(i32 %[[LEN_ARG:.*]]) // LLVM: %[[SAVED_STACK2:.*]] = alloca ptr // LLVM: %[[LEN_ADDR:.*]] = alloca i32 // LLVM: %[[SAVED_STACK:.*]] = alloca ptr diff --git a/clang/test/CIR/CodeGen/vtt.cpp b/clang/test/CIR/CodeGen/vtt.cpp index dc30c32..f9a62e3 100644 --- a/clang/test/CIR/CodeGen/vtt.cpp +++ b/clang/test/CIR/CodeGen/vtt.cpp @@ -445,7 +445,7 @@ D::D() {} // CIR-COMMON: %[[C_VPTR_ADDR:.*]] = cir.vtable.get_vptr %[[C_ADDR]] : !cir.ptr<!rec_C> -> !cir.ptr<!cir.vptr> // CIR-COMMON: cir.store{{.*}} %[[C_VPTR]], %[[C_VPTR_ADDR]] : !cir.vptr, !cir.ptr<!cir.vptr> -// LLVM-COMMON: define {{.*}} void @_ZN1DC2Ev(ptr %[[THIS_ARG:.*]], ptr %[[VTT_ARG:.*]]) { +// LLVM-COMMON: define {{.*}} void @_ZN1DC2Ev(ptr %[[THIS_ARG:.*]], ptr %[[VTT_ARG:.*]]){{.*}} { // LLVM-COMMON: %[[THIS_ADDR:.*]] = alloca ptr // LLVM-COMMON: %[[VTT_ADDR:.*]] = alloca ptr // LLVM-COMMON: store ptr %[[THIS_ARG]], ptr %[[THIS_ADDR]] @@ -484,7 +484,7 @@ D::D() {} // CIR-COMMON: %[[VPTR_ADDR:.*]] = cir.vtable.get_vptr %[[THIS]] : !cir.ptr<!rec_A> -> !cir.ptr<!cir.vptr> // CIR-COMMON: cir.store{{.*}} %[[VPTR]], %[[VPTR_ADDR]] : !cir.vptr, !cir.ptr<!cir.vptr> -// LLVM-COMMON: define {{.*}} void @_ZN1AC2Ev(ptr %[[THIS_ARG:.*]]) { +// LLVM-COMMON: define {{.*}} void @_ZN1AC2Ev(ptr %[[THIS_ARG:.*]]){{.*}} { // LLVM-COMMON: %[[THIS_ADDR:.*]] = alloca ptr, i64 1, align 8 // LLVM-COMMON: store ptr %[[THIS_ARG]], ptr %[[THIS_ADDR]], align 8 // LLVM-COMMON: %[[THIS:.*]] = load ptr, ptr %[[THIS_ADDR]], align 8 |