Make skipping of vardecls more precise: it's ok to skip a decl if the entire
compound stmt containing the decl is skipped.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126639 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/switch-dce.c b/test/CodeGen/switch-dce.c
index 82b2061..a03c400 100644
--- a/test/CodeGen/switch-dce.c
+++ b/test/CodeGen/switch-dce.c
@@ -87,6 +87,7 @@
     int x;  // eliding var decl?
     case 1:
       x = 4;
+      i = x;
       break;
   } 
 }
@@ -196,3 +197,22 @@
       break;
   }
 }
+
+// CHECK: @test12
+// CHECK-NOT: switch
+// CHECK: ret void
+void test12() {
+  switch (1) {
+  case 2: {
+     int a;   // Ok to skip this vardecl.
+     a = 42;
+   }
+  case 1:
+    break;
+  case 42: ;
+    int x;  // eliding var decl?
+    x = 4;
+    break;
+  }
+}
+