Skip to content

Commit 6b19f09

Browse files
FantasqueXlanza
authored andcommitted
[CIR] Backport clang commit to unxfail some builtin call (#1501)
Ref: cd269fe Related: #1497
1 parent 571e56f commit 6b19f09

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,8 +2772,10 @@ cir::FuncOp CIRGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
27722772
unsigned BuiltinID) {
27732773
assert(astContext.BuiltinInfo.isLibFunction(BuiltinID));
27742774

2775-
// Get the name, skip over the __builtin_ prefix (if necessary).
2776-
StringRef Name;
2775+
// Get the name, skip over the __builtin_ prefix (if necessary). We may have
2776+
// to build this up so provide a small stack buffer to handle the vast
2777+
// majority of names.
2778+
llvm::SmallString<64> Name;
27772779
GlobalDecl D(FD);
27782780

27792781
// TODO: This list should be expanded or refactored after all GCC-compatible
@@ -2832,7 +2834,7 @@ cir::FuncOp CIRGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
28322834
AIXLongDouble64Builtins.end())
28332835
Name = AIXLongDouble64Builtins[BuiltinID];
28342836
else
2835-
Name = StringRef(astContext.BuiltinInfo.getName(BuiltinID).data(), 10);
2837+
Name = astContext.BuiltinInfo.getName(BuiltinID).substr(10);
28362838
}
28372839

28382840
auto Ty = convertType(FD->getType());

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3695,7 +3695,8 @@ struct FunctionIsDirectlyRecursive
36953695
unsigned builtinId = func->getBuiltinID();
36963696
if (!builtinId || !builtinCtx.isLibFunction(builtinId))
36973697
return false;
3698-
StringRef builtinName = builtinCtx.getName(builtinId);
3698+
std::string builtinNameStr = builtinCtx.getName(builtinId);
3699+
StringRef builtinName = builtinNameStr;
36993700
return builtinName.starts_with("__builtin_") &&
37003701
name == builtinName.slice(strlen("__builtin_"), StringRef::npos);
37013702
}

clang/test/CIR/CodeGen/builtins-memory.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o - \
44
// RUN: | opt -S -passes=instcombine,mem2reg,simplifycfg -o %t.ll
55
// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
6-
// XFAIL: *
76

87
typedef __SIZE_TYPE__ size_t;
98
void test_memcpy_chk(void *dest, const void *src, size_t n) {

clang/test/CIR/CodeGen/builtins.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// RUN: -emit-llvm -fno-clangir-call-conv-lowering -o - %s \
55
// RUN: | opt -S -passes=instcombine,mem2reg,simplifycfg -o %t.ll
66
// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
7-
// XFAIL: *
87

98
// This test file is a collection of test cases for all target-independent
109
// builtins that are related to memory operations.

clang/test/CIR/CodeGen/libcall.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
3-
// XFAIL: *
43

54
typedef __builtin_va_list va_list;
65

clang/test/CIR/Lowering/builtin-binary-fp2fp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
33
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ffast-math -fclangir -emit-llvm %s -o %t.ll
44
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM-FASTMATH
5-
// XFAIL: *
65

76
// copysign
87

0 commit comments

Comments
 (0)