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

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 16 18:06:11 PDT 2025


================
@@ -5501,6 +5550,15 @@ struct AAAlignCallSiteReturned final
   AAAlignCallSiteReturned(const IRPosition &IRP, Attributor &A)
       : Base(IRP, A) {}
 
+  ChangeStatus updateImpl(Attributor &A) override {
+    Instruction *I = getIRPosition().getCtxI();
+    if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
+      Align Align = getAssumedAlignForIntrinsic(A, *this, *II);
+      return clampStateAndIndicateChange<StateType>(this->getState(),
+                                                    Align.value());
+    }
+    return Base::updateImpl(A);
----------------
Shoreshen wrote:

Hi @shiltian , `Align(n)` is giving an alignment of `n` , it will take log of the input:
<img width="642" height="133" alt="image" src="https://github.com/user-attachments/assets/85d48461-ba1d-4c48-b3dd-4e6e198b1922" />

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


More information about the llvm-commits mailing list