forked from OSchip/llvm-project
[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
This commit is contained in:
parent
372cb38f45
commit
6b2f820221
|
@ -2440,9 +2440,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
|
||||||
EmitScalarExpr(AVAttr->getAlignment());
|
EmitScalarExpr(AVAttr->getAlignment());
|
||||||
llvm::ConstantInt *AlignmentCI =
|
llvm::ConstantInt *AlignmentCI =
|
||||||
cast<llvm::ConstantInt>(AlignmentValue);
|
cast<llvm::ConstantInt>(AlignmentValue);
|
||||||
unsigned Alignment = std::min((unsigned)AlignmentCI->getZExtValue(),
|
AI->addAttrs(llvm::AttrBuilder().addAlignmentAttr(llvm::MaybeAlign(
|
||||||
+llvm::Value::MaximumAlignment);
|
AlignmentCI->getLimitedValue(llvm::Value::MaximumAlignment))));
|
||||||
AI->addAttrs(llvm::AttrBuilder().addAlignmentAttr(Alignment));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue