http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46761
Alexander Monakov <amonakov at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu.org --- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-12-03 16:54:26 UTC --- Sometimes graphite generates wrong guards for regions. The following patch fixes the attached testcase for me, but I have not tested it any further. diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index 9a90ef7..8a80033 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -986,7 +986,7 @@ graphite_create_new_loop_guard (sese region, edge entry_edge, : PLUS_EXPR, type, ub, one); /* When ub + 1 wraps around, use lb <= ub. */ - if (integer_zerop (ub_one)) + if (TREE_OVERFLOW_P (ub_one)) cond_expr = fold_build2 (LE_EXPR, boolean_type_node, lb, ub); else cond_expr = fold_build2 (LT_EXPR, boolean_type_node, lb, ub_one);