brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 4a26e85 Raw
80 lines · cpp
1// RUN: %clang_cc1 -Oz -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s -check-prefix=Oz2// RUN: %clang_cc1     -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER3// RUN: %clang_cc1 -O1 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER4// RUN: %clang_cc1 -O2 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER5// RUN: %clang_cc1 -O3 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER6// RUN: %clang_cc1 -Os -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s -check-prefix=OTHER7// Check that we set the minsize attribute on each function8// when Oz optimization level is set.9 10__attribute__((minsize))11int test1() {12  return 42;13// Oz: @{{.*}}test1{{.*}}[[MINSIZE:#[0-9]+]]14// OTHER: @{{.*}}test1{{.*}}[[MS:#[0-9]+]]15}16 17int test2() {18  return 42;19// Oz: @{{.*}}test2{{.*}}[[MINSIZE]]20// Oz: ret21// OTHER: @{{.*}}test222// OTHER-NOT: [[MS]]23// OTHER: ret24}25 26int test3() {27  return 42;28// Oz: @{{.*}}test3{{.*}}[[MINSIZE]]29// Oz: ret30// OTHER: @{{.*}}test331// OTHER-NOT: [[MS]]32// OTHER: ret33}34 35// Check that the minsize attribute is well propagated through36// template instantiation37 38template<typename T>39__attribute__((minsize))40void test4(T arg) {41  return;42}43 44template45void test4<int>(int arg);46// Oz: define{{.*}}void @{{.*}}test447// Oz: [[MINSIZE]]48// OTHER: define{{.*}}void @{{.*}}test449// OTHER: [[MS]]50 51template52void test4<float>(float arg);53// Oz: define{{.*}}void @{{.*}}test454// Oz: [[MINSIZE]]55// OTHER: define{{.*}}void @{{.*}}test456// OTHER: [[MS]]57 58template<typename T>59void test5(T arg) {60  return;61}62 63template64void test5<int>(int arg);65// Oz: define{{.*}}void @{{.*}}test566// Oz: [[MINSIZE]]67// OTHER: define{{.*}}void @{{.*}}test568// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]69 70template71void test5<float>(float arg);72// Oz: define{{.*}}void @{{.*}}test573// Oz: [[MINSIZE]]74// OTHER: define{{.*}}void @{{.*}}test575// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]76 77// Oz: attributes [[MINSIZE]] = { minsize{{.*}} }78 79// OTHER: attributes [[MS]] = { minsize{{.*}} }80