[all-commits] [llvm/llvm-project] bf6357: [Transforms] LoopIdiomRecognize recognize strlen a...
Henry Jiang via All-commits
all-commits at lists.llvm.org
Fri Mar 14 15:56:56 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bf6357f0f51eccc48b92a130afb51c0280d56180
https://github.com/llvm/llvm-project/commit/bf6357f0f51eccc48b92a130afb51c0280d56180
Author: Henry Jiang <h243jian at uwaterloo.ca>
Date: 2025-03-14 (Fri, 14 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.ll
A llvm/test/Transforms/LoopIdiom/wcslen16.ll
A llvm/test/Transforms/LoopIdiom/wcslen32.ll
Log Message:
-----------
[Transforms] LoopIdiomRecognize recognize strlen and wcslen (#108985)
This PR continues the effort made in
https://discourse.llvm.org/t/rfc-strlen-loop-idiom-recognition-folding/55848
and https://reviews.llvm.org/D83392 and https://reviews.llvm.org/D88460
to 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
```
---------
Co-authored-by: Michael Kruse <github at meinersbur.de>
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