Fix constant propagation for repeat_statement_c class.
authorManuele Conti <conti.ma@alice.it>
Thu, 03 Jan 2013 23:39:25 +0100
changeset 790 a722594dcd64
parent 789 861e92dc879b
child 791 ab601bdea102
Fix constant propagation for repeat_statement_c class.
stage3/constant_folding.cc
--- a/stage3/constant_folding.cc	Thu Jan 03 23:16:19 2013 +0100
+++ b/stage3/constant_folding.cc	Thu Jan 03 23:39:25 2013 +0100
@@ -1383,13 +1383,14 @@
 	map_values_t values_incoming;
 	map_values_t values_statement_result;
 
+	values_incoming = values; /* save incoming status */
+	symbol->statement_list->accept(*this);
+
 	/* Optimize dead code */
 	symbol->expression->accept(*this);
-	if (VALID_CVALUE(bool, symbol->expression) && GET_CVALUE(bool, symbol->expression) == false)
+	if (VALID_CVALUE(bool, symbol->expression) && GET_CVALUE(bool, symbol->expression) == true)
 		return NULL;
 
-	values_incoming = values; /* save incoming status */
-	symbol->statement_list->accept(*this);
 	values_statement_result = values;
 	values = inner_left_join_values(values_statement_result, values_incoming);