[all-commits] [llvm/llvm-project] a7a6ef: [OSX][TargetLibraryInfo] Mark memrchr as unavailab...

Pavel Kosov via All-commits all-commits at lists.llvm.org
Mon Aug 14 02:30:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a7a6ef3b809100a1e7724443afe94d020d4c956b
      https://github.com/llvm/llvm-project/commit/a7a6ef3b809100a1e7724443afe94d020d4c956b
  Author: Pavel Kosov <kpdev42 at gmail.com>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M llvm/lib/Analysis/TargetLibraryInfo.cpp

  Log Message:
  -----------
  [OSX][TargetLibraryInfo] Mark memrchr as unavailable on OSX

On Mac OSX  (tested version macOS 12.4, sdk 12.1) llvm can replace call to `strrchr()` with call to `memrchr()` when string length is known at compile time. This results in link error, because `memrchr` is not present in `libSystem`. It is needed to disable this optimization in `TargetLibraryInfo` for affected OSX versions.

This non-standard function (`memrchr`) is not present on (at least) several versions of MacOS https://www.gnu.org/software/gnulib/manual/html_node/memrchr.html , so, in this patch `memrchr` is marked as unavailable for all versions. If someone knows versions where it should be available - please let me know.

Github issue: https://github.com/llvm/llvm-project/issues/62254

Tests for this feature also cannot be easily added: https://reviews.llvm.org/D134134#3801747

~~~

Huawei RRI, OS Lab

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D155168




More information about the All-commits mailing list