This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix PR17656



On Oct 18, 2004, at 1:37 PM, Diego Novillo wrote:
	PR tree-optimization/17656
	* tree-ssa.c (replace_immediate_uses): When replacing a
	constant, if the call to fold_stmt produced a different
	statement, get an appropriate statement pointer by scanning
	STMT's basic block.
+	      basic_block bb = bb_for_stmt (stmt);
+	      block_stmt_iterator si;
+
+	      /* Start iterating at the start of the basic block
+		 holding STMT until we reach it.  This is slow, but
+		 it's the only way to get a statement pointer
+		 reliably.  */
+	      for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
+		if (bsi_stmt (si) == stmt)
+		  {
+		    fold_stmt (bsi_stmt_ptr (si));
+		    stmt = bsi_stmt (si);
+		    break;
+		  }
+	    }
 	}

Should you be using stmt_for_bsi instead which does the same thing as the for loop?

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]