summaryrefslogtreecommitdiff
path: root/test/Transforms/StructurizeCFG/switch.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/StructurizeCFG/switch.ll')
-rw-r--r--test/Transforms/StructurizeCFG/switch.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/StructurizeCFG/switch.ll b/test/Transforms/StructurizeCFG/switch.ll
new file mode 100644
index 0000000000..316df57ea7
--- /dev/null
+++ b/test/Transforms/StructurizeCFG/switch.ll
@@ -0,0 +1,23 @@
+; RUN: opt -S -structurizecfg %s -o - | FileCheck %s
+
+; The structurizecfg pass cannot handle switch instructions, so we need to
+; make sure the lower switch pass is always run before structurizecfg.
+
+; CHECK-LABEL: @switch
+define void @switch(i32 addrspace(1)* %out, i32 %cond) nounwind {
+entry:
+; CHECK: icmp
+ switch i32 %cond, label %done [ i32 0, label %zero]
+
+; CHECK: zero:
+zero:
+; CHECK: store i32 7, i32 addrspace(1)* %out
+ store i32 7, i32 addrspace(1)* %out
+; CHECK: br label %done
+ br label %done
+
+; CHECK: done:
+done:
+; CHECK: ret void
+ ret void
+}