diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-07-21 23:12:18 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-07-21 23:12:18 +0000 |
commit | 8d0dc31dcada7f8002022b02a1cee471494e530b (patch) | |
tree | 03cb4aaeb4dc0f66bb8fde6afa282a87c40d41fd /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 70523c79260864b64c95bb2b31746eacbf2e06bd (diff) | |
download | bcm5719-llvm-8d0dc31dcada7f8002022b02a1cee471494e530b.tar.gz bcm5719-llvm-8d0dc31dcada7f8002022b02a1cee471494e530b.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index af6a0113f2d..53efaa6349f 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -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) { |