[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:21:02 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;
----------------
StandardNames is a global variable in this file, no need to pass it as an argument.


================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:946
+buildIndexMap(const StringLiteral (&StandardNames)[LibFunc::NumLibFuncs]) {
+  DenseMap<StringRef, unsigned> Indices;
+  unsigned Idx = 0;
----------------
Might be a bit more elegant to make this a map to `LibFunc` rather than `unsigned`?


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