Folding away unreachable case statement.
patch (slightly revised) by Aaron Ballman.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148359 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/switch-case-folding-2.cpp b/test/CodeGenCXX/switch-case-folding-2.cpp
new file mode 100644
index 0000000..e1e66cf
--- /dev/null
+++ b/test/CodeGenCXX/switch-case-folding-2.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// CHECK that we don't crash.
+
+extern int printf(const char*, ...);
+int test(int val){
+ switch (val) {
+ case 4:
+   do {
+     switch (6) {
+       case 6: do { case 5: printf("bad\n"); } while (0);
+     };
+   } while (0);
+ }
+ return 0;
+}
+
+int main(void) {
+ return test(5);
+}
+
+// CHECK-NOT: call i32 (i8*, ...)* @printf(