summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2013-05-24 20:18:15 +0000
committerDiego Novillo <dnovillo@google.com>2013-05-24 20:18:15 +0000
commit5f2b1ce21ecdacdd5d16a63fd880199befe3d074 (patch)
treef06917bc3f69a8cfe4691f7be128c9f8a9a3c0b2 /clang/lib/CodeGen/CodeGenModule.cpp
parent23bbd617e46ac1c12277ac073cc49a6b6290c684 (diff)
downloadbcm5719-llvm-5f2b1ce21ecdacdd5d16a63fd880199befe3d074.tar.gz
bcm5719-llvm-5f2b1ce21ecdacdd5d16a63fd880199befe3d074.zip
[PATCH] Generate cold attribute for functions marked __atribute__((cold))
This removes a FIXME in CodeGenModule::SetLLVMFunctionAttributesForDefinition. When a function is declared cold we can now generate the IR attribute in addition to marking the function to be optimized for size. I tried adding a separate CHECK in the existing test, but it was failing. I suppose CHECK matches one line exactly once? This would be a problem if the attributes are listed in a different order, though they seem to be sorted. llvm-svn: 182666
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index e65128813e1..7ad08e0e0a7 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -620,9 +620,10 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
B.addAttribute(llvm::Attribute::AlwaysInline);
}
- // FIXME: Communicate hot and cold attributes to LLVM more directly.
- if (D->hasAttr<ColdAttr>())
+ if (D->hasAttr<ColdAttr>()) {
B.addAttribute(llvm::Attribute::OptimizeForSize);
+ B.addAttribute(llvm::Attribute::Cold);
+ }
if (D->hasAttr<MinSizeAttr>())
B.addAttribute(llvm::Attribute::MinSize);
OpenPOWER on IntegriCloud