[llvm] [LLVM][MemCpyOpt] Unify alias tags if we optimize allocas (PR #129537)
Dominik Adamski via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 8 02:50:39 PDT 2025
DominikAdamski wrote:
> So the original non minimized code is this. I've had some issue fully minimizing it without losing the behaviour https://godbolt.org/z/7jaanfTqM. And on trunk we are removing noalias in both memcpies but not the other aliasing stuff
@gbaraldi Thank you for full LLVM IR code. The full LLVM IR code contains two types of memcpy optimization:
1. Remove unnecessary memcpy call (see code in L11 and L14 blocks for code: https://godbolt.org/z/7jaanfTqM):
```
memcpy(X, Y, 8);
memcpy(Z, X, 8);
can be simplified to:
memcpy(Z,Y,8);
```
2. Remove unnecessary buffer allocation (optimized out `%0 = alloca [4 x i64], align 8` and used `%unionalloca = alloca [4 x i64], align 8` instead).
The minimized LLVM IR contains only the first optimization, which is not part of this PR. The second optimization for the full LLVM IR file affects memcpy operations in blocks `L11` and `L14`; that's why we stripped off the `!no.alias` tag for the trunk version. My most recent version of this patch also removes `!tbaa` and `!alias.scope`.
https://github.com/llvm/llvm-project/pull/129537
More information about the llvm-commits
mailing list