forked from OSchip/llvm-project
Partially revert "[IR] Attribute/AttrBuilder: use Value::MaximumAlignment magic constant"
Apparently makes bots angry.
This reverts commit d096f8d306
.
This commit is contained in:
parent
fa2fc81d34
commit
1624cba782
|
@ -372,15 +372,6 @@ class Sema final {
|
||||||
QualType ResultTy,
|
QualType ResultTy,
|
||||||
ArrayRef<QualType> Args);
|
ArrayRef<QualType> Args);
|
||||||
|
|
||||||
/// The maximum alignment, same as in llvm::Value. We duplicate them here
|
|
||||||
/// because that allows us not to duplicate the constants in clang code,
|
|
||||||
/// which we must to since we can't directly use the llvm constants.
|
|
||||||
///
|
|
||||||
/// This is the greatest alignment value supported by load, store, and alloca
|
|
||||||
/// instructions, and global values.
|
|
||||||
static const unsigned MaxAlignmentExponent = 29;
|
|
||||||
static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef OpaquePtr<DeclGroupRef> DeclGroupPtrTy;
|
typedef OpaquePtr<DeclGroupRef> DeclGroupPtrTy;
|
||||||
typedef OpaquePtr<TemplateName> TemplateTy;
|
typedef OpaquePtr<TemplateName> TemplateTy;
|
||||||
|
|
|
@ -5373,9 +5373,11 @@ bool Sema::SemaBuiltinAssumeAligned(CallExpr *TheCall) {
|
||||||
return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two)
|
return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two)
|
||||||
<< Arg->getSourceRange();
|
<< Arg->getSourceRange();
|
||||||
|
|
||||||
if (Result > Sema::MaximumAlignment)
|
// Alignment calculations can wrap around if it's greater than 2**29.
|
||||||
|
unsigned MaximumAlignment = 536870912;
|
||||||
|
if (Result > MaximumAlignment)
|
||||||
Diag(TheCall->getBeginLoc(), diag::warn_assume_aligned_too_great)
|
Diag(TheCall->getBeginLoc(), diag::warn_assume_aligned_too_great)
|
||||||
<< Arg->getSourceRange() << Sema::MaximumAlignment;
|
<< Arg->getSourceRange() << MaximumAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumArgs > 2) {
|
if (NumArgs > 2) {
|
||||||
|
|
|
@ -3810,9 +3810,13 @@ void Sema::AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AlignVal > Sema::MaximumAlignment) {
|
// Alignment calculations can wrap around if it's greater than 2**28.
|
||||||
|
unsigned MaxValidAlignment =
|
||||||
|
Context.getTargetInfo().getTriple().isOSBinFormatCOFF() ? 8192
|
||||||
|
: 268435456;
|
||||||
|
if (AlignVal > MaxValidAlignment) {
|
||||||
Diag(AttrLoc, diag::err_attribute_aligned_too_great)
|
Diag(AttrLoc, diag::err_attribute_aligned_too_great)
|
||||||
<< Sema::MaximumAlignment << E->getSourceRange();
|
<< MaxValidAlignment << E->getSourceRange();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue