summaryrefslogtreecommitdiff
path: root/clang/test/CIR/CodeGen/builtin_call.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CIR/CodeGen/builtin_call.cpp')
-rw-r--r--clang/test/CIR/CodeGen/builtin_call.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/CIR/CodeGen/builtin_call.cpp b/clang/test/CIR/CodeGen/builtin_call.cpp
index 09be7937a433..853d894a3311 100644
--- a/clang/test/CIR/CodeGen/builtin_call.cpp
+++ b/clang/test/CIR/CodeGen/builtin_call.cpp
@@ -211,6 +211,10 @@ void unreachable() {
// LLVM: unreachable
// LLVM: }
+// OGCG-LABEL: @_Z11unreachablev
+// OGCG: unreachable
+// OGCG: }
+
void f1();
void unreachable2() {
__builtin_unreachable();
@@ -229,6 +233,9 @@ void unreachable2() {
// LLVM-NEXT: call void @_Z2f1v()
// LLVM: }
+// OGCG-LABEL: @_Z12unreachable2v
+// OGCG: unreachable
+
void trap() {
__builtin_trap();
}
@@ -241,6 +248,10 @@ void trap() {
// LLVM: call void @llvm.trap()
// LLVM: }
+// OGCG-LABEL: @_Z4trapv
+// OGCG: call void @llvm.trap()
+// OGCG: }
+
void trap2() {
__builtin_trap();
f1();
@@ -258,3 +269,40 @@ void trap2() {
// LLVM: {{.+}}:
// LLVM-NEXT: call void @_Z2f1v()
// LLVM: }
+
+// OGCG-LABEL: define{{.*}} void @_Z5trap2v
+// OGCG: call void @llvm.trap()
+// OGCG-NEXT: call void @_Z2f1v()
+// OGCG: ret void
+// OGCG: }
+
+void *test_alloca(unsigned long n) {
+ return __builtin_alloca(n);
+}
+
+// CIR-LABEL: @_Z11test_allocam(
+// CIR: %{{.+}} = cir.alloca !u8i, !cir.ptr<!u8i>, %{{.+}} : !u64i, ["bi_alloca"]
+
+// LLVM-LABEL: @_Z11test_allocam(
+// LLVM: alloca i8, i64 %{{.+}}
+
+// OGCG-LABEL: @_Z11test_allocam(
+// OGCG: alloca i8, i64 %{{.+}}
+
+bool test_multiple_allocas(unsigned long n) {
+ void *a = __builtin_alloca(n);
+ void *b = __builtin_alloca(n);
+ return a != b;
+}
+
+// CIR-LABEL: @_Z21test_multiple_allocasm(
+// CIR: %{{.+}} = cir.alloca !u8i, !cir.ptr<!u8i>, %{{.+}} : !u64i, ["bi_alloca"]
+// CIR: %{{.+}} = cir.alloca !u8i, !cir.ptr<!u8i>, %{{.+}} : !u64i, ["bi_alloca"]
+
+// LLVM-LABEL: @_Z21test_multiple_allocasm(
+// LLVM: alloca i8, i64 %{{.+}}
+// LLVM: alloca i8, i64 %{{.+}}
+
+// OGCG-LABEL: @_Z21test_multiple_allocasm(
+// OGCG: alloca i8, i64 %{{.+}}
+// OGCG: alloca i8, i64 %{{.+}}