Tighten up the set of operator new/operator delete calls we're permitted to
optimize, to follow the permissions granted in N3664. Under those rules, only calls generated by new-expressions and delete-expressions are permitted to be optimized, and direct calls to ::operator new and ::operator delete must be treated as normal calls. llvm-svn: 186799
This commit is contained in:
@@ -744,6 +744,12 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD,
|
||||
|
||||
if (const SectionAttr *SA = FD->getAttr<SectionAttr>())
|
||||
F->setSection(SA->getName());
|
||||
|
||||
// A replaceable global allocation function does not act like a builtin by
|
||||
// default, only if it is invoked by a new-expression or delete-expression.
|
||||
if (FD->isReplaceableGlobalAllocationFunction())
|
||||
F->addAttribute(llvm::AttributeSet::FunctionIndex,
|
||||
llvm::Attribute::NoBuiltin);
|
||||
}
|
||||
|
||||
void CodeGenModule::AddUsedGlobal(llvm::GlobalValue *GV) {
|
||||
|
||||
Reference in New Issue
Block a user