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

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 16 19:58:36 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);
----------------
shiltian wrote:

I'm so confused. Inside `getAssumedAlignForIntrinsic`, if the intrinsic can't be handled, it simply returns `Align()`, no? That being said, instead of completely giving up when `getAssumedAlignForIntrinsic` can't handle, you can still check if `getAssumedAlignForIntrinsic` returns `Align()`. If it does, it can continue.

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


More information about the llvm-commits mailing list