Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2771,8 +2771,10 @@ cir::FuncOp CIRGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
unsigned BuiltinID) {
assert(astContext.BuiltinInfo.isLibFunction(BuiltinID));

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

// TODO: This list should be expanded or refactored after all GCC-compatible
Expand Down Expand Up @@ -2831,7 +2833,7 @@ cir::FuncOp CIRGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
AIXLongDouble64Builtins.end())
Name = AIXLongDouble64Builtins[BuiltinID];
else
Name = StringRef(astContext.BuiltinInfo.getName(BuiltinID).data(), 10);
Name = astContext.BuiltinInfo.getName(BuiltinID).substr(10);
}

auto Ty = convertType(FD->getType());
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/CIR/CodeGen/CIRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3650,7 +3650,8 @@ struct FunctionIsDirectlyRecursive
unsigned builtinId = func->getBuiltinID();
if (!builtinId || !builtinCtx.isLibFunction(builtinId))
return false;
StringRef builtinName = builtinCtx.getName(builtinId);
std::string builtinNameStr = builtinCtx.getName(builtinId);
StringRef builtinName = builtinNameStr;
return builtinName.starts_with("__builtin_") &&
name == builtinName.slice(strlen("__builtin_"), StringRef::npos);
}
Expand Down
1 change: 0 additions & 1 deletion clang/test/CIR/CodeGen/builtins-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o - \
// RUN: | opt -S -passes=instcombine,mem2reg,simplifycfg -o %t.ll
// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
// XFAIL: *

typedef __SIZE_TYPE__ size_t;
void test_memcpy_chk(void *dest, const void *src, size_t n) {
Expand Down
1 change: 0 additions & 1 deletion clang/test/CIR/CodeGen/builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// RUN: -emit-llvm -fno-clangir-call-conv-lowering -o - %s \
// RUN: | opt -S -passes=instcombine,mem2reg,simplifycfg -o %t.ll
// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
// XFAIL: *

// This test file is a collection of test cases for all target-independent
// builtins that are related to memory operations.
Expand Down
1 change: 0 additions & 1 deletion clang/test/CIR/CodeGen/libcall.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -fclangir -mconstructor-aliases -emit-cir %s -o %t.cir
// RUN: FileCheck --input-file=%t.cir %s
// XFAIL: *

typedef __builtin_va_list va_list;

Expand Down
1 change: 0 additions & 1 deletion clang/test/CIR/Lowering/builtin-binary-fp2fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -ffast-math -fclangir -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM-FASTMATH
// XFAIL: *

// copysign

Expand Down
Loading