[PATCH] D72993: [NFC][Codegen] Use MaybeAlign + APInt::getLimitedValue() when creating Alignment attr
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 19 02:15:43 PST 2020
lebedev.ri created this revision.
lebedev.ri added reviewers: erichkeane, gchatelet, courbet, jdoerfert.
lebedev.ri added a project: clang.
lebedev.ri added a parent revision: D72979: [Codegen] Emit both AssumeAlignedAttr and AllocAlignAttr assumptions if they exist.
Just an NFC code cleanup i stumbled upon when stumbling through clang alignment attribute handling.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72993
Files:
clang/lib/CodeGen/CGCall.cpp
Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2441,9 +2441,8 @@
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))));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72993.238977.patch
Type: text/x-patch
Size: 771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200119/9f3ff1f2/attachment.bin>
More information about the cfe-commits
mailing list