[llvm] [IRBuilder] Limit created masked load/store alignment to valid 32bit values (PR #73647)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 06:54:47 PST 2023


================
@@ -584,7 +584,8 @@ CallInst *IRBuilderBase::CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment,
   if (!PassThru)
     PassThru = PoisonValue::get(Ty);
   Type *OverloadedTypes[] = { Ty, PtrTy };
-  Value *Ops[] = {Ptr, getInt32(Alignment.value()), Mask, PassThru};
+  unsigned Align32 = std::min<uint64_t>(Alignment.value(), 0x80000000ULL);
----------------
davemgreen wrote:

Sounds good. Is the 32 deliberate, or 1ULL<<31?

What about having a method in Align for getting the alignment limited to a 32bit value? Alignment.value32()? It would help encapsulate it.

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


More information about the llvm-commits mailing list