[llvm] [Attributor] Propagate alignment through ptrmask (PR #150158)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 25 19:16:56 PDT 2025
Shoreshen wrote:
Hi @arsenm , it need to be end if ptrmask is handled, let me try to explain with the following example:
```
define ptr @align_ptrmask_back_prop(ptr align 2 %x, i1 %cmp1, i1 %cmp2) {
%p = tail call ptr @llvm.ptrmask.p0.i64(ptr %x, i64 -8)
store float 1.0, ptr %p, align 8
ret ptr %p
}
```
When calculating the known alignment of `%x`, since the mask has covered the aligning bits, the known alignment for `%x` is actually 1.
If we continue to do the call base attribute, it will calculate the alignment of `%p`, which is used in store inst with alignment require of 8.
Comparing 8>1, it will pick the alignment of 8 for `%x`, which is not what we want.
https://github.com/llvm/llvm-project/pull/150158
More information about the llvm-commits
mailing list