[llvm] [Attributor] Propagate alignment through ptrmask (PR #150158)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 07:04:20 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),
----------------
shiltian wrote:

I don't follow. In the step 3, inside `AAAlignImpl::followUseInMBEC`, it calls `getKnownAlignForUse`, where you have all your logic here. Inside `getKnownAlignForUse`, if you set `TrackUse` to `true`, the entire `AAAlignImpl::followUseInMBEC` will return `true`, and its alignment will be taken account.

https://github.com/llvm/llvm-project/pull/150158


More information about the llvm-commits mailing list