You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
#include "config.h"
#include "system.h"
tree stmt, initial, step1, stmts;
tree vb, va;
enum tree_code incr_op = PLUS_EXPR;
+ edge pe = loop_preheader_edge (loop);
if (!var)
{
{
if (TYPE_UNSIGNED (TREE_TYPE (step)))
{
- step1 = fold (build1 (NEGATE_EXPR, TREE_TYPE (step), step));
+ step1 = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step);
if (tree_int_cst_lt (step1, step))
{
incr_op = MINUS_EXPR;
&& may_negate_without_overflow_p (step))
{
incr_op = MINUS_EXPR;
- step = fold (build1 (NEGATE_EXPR, TREE_TYPE (step), step));
+ step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step);
}
}
}
+ /* Gimplify the step if necessary. We put the computations in front of the
+ loop (i.e. the step should be loop invariant). */
+ step = force_gimple_operand (step, &stmts, true, var);
+ if (stmts)
+ bsi_insert_on_edge_immediate_loop (pe, stmts);
+
stmt = build2 (MODIFY_EXPR, void_type_node, va,
build2 (incr_op, TREE_TYPE (base),
vb, step));
initial = force_gimple_operand (base, &stmts, true, var);
if (stmts)
- {
- edge pe = loop_preheader_edge (loop);
-
- bsi_insert_on_edge_immediate_loop (pe, stmts);
- }
+ bsi_insert_on_edge_immediate_loop (pe, stmts);
stmt = create_phi_node (vb, loop->header);
SSA_NAME_DEF_STMT (vb) = stmt;
unsigned i;
for (i = first_new_block; i < (unsigned) last_basic_block; i++)
- BASIC_BLOCK (i)->rbi->duplicated = 1;
+ BASIC_BLOCK (i)->flags |= BB_DUPLICATED;
for (i = first_new_block; i < (unsigned) last_basic_block; i++)
add_phi_args_after_copy_bb (BASIC_BLOCK (i));
for (i = first_new_block; i < (unsigned) last_basic_block; i++)
- BASIC_BLOCK (i)->rbi->duplicated = 0;
+ BASIC_BLOCK (i)->flags &= ~BB_DUPLICATED;
}