aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/switch-dce.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-17 00:54:30 +0000
committerChris Lattner <sabre@nondot.org>2011-04-17 00:54:30 +0000
commitb11f9198111796ada02b57f62cdea92134fde9f7 (patch)
treeef962f36d01588087abb2b0701ce24cc18d1c62b /test/CodeGen/switch-dce.c
parenta5e5e0f41e1dcee4603244ccea3d3956c55c23ac (diff)
implement rdar://9289524 - case followed immediately by break results in empty IR block,
a -O0 code quality issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/switch-dce.c')
-rw-r--r--test/CodeGen/switch-dce.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CodeGen/switch-dce.c b/test/CodeGen/switch-dce.c
index a03c4001d3..07a5eba236 100644
--- a/test/CodeGen/switch-dce.c
+++ b/test/CodeGen/switch-dce.c
@@ -216,3 +216,18 @@ void test12() {
}
}
+
+// rdar://9289524 - Check that the empty cases don't produce an empty block.
+// CHECK: @test13
+// CHECK: switch
+// CHECK: i32 42, label %sw.epilog
+// CHECK: i32 11, label %sw.epilog
+// CHECK: sw.epilog:
+// CHECK: ret void
+void test13(int x) {
+ switch (x) {
+ case 42: break; // No empty block please.
+ case 11: break; // No empty block please.
+ default: test13(42); break;
+ }
+}