From 3c7c0158052509c4d4a0a7983c7ebf821551443c Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Thu, 14 Jan 2010 08:37:26 +0000 Subject: re PR tree-optimization/42681 (ICE: in build2_stat, at tree.c:3664 with "-O1 -fgraphite-identity") Fix PR42681. 2010-01-14 Sebastian Pop PR middle-end/42681 * graphite-clast-to-gimple.c (gloog_error): New static variable. (clast_to_gcc_expression): Do not build MULT_EXPR of POINTER_TYPE_P. Set gloog_error when such an expression failed to be built. (translate_clast): Early return when gloog_error is set. (gloog): Clear gloog_error. When gloog_error is set, call set_ifsese_condition to enable the original code. Return the status of the code generation based on gloog_error. * sese.c (set_ifsese_condition): New. * sese.h (set_ifsese_condition): Declared. * testsuite/g++.dg/graphite/pr42681.C: New. From-SVN: r155884 --- gcc/sese.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gcc/sese.c') diff --git a/gcc/sese.c b/gcc/sese.c index 1c4686d..f959bdb 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -1558,6 +1558,34 @@ move_sese_in_condition (sese region) return if_region; } +/* Replaces the condition of the IF_REGION with CONDITION: + | if (CONDITION) + | true_region; + | else + | false_region; +*/ + +void +set_ifsese_condition (ifsese if_region, tree condition) +{ + sese region = if_region->region; + edge entry = region->entry; + basic_block bb = entry->dest; + gimple last = last_stmt (bb); + gimple_stmt_iterator gsi = gsi_last_bb (bb); + gimple cond_stmt; + + gcc_assert (gimple_code (last) == GIMPLE_COND); + + gsi_remove (&gsi, true); + gsi = gsi_last_bb (bb); + condition = force_gimple_operand_gsi (&gsi, condition, true, NULL, + false, GSI_NEW_STMT); + cond_stmt = gimple_build_cond_from_tree (condition, NULL_TREE, NULL_TREE); + gsi = gsi_last_bb (bb); + gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT); +} + /* Returns the scalar evolution of T in REGION. Every variable that is not defined in the REGION is considered a parameter. */ -- cgit v1.1