+2004-12-05 Roger Sayle <roger@eyesopen.com>
+
+ * c-typeck.c (c_finish_loop): Improve initial implementations
+ for loops whose conditions are known at compile-time.
+
2004-12-05 Kazu Hirata <kazu@cs.umass.edu>
* builtins.c: Fix comment typos.
{
tree entry = NULL, exit = NULL, t;
- /* Detect do { ... } while (0) and don't generate loop construct. */
- if (cond && !cond_is_first && integer_zerop (cond))
- cond = NULL;
- if (cond_is_first || cond)
+ /* If the condition is zero don't generate a loop construct. */
+ if (cond && integer_zerop (cond))
+ {
+ if (cond_is_first)
+ {
+ t = build_and_jump (&blab);
+ SET_EXPR_LOCATION (t, start_locus);
+ add_stmt (t);
+ }
+ }
+ else
{
tree top = build1 (LABEL_EXPR, void_type_node, NULL_TREE);
then we just build a jump back to the top. */
exit = build_and_jump (&LABEL_EXPR_LABEL (top));
- if (cond)
+ if (cond && !integer_nonzerop (cond))
{
/* Canonicalize the loop condition to the end. This means
generating a branch to the loop condition. Reuse the