aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/attr-forcesizeopt.c
blob: c4e6c4ad817c2e2baaeb33b15593060122957f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %clang_cc1 -Oz -emit-llvm %s -o - | FileCheck %s -check-prefix=Oz
// RUN: %clang_cc1 -O0 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -O1 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -O2 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -O3 -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// RUN: %clang_cc1 -Os -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER
// Check that we set the forcesizeopt attribute on each function
// when Oz optimization level is set.

int test1() {
  return 42;
// Oz: @test1{{.*}}forcesizeopt
// Oz: ret
// OTHER: @test1
// OTHER-NOT: forcesizeopt
// OTHER: ret
}

int test2() {
  return 42;
// Oz: @test2{{.*}}forcesizeopt
// Oz: ret
// OTHER: @test2
// OTHER-NOT: forcesizeopt
// OTHER: ret
}