[PATCH] D128121: [NFC][Alignment] Remove max functions between Align and MaybeAlign

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 00:49:17 PDT 2022


gchatelet added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:6251
+        Alignment = std::max(
+            Alignment, llvm::Align(AlignmentAPI.getValue().getZExtValue()));
       }
----------------
courbet wrote:
> Why is this OK ? I'm seeing:
> 
> ```
> if (!SimpleV.hasValue())
>       return APInt(64, 0);
> ```
> 
> in `getAPIInt`
The assert above expects a value for alignment API and the value cannot be `0` for a valid alignment (should be at least `1`).
I'll tweak the assert to make sure this is true and use `assumeAligned` as an extra protection.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128121/new/

https://reviews.llvm.org/D128121



More information about the llvm-commits mailing list