Issue 120913
Summary LLVM cannot constant fold memchr with constant size
Labels
Assignees
Reporter philnik777
    ```c++
void* test1(char* first, char val) {
  return __builtin_memchr(first, val, 2);
}
```
always generates a call to `memchr`, even though it could just check the two chars. I can't really see a case where calling `memchr` is faster than just checking the two chars. For larger N it would also be interesting to use vector comparisons for this instead of calling a function.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to