[all-commits] [llvm/llvm-project] 969484: Reland "[Transforms] LoopIdiomRecognize recognize ...

Henry Jiang via All-commits all-commits at lists.llvm.org
Mon Mar 24 06:49:52 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9694844d7e36fd5e01011ab56b64f27b867aa72d
      https://github.com/llvm/llvm-project/commit/9694844d7e36fd5e01011ab56b64f27b867aa72d
  Author: Henry Jiang <h243jian at uwaterloo.ca>
  Date:   2025-03-24 (Mon, 24 Mar 2025)

  Changed paths:
    M llvm/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
    M llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
    M llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
    M llvm/lib/Transforms/Utils/BuildLibCalls.cpp
    A llvm/test/Transforms/LoopIdiom/strlen-noidiom.ll
    A llvm/test/Transforms/LoopIdiom/strlen-not-emittable.ll
    A llvm/test/Transforms/LoopIdiom/strlen.ll
    A llvm/test/Transforms/LoopIdiom/wcslen16.ll
    A llvm/test/Transforms/LoopIdiom/wcslen32.ll

  Log Message:
  -----------
  Reland "[Transforms] LoopIdiomRecognize recognize strlen and wcslen #108985" (#132572)

Reland https://github.com/llvm/llvm-project/pull/108985

Extend `LoopIdiomRecognize` to find and replace loops of the form
```c
base = str;
while (*str)
  ++str;
```
and transforming the `strlen` loop idiom into the appropriate `strlen`
and `wcslen` library call which will give a small performance boost if
replaced.
```c
str = base + strlen(base)
len = str - base
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list