Home | History | Annotate | Download | only in CodeGen
      1 // 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))
      6 int test2() { return 0; }
      7 // PRESENT-DAG: @test2{{.*}}[[ATTR2:#[0-9]+]]
      8 
      9 __attribute__((optnone)) __attribute__((minsize))
     10 int test3() { return 0; }
     11 // PRESENT-DAG: @test3{{.*}}[[ATTR3:#[0-9]+]]
     12 
     13 __attribute__((optnone)) __attribute__((cold))
     14 int 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-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
     26