[PATCH] D157951: [NFC][TLI] Replace std::lower_bound call in getLibFunc with DenseMap lookup
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 05:29:06 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:945
+static DenseMap<StringRef, unsigned>
+buildIndexMap(const StringLiteral (&StandardNames)[LibFunc::NumLibFuncs]) {
+ DenseMap<StringRef, unsigned> Indices;
----------------
0xdc03 wrote:
> nikic wrote:
> > StandardNames is a global variable in this file, no need to pass it as an argument.
> Unfortunately not:
> ```
> error: 'StandardNames' is a private member of 'llvm::TargetLibraryInfoImpl'
> for (const auto &Func : TargetLibraryInfoImpl::StandardNames)
> ^
> ```
> I could make `buildIndexMap` a member of `TargetLibraryInfoImpl`
Oh, I see. In that case I'd suggest to make the argument `ArrayRef<StringLiteral> StandardNames` to avoid any weird array passing semantics.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157951/new/
https://reviews.llvm.org/D157951
More information about the llvm-commits
mailing list