[llvm] [Transforms] Recognize memcmp-like loops in LoopIdiomRecognize (PR #181562)
Sayan Sivakumaran via llvm-commits
llvm-commits at lists.llvm.org
Sun May 31 18:36:45 PDT 2026
sivakusayan wrote:
Okay, I finally had time to look at this again. I'm going to put this back into draft for a couple of reasons:
- When testing this on the example code in the linked GitHub issue, this transform wasn't emitting `memcmp` when compiling for ARM but it was when compiling for x86-64. This seems to be because we don't emit the `byval` attribute on the function arguments on ARM, so we couldn't tell how long the arrays were.
- I think we could fix this by emitting the `dereferenceable(n)` attribute in the IR when doing Clang codegen instead, but I'll need to double check on this.
- As David Stone pointed out, this is a somewhat restrictive transform, but implementing the transform for comparing arrays of aggregates would be a bit more complicated. I'm going to try compiling some real codebases with my branch to see if the transform would be useful even in its restricted form.
- It would be nice to rebase this branch onto `main`, as I've let this branch sit for a bit now.
https://github.com/llvm/llvm-project/pull/181562
More information about the llvm-commits
mailing list