[llvm] [TLI] Return LibFunc from TargetLibraryInfo::getLibFunc (PR #217561)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 02:48:46 PDT 2026
================
@@ -492,8 +495,8 @@ getFreeFunctionDataForFunction(const Function *Callee, const LibFunc TLIFn) {
std::optional<StringRef>
llvm::getAllocationFamily(const Value *I, const TargetLibraryInfo *TLI) {
if (const Function *Callee = getCalledFunction(I)) {
- LibFunc TLIFn;
- if (TLI && TLI->getLibFunc(*Callee, TLIFn) && TLI->has(TLIFn)) {
+ LibFunc TLIFn = TLI ? TLI->getLibFunc(*Callee) : NotLibFunc;
+ if (TLIFn != NotLibFunc && TLI->has(TLIFn)) {
----------------
nikic wrote:
A separate issue, but I find it weird how we basically always have to call getLibFunc() and then has() on the result. It would make more sense to me for that to be part of getLibFunc() itself (presumably with some exceptions where we want to explicitly ignore availability, not sure what those are though).
https://github.com/llvm/llvm-project/pull/217561
More information about the llvm-commits
mailing list