[llvm] [Transforms] LoopIdiomRecognize recognize strlen and wcslen (PR #108985)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 2 08:59:18 PDT 2024
https://github.com/Meinersbur commented:
Failure case that I had in mind (taken from valid_strlen_1):
```
2:
%3 = phi ptr [ %0, %1 ], [ %6, %2 ]
%4 = load i8, ptr %3, align 1
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, ptr %3, i64 1
br i1 %5, label %7, label %2
7:
...
ret i8 %4
```
This uses `%4` instead of `%10`. LCSSA will create a PHI for it, but it is not the PHI for %3. I see you counting the number of exit PHIs, the wrong one. https://github.com/llvm/llvm-project/pull/108985/files#diff-0d3d299d16e73bef015777082e043f5353798421299f684d52028b977fea61e1R1654-R1656 seems to catch that. Some more tests for expected failures like this one would be good.
https://github.com/llvm/llvm-project/pull/108985
More information about the llvm-commits
mailing list