[llvm] [Attributor] Propagate alignment through ptrmask (PR #150158)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 14 19:59:21 PDT 2025
================
@@ -5501,6 +5556,17 @@ struct AAAlignCallSiteReturned final
AAAlignCallSiteReturned(const IRPosition &IRP, Attributor &A)
: Base(IRP, A) {}
+ ChangeStatus updateImpl(Attributor &A) override {
+ Instruction *I = getIRPosition().getCtxI();
----------------
Shoreshen wrote:
Hi @shiltian , this may cause assumed alignment cannot go through the ptrmask, assuming:
1. We use `getOrCreateAAFor<AAAlign>(IRPosition::value(I))` to create the attribute (which is the method in attribute pass)
2. `I` is `%p = tail call ptr @llvm.ptrmask.p0.i64(ptr %x, i64 %sel1)`
According to the following:
<img width="720" height="192" alt="image" src="https://github.com/user-attachments/assets/1b5ade6c-9418-426a-9366-0911d5352767" />
It will create an `AAAlignCallSiteReturned` attribute and its IRP's associated Value is `%p` and type is callsite_return.
The `updateimpl` for `AAAlignCallSiteReturned` is as follow:
<img width="1002" height="1088" alt="image" src="https://github.com/user-attachments/assets/14d1cf82-dbbb-49d1-8165-53ad020fb19a" />
The function will try to reach all the callee's return value's alignment, however ptrmask is a intrinsic declaration, so inside `A.getAAFor<AAType>(*this, FnPos, DepClassTy::REQUIRED)` the `ShouldUpdateAA` will be false. It will return a pessimistic status directly. Which will not invoke the `AAAlignFloating::updateImpl`
https://github.com/llvm/llvm-project/pull/150158
More information about the llvm-commits
mailing list