Clang Project

clang_source_code/test/CodeGen/attr-coldhot.c
1// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s -check-prefixes=CHECK,O0
2// RUN: %clang_cc1 -emit-llvm %s -o - -O1 -disable-llvm-passes | FileCheck %s -check-prefixes=CHECK,O1
3
4int test1() __attribute__((__cold__)) {
5  return 42;
6
7// Check that we set the optsize attribute on the function.
8// CHECK: @test1{{.*}}[[ATTR:#[0-9]+]]
9// CHECK: ret
10}
11
12// O0: attributes [[ATTR]] = { {{.*}}cold{{.*}}optnone{{.*}} }
13// O1: attributes [[ATTR]] = { {{.*}}cold{{.*}}optsize{{.*}} }
14