[llvm] [llubi] Update the implementation of assume align operand bundle (PR #203775)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 13:44:38 PDT 2026


================
@@ -830,25 +830,21 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
           switch (Kind) {
           case Attribute::Alignment: {
             // Alignment assumptions should have 2 or 3 arguments.
-            // If there are two integer arguments, use the largest power of 2
-            // that divides them as the alignment.
             APInt Alignment = getIntNonPoison(getValue(GetBundleArg(1)));
+            APInt CheckedAddr = WasOnPtr.address();
             if (OBU.Inputs.size() == 3) {
               APInt Offset = getIntNonPoison(getValue(GetBundleArg(2)));
-              if (!Alignment.isZero() || !Offset.isZero())
-                Alignment = APInt::getOneBitSet(
-                    std::max(Alignment.getBitWidth(), Offset.getBitWidth()),
-                    std::min(Alignment.countr_zero(), Offset.countr_zero()));
+              CheckedAddr -= Offset.zextOrTrunc(CheckedAddr.getBitWidth());
----------------
nikic wrote:

```suggestion
              CheckedAddr -= Offset.sextOrTrunc(CheckedAddr.getBitWidth());
```

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


More information about the llvm-commits mailing list