[all-commits] [llvm/llvm-project] 6321e4: [SimplifyLibCalls] Transform memchr(STR, C, N) to ...

Dávid Bolvanský via All-commits all-commits at lists.llvm.org
Sun May 7 06:12:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6321e4ddf7da1d2761ffa2ed368b4f8cc5b75b6e
      https://github.com/llvm/llvm-project/commit/6321e4ddf7da1d2761ffa2ed368b4f8cc5b75b6e
  Author: Dávid Bolvanský <david.bolvansky at gmail.com>
  Date:   2023-05-07 (Sun, 07 May 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    M llvm/test/Transforms/InstCombine/memchr-7.ll
    M llvm/test/Transforms/InstCombine/memchr.ll
    R llvm/test/Transforms/PhaseOrdering/memchr-expansion.ll

  Log Message:
  -----------
  [SimplifyLibCalls] Transform memchr(STR, C, N) to chain of ORs

Motivation:

```
#include <string_view>

size_t findFirst_ABCDEF(std::string_view sv) {
  return sv.find_first_of("ABCDEF");
}
```

memchr("ABCDEF", C,  6) != NULL -> (C == 'A' || C == 'B' || C == 'C' || C == 'D' || C == 'E' || C == 'F') != 0

Reviewed By: nikic

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




More information about the All-commits mailing list