[PATCH] D121898: [Verifier] Verify parameter alignment.

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 23:17:28 PDT 2022


pengfei added inline comments.


================
Comment at: llvm/lib/IR/Verifier.cpp:3149-3157
+    Align ABIAlign = DL.getABITypeAlign(Ty);
+    // ArgFlagsTy::MemAlign only have 4 bits for alignment, so the
+    // alignment size should not exceed 2^15. Since encode(Align)
+    // would plus the shift value by 1, the alignment size should
+    // not exceed 2^14, otherwise it can NOT be properly lowered
+    // in backend.
+    Align MaxAlign(1 << 15);
----------------
skan wrote:
> LuoYuanke wrote:
> > pengfei wrote:
> > > The variables are only used in Assert, should add `#ifndef NDEBUG` to them? Surprisingly I didn't find an example in this file.
> > The Assert is defined as below. Let me check if it will fail in release build.
> > 
> > ```
> > #define Assert(C, ...) \
> >   do { if (!(C)) { CheckFailed(__VA_ARGS__); return; } } while (false)
> > ```
> This `Assert` is different from assert. It is enabled no matter NDEBUG is turned on or off
Good to know, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121898



More information about the llvm-commits mailing list