blob: e7069b10f21accc2452b5ce0fe817d1b34eb8441 [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).
Nico Rieck4da7deb2014-05-23 19:07:25 +000017// PRESENT-NOT: call i32 @test2
Paul Robinsonf0674352014-03-31 22:29:15 +000018
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