[llvm] [Attributor] Propagate alignment through ptrmask (PR #150158)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 11 20:21:49 PDT 2025
================
@@ -5187,6 +5187,59 @@ struct AADereferenceableCallSiteReturned final
// ------------------------ Align Argument Attribute ------------------------
namespace {
+
+Align getKnownAlignForIntrinsic(Attributor &A, AAAlign &QueryingAA,
+ const IntrinsicInst &II) {
+ switch (II.getIntrinsicID()) {
+ case Intrinsic::ptrmask: {
+ const auto *ConstVals = A.getAAFor<AAPotentialConstantValues>(
+ QueryingAA, IRPosition::value(*(II.getOperand(1))), DepClassTy::NONE);
+ const auto *AlignAA = A.getAAFor<AAAlign>(QueryingAA, IRPosition::value(II),
----------------
Shoreshen wrote:
Hi @arsenm , this is trying to get the `AAAlign` for the return value of ptrmask, and by doing that we can get the known alignment of that.
For example if we have:
1. `%p = llvm.ptrmask(%x, %mask)`
2. We are calculating the known alignment of `%x`
3. There is a load using %p with known alignment of 8
Then we know that `%p`'s known alignment is at least 8, and if `%mask` can not cover, this should be passed to `%x`'s known alignment
https://github.com/llvm/llvm-project/pull/150158
More information about the llvm-commits
mailing list