Skip to content

Commit

Permalink
Remove setting of inlinehint and cold attributes based on profile data
Browse files Browse the repository at this point in the history
NFC. These hints are only used for inlining and the inliner now uses
the same criteria to identify hot and cold callees and set appropriate
thresholds without relying on these hints. Hence this removed code is
superfluous.

Differential Revision: http://reviews.llvm.org/D15726

llvm-svn: 256793
  • Loading branch information
Easwaran Raman committed Jan 4, 2016
1 parent c602103 commit eed30e5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 60 deletions.
10 changes: 0 additions & 10 deletions clang/lib/CodeGen/CodeGenPGO.cpp
Expand Up @@ -721,17 +721,7 @@ CodeGenPGO::applyFunctionAttributes(llvm::IndexedInstrProfReader *PGOReader,
if (!haveRegionCounts())
return;

uint64_t MaxFunctionCount = PGOReader->getMaximumFunctionCount();
uint64_t FunctionCount = getRegionCount(nullptr);
if (FunctionCount >= (uint64_t)(0.3 * (double)MaxFunctionCount))
// Turn on InlineHint attribute for hot functions.
// FIXME: 30% is from preliminary tuning on SPEC, it may not be optimal.
Fn->addFnAttr(llvm::Attribute::InlineHint);
else if (FunctionCount <= (uint64_t)(0.01 * (double)MaxFunctionCount))
// Turn on Cold attribute for cold functions.
// FIXME: 1% is from preliminary tuning on SPEC, it may not be optimal.
Fn->addFnAttr(llvm::Attribute::Cold);

Fn->setEntryCount(FunctionCount);
}

Expand Down
48 changes: 0 additions & 48 deletions clang/test/Profile/c-attributes.c

This file was deleted.

4 changes: 2 additions & 2 deletions clang/test/Profile/func-entry.c
Expand Up @@ -5,10 +5,10 @@

void foo(void);

// CHECK: @foo() #0 !prof [[FOO:![0-9]+]]
// CHECK: @foo() #{{[0-9]}} !prof [[FOO:![0-9]+]]
void foo() { return; }

// CHECK: @main() #1 !prof [[MAIN:![0-9]+]]
// CHECK: @main() #{{[0-9]}} !prof [[MAIN:![0-9]+]]
int main() {
int i;
for (i = 0; i < 10000; i++) foo();
Expand Down

0 comments on commit eed30e5

Please sign in to comment.