blob: 7c4873f8c5f4cfcd76fa2c026490e73969920ee9 [file] [log] [blame]
Paul Robinsonf0674352014-03-31 22:29:15 +00001// RUN: %clang_cc1 -emit-llvm < %s > %t
2// RUN: FileCheck %s --check-prefix=PRESENT < %t
3// RUN: FileCheck %s --check-prefix=ABSENT < %t
4
5__attribute__((always_inline))
6int test2() { return 0; }
7// PRESENT-DAG: @test2{{.*}}[[ATTR2:#[0-9]+]]
8
9__attribute__((optnone)) __attribute__((minsize))
10int test3() { return 0; }
11// PRESENT-DAG: @test3{{.*}}[[ATTR3:#[0-9]+]]
12
13__attribute__((optnone)) __attribute__((cold))
14int test4() { return test2(); }
15// PRESENT-DAG: @test4{{.*}}[[ATTR4:#[0-9]+]]
16// Also check that test2 is inlined into test4 (always_inline still works).
17// PRESENT-DAG-NOT: call i32 @test2
18
19// Check for both noinline and optnone on each optnone function.
20// PRESENT-DAG: attributes [[ATTR3]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
21// PRESENT-DAG: attributes [[ATTR4]] = { {{.*}}noinline{{.*}}optnone{{.*}} }
22
23// Check that no 'optsize' or 'minsize' attributes appear.
24// ABSENT-NOT: optsize
25// ABSENT-NOT: minsize