summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 597fd364d78..06467fda6ef 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -725,7 +725,8 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
}
if (D->hasAttr<ColdAttr>()) {
- B.addAttribute(llvm::Attribute::OptimizeForSize);
+ if (!D->hasAttr<OptimizeNoneAttr>())
+ B.addAttribute(llvm::Attribute::OptimizeForSize);
B.addAttribute(llvm::Attribute::Cold);
}
@@ -766,7 +767,9 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
F->addFnAttr(llvm::Attribute::NoInline);
// OptimizeNone wins over OptimizeForSize, MinSize, AlwaysInline.
- F->removeFnAttr(llvm::Attribute::OptimizeForSize);
+ assert(!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) &&
+ "OptimizeNone and OptimizeForSize on same function!");
+ // FIXME: Change these to asserts.
F->removeFnAttr(llvm::Attribute::MinSize);
F->removeFnAttr(llvm::Attribute::AlwaysInline);
OpenPOWER on IntegriCloud