summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/switch.c')
-rw-r--r--test/CodeGen/switch.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/test/CodeGen/switch.c b/test/CodeGen/switch.c
index 3254fbf..96118f6 100644
--- a/test/CodeGen/switch.c
+++ b/test/CodeGen/switch.c
@@ -1,11 +1,11 @@
-// RUN: clang-cc %s -emit-llvm-bc -o - | opt -std-compile-opts -disable-output
+// RUN: clang-cc -triple i386-unknown-unknown -O3 %s -emit-llvm -o - | FileCheck %s
int foo(int i) {
int j = 0;
switch (i) {
case -1:
j = 1; break;
- case 1 :
+ case 1 :
j = 2; break;
case 2:
j = 3; break;
@@ -16,11 +16,10 @@ int foo(int i) {
return j;
}
-
int foo2(int i) {
int j = 0;
switch (i) {
- case 1 :
+ case 1 :
j = 2; break;
case 2 ... 10:
j = 3; break;
@@ -31,7 +30,6 @@ int foo2(int i) {
return j;
}
-
int foo3(int i) {
int j = 0;
switch (i) {
@@ -48,7 +46,7 @@ int foo3(int i) {
}
-int foo4(int i) {
+static int foo4(int i) {
int j = 0;
switch (i) {
case 111:
@@ -65,6 +63,17 @@ int foo4(int i) {
return j;
}
+// CHECK: define i32 @foo4t()
+// CHECK: ret i32 376
+// CHECK: }
+int foo4t() {
+ // 111 + 1 + 222 + 42 = 376
+ return foo4(111) + foo4(99) + foo4(222) + foo4(601);
+}
+
+// CHECK: define void @foo5()
+// CHECK-NOT: switch
+// CHECK: }
void foo5(){
switch(0){
default:
@@ -74,11 +83,17 @@ void foo5(){
}
}
+// CHECK: define void @foo6()
+// CHECK-NOT: switch
+// CHECK: }
void foo6(){
switch(0){
}
}
+// CHECK: define void @foo7()
+// CHECK-NOT: switch
+// CHECK: }
void foo7(){
switch(0){
foo7();
OpenPOWER on IntegriCloud