diff options
| author | Franklin Zhang <zhangfenglei@huawei.com> | 2024-05-03 12:24:38 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-03 13:24:38 +0900 |
| commit | 6b948705a05261a2ff31cd7e6ea8319d1852ddfc (patch) | |
| tree | afdb2b733186a3bb583d505dc48675c241cca78f /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | b62c45cfe514237f71a7f461ba283dd13a92bfe0 (diff) | |
[AggressiveInstCombine] Inline strcmp/strncmp (#89371)
Inline calls to strcmp(s1, s2) and strncmp(s1, s2, N), where N and
exactly one of s1 and s2 are constant.
For example:
```c
int res = strcmp(s, "ab");
```
is converted to
```c
int res = (int)s[0] - (int)'a';
if (res != 0)
goto END;
res = (int)s[1] - (int)'b';
if (res != 0)
goto END;
res = (int)s[2] - (int)'\0';
END:
```
Ported from a similar gcc feature [Inline strcmp with small constant
strings](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809).
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
