diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -2440,9 +2440,8 @@ EmitScalarExpr(AVAttr->getAlignment()); llvm::ConstantInt *AlignmentCI = cast(AlignmentValue); - unsigned Alignment = std::min((unsigned)AlignmentCI->getZExtValue(), - +llvm::Value::MaximumAlignment); - AI->addAttrs(llvm::AttrBuilder().addAlignmentAttr(Alignment)); + AI->addAttrs(llvm::AttrBuilder().addAlignmentAttr(llvm::MaybeAlign( + AlignmentCI->getLimitedValue(llvm::Value::MaximumAlignment)))); } }