From c12058679db293b2fcfb7fb1ca7011500f1ff85a Mon Sep 17 00:00:00 2001 From: ghehg Date: Fri, 1 Nov 2024 19:32:53 -0700 Subject: [PATCH] Get test ready --- clang/test/CIR/CodeGen/builtins-memory.c | 15 --------------- clang/test/CIR/CodeGen/builtins.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 clang/test/CIR/CodeGen/builtins-memory.c diff --git a/clang/test/CIR/CodeGen/builtins-memory.c b/clang/test/CIR/CodeGen/builtins-memory.c deleted file mode 100644 index 1625c1a1d455..000000000000 --- a/clang/test/CIR/CodeGen/builtins-memory.c +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir -// RUN: FileCheck %s --check-prefix=CIR --input-file=%t.cir -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll -// RUN: FileCheck %s --check-prefix=LLVM --input-file=%t.ll - -void *test_return_address(void) { - return __builtin_return_address(1); - - // CIR-LABEL: test_return_address - // [[ARG:%.*]] = cir.const #cir.int<1> : !u32i - // {{%.*}} = cir.llvm.intrinsic "llvm.returnaddress" [[ARG]] : (!u32i) -> !cir.ptr - - // LLVM-LABEL: @test_return_address - // LLVM: {{%.*}} = call ptr @llvm.returnaddress(i32 1) -} diff --git a/clang/test/CIR/CodeGen/builtins.cpp b/clang/test/CIR/CodeGen/builtins.cpp index fa7b51e88016..f4a283e56237 100644 --- a/clang/test/CIR/CodeGen/builtins.cpp +++ b/clang/test/CIR/CodeGen/builtins.cpp @@ -56,3 +56,14 @@ int *test_std_addressof2() { // LLVM: [[RES:%.*]] = load ptr, ptr [[ADDR]], align 8 // LLVM: ret ptr [[RES]] } + +extern "C" void *test_return_address(void) { + return __builtin_return_address(1); + + // CIR-LABEL: test_return_address + // [[ARG:%.*]] = cir.const #cir.int<1> : !u32i + // {{%.*}} = cir.llvm.intrinsic "llvm.returnaddress" [[ARG]] : (!u32i) -> !cir.ptr + + // LLVM-LABEL: @test_return_address + // LLVM: {{%.*}} = call ptr @llvm.returnaddress(i32 1) +}