[cfe-commits] r126603 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGen/switch-dce.c

Chris Lattner sabre at nondot.org
Sun Feb 27 17:06:02 PST 2011


Author: lattner
Date: Sun Feb 27 19:06:02 2011
New Revision: 126603

URL: http://llvm.org/viewvc/llvm-project?rev=126603&view=rev
Log:
remove a bogus assertion, add a comment.

Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/test/CodeGen/switch-dce.c

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=126603&r1=126602&r2=126603&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sun Feb 27 19:06:02 2011
@@ -857,9 +857,6 @@
                                             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 @@
   // 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;

Modified: cfe/trunk/test/CodeGen/switch-dce.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/switch-dce.c?rev=126603&r1=126602&r2=126603&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/switch-dce.c (original)
+++ cfe/trunk/test/CodeGen/switch-dce.c Sun Feb 27 19:06:02 2011
@@ -167,3 +167,16 @@
   } 
 }
 
+
+int test10(void) {
+	switch(8) {
+		case 8:
+			break;
+		case 4:
+			break;
+		default:
+			dead();
+	}
+	
+	return 0;
+}





More information about the cfe-commits mailing list