]> granicus.if.org Git - clang/commitdiff
remove a bogus assertion, add a comment.
authorChris Lattner <sabre@nondot.org>
Mon, 28 Feb 2011 01:06:02 +0000 (01:06 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 28 Feb 2011 01:06:02 +0000 (01:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126603 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp
test/CodeGen/switch-dce.c

index 70cda5a22547fb8df74d1a47a4703851d8b94a34..c67d1d1b0da67f5e8ad324cd2e32793d852fb391 100644 (file)
@@ -857,9 +857,6 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S,
                                             const SwitchCase *Case,
                                             bool &FoundCase,
                               llvm::SmallVectorImpl<const Stmt*> &ResultStmts) {
-  assert((!FoundCase || Case == 0) &&
-         "Can't be looking for the case if we already found it!");
-  
   // If this is a null statement, just succeed.
   if (S == 0)
     return Case ? CSFC_Success : CSFC_FallThrough;
@@ -942,6 +939,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S,
   // just verify it doesn't have labels, which would make it invalid to elide.
   if (Case) {
     if (CodeGenFunction::ContainsLabel(S, true) ||
+        // Don't skip over DeclStmts, which can be used even if skipped over.
         isa<DeclStmt>(S))
       return CSFC_Failure;
     return CSFC_Success;
index 32767377931d4bc8c819325c18190886a5b98923..95c5e03633ab627791ac206a7cac1f8f9e7bb9c3 100644 (file)
@@ -167,3 +167,16 @@ void test9(int i) {
   } 
 }
 
+
+int test10(void) {
+       switch(8) {
+               case 8:
+                       break;
+               case 4:
+                       break;
+               default:
+                       dead();
+       }
+       
+       return 0;
+}