mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
059f34b0db
We're currently omitting a lot of them. This requires reverting a few more patches that were followups for llvmorg-13-init-8182-gc2297544c047. Differential Revision: https://phabricator.services.mozilla.com/D133318
65 lines
2.4 KiB
Diff
65 lines
2.4 KiB
Diff
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
|
|
index b0b64328b84e..ae0aca09ea4a 100644
|
|
--- a/clang/lib/CodeGen/CGCall.cpp
|
|
+++ b/clang/lib/CodeGen/CGCall.cpp
|
|
@@ -2087,6 +2087,24 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
|
|
// allows it to work on indirect virtual function calls.
|
|
if (AttrOnCallSite && TargetDecl->hasAttr<NoMergeAttr>())
|
|
FuncAttrs.addAttribute(llvm::Attribute::NoMerge);
|
|
+
|
|
+ // Add known guaranteed alignment for allocation functions.
|
|
+ if (unsigned BuiltinID = Fn->getBuiltinID()) {
|
|
+ switch (BuiltinID) {
|
|
+ case Builtin::BIaligned_alloc:
|
|
+ case Builtin::BIcalloc:
|
|
+ case Builtin::BImalloc:
|
|
+ case Builtin::BImemalign:
|
|
+ case Builtin::BIrealloc:
|
|
+ case Builtin::BIstrdup:
|
|
+ case Builtin::BIstrndup:
|
|
+ RetAttrs.addAlignmentAttr(Context.getTargetInfo().getNewAlign() /
|
|
+ Context.getTargetInfo().getCharWidth());
|
|
+ break;
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
// 'const', 'pure' and 'noalias' attributed functions are also nounwind.
|
|
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
|
|
index 506af5d1458c..5c22df026a7d 100644
|
|
--- a/clang/lib/Sema/SemaDecl.cpp
|
|
+++ b/clang/lib/Sema/SemaDecl.cpp
|
|
@@ -15215,30 +15215,6 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) {
|
|
else
|
|
FD->addAttr(CUDAHostAttr::CreateImplicit(Context, FD->getLocation()));
|
|
}
|
|
-
|
|
- // Add known guaranteed alignment for allocation functions.
|
|
- switch (BuiltinID) {
|
|
- case Builtin::BIaligned_alloc:
|
|
- case Builtin::BIcalloc:
|
|
- case Builtin::BImalloc:
|
|
- case Builtin::BImemalign:
|
|
- case Builtin::BIrealloc:
|
|
- case Builtin::BIstrdup:
|
|
- case Builtin::BIstrndup: {
|
|
- if (!FD->hasAttr<AssumeAlignedAttr>()) {
|
|
- unsigned NewAlign = Context.getTargetInfo().getNewAlign() /
|
|
- Context.getTargetInfo().getCharWidth();
|
|
- IntegerLiteral *Alignment = IntegerLiteral::Create(
|
|
- Context, Context.MakeIntValue(NewAlign, Context.UnsignedIntTy),
|
|
- Context.UnsignedIntTy, FD->getLocation());
|
|
- FD->addAttr(AssumeAlignedAttr::CreateImplicit(
|
|
- Context, Alignment, /*Offset=*/nullptr, FD->getLocation()));
|
|
- }
|
|
- break;
|
|
- }
|
|
- default:
|
|
- break;
|
|
- }
|
|
}
|
|
|
|
AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(FD);
|