summaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-04-10 18:20:19 +0000
committerEric Christopher <echristo@apple.com>2012-04-10 18:20:19 +0000
commitc07833795aa6e569de5bb90945f5017b9969288d (patch)
tree20f71fbe610517242e7ff793c7f66b85bc88318d /test/CodeGen
parent10ccf12a06cc1ef5b778c20565945f313a9a2c26 (diff)
For debug and coverage analysis if we're not optimizing go ahead
and emit a relatively empty block for a plain break statement. This enables us to track where we went through a switch. PR9796 & rdar://11215207 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154420 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/debug-line-1.c19
-rw-r--r--test/CodeGen/switch-dce.c31
2 files changed, 28 insertions, 22 deletions
diff --git a/test/CodeGen/debug-line-1.c b/test/CodeGen/debug-line-1.c
new file mode 100644
index 0000000000..b31de55c8c
--- /dev/null
+++ b/test/CodeGen/debug-line-1.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -g %s | FileCheck %s
+// PR9796
+
+// Check to make sure that we emit the block for the break so that we can count the line.
+// CHECK: sw.bb: ; preds = %entry
+// CHECK: br label %sw.epilog, !dbg !21
+
+extern int atoi(const char *);
+
+int f(char* arg) {
+ int x = atoi(arg);
+
+ switch(x) {
+ case 1:
+ break;
+ }
+
+ return 0;
+}
diff --git a/test/CodeGen/switch-dce.c b/test/CodeGen/switch-dce.c
index bbb5f7e5aa..a18d3bc89e 100644
--- a/test/CodeGen/switch-dce.c
+++ b/test/CodeGen/switch-dce.c
@@ -216,32 +216,19 @@ void test12() {
}
}
-
-// rdar://9289524 - Check that the empty cases don't produce an empty block.
+// Verify that case 42 only calls test14 once.
// CHECK: @test13
-// CHECK: switch
-// CHECK: i32 42, label [[EPILOG:%[0-9.a-z]+]]
-// CHECK: i32 11, label [[EPILOG]]
+// CHECK: call void @test13(i32 97)
+// CHECK-NEXT: br label %[[EPILOG2:[0-9.a-z]+]]
+// CHECK: [[EPILOG2]]
+// CHECK-NEXT: br label [[EPILOG:%[0-9.a-z]+]]
+// CHECK: call void @test13(i32 42)
+// CHECK-NEXT: br label [[EPILOG]]
void test13(int x) {
switch (x) {
- case 42: break; // No empty block please.
- case 11: break; // No empty block please.
- default: test13(42); break;
- }
-}
-
-
-// Verify that case 42 only calls test14 once.
-// CHECK: @test14
-// CHECK: call void @test14(i32 97)
-// CHECK-NEXT: br label [[EPILOG2:%[0-9.a-z]+]]
-// CHECK: call void @test14(i32 42)
-// CHECK-NEXT: br label [[EPILOG2]]
-void test14(int x) {
- switch (x) {
- case 42: test14(97); // fallthrough
+ case 42: test13(97); // fallthrough
case 11: break;
- default: test14(42); break;
+ default: test13(42); break;
}
}