[clang] 6b2f820 - [NFC][Codegen] Use MaybeAlign + APInt::getLimitedValue() when creating Alignment attr
Roman Lebedev via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 21 10:19:26 PST 2020
Author: Roman Lebedev
Date: 2020-01-21T21:18:29+03:00
New Revision: 6b2f820221c78c05527d6edb756b4f1f44665968
URL: https://github.com/llvm/llvm-project/commit/6b2f820221c78c05527d6edb756b4f1f44665968
DIFF: https://github.com/llvm/llvm-project/commit/6b2f820221c78c05527d6edb756b4f1f44665968.diff
LOG: [NFC][Codegen] Use MaybeAlign + APInt::getLimitedValue() when creating Alignment attr
Summary: Just an NFC code cleanup i stumbled upon when stumbling through clang alignment attribute handling.
Reviewers: erichkeane, gchatelet, courbet, jdoerfert
Reviewed By: gchatelet
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72993
Added:
Modified:
clang/lib/CodeGen/CGCall.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index c5d73eb6ff22..69c0b0b03666 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2440,9 +2440,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
EmitScalarExpr(AVAttr->getAlignment());
llvm::ConstantInt *AlignmentCI =
cast<llvm::ConstantInt>(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))));
}
}
More information about the cfe-commits
mailing list