From 75e649f6f48d121f830f244827551618d903fd07 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 9 Oct 2011 21:39:12 +0000 Subject: [PATCH] tree-ssa-forwprop.c (forward_propagate_into_comparison): Do not make the replacement if the conversion to the LHS type is not useless. * tree-ssa-forwprop.c (forward_propagate_into_comparison): Do not make the replacement if the conversion to the LHS type is not useless. From-SVN: r179730 --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-forwprop.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 925b62577e0..3a3c9853a16 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-10-09 Eric Botcazou + + * tree-ssa-forwprop.c (forward_propagate_into_comparison): Do not make + the replacement if the conversion to the LHS type is not useless. + 2011-10-09 Ira Rosen PR tree-optimization/50635 diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index a8737dac933..de782c9be9f 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -465,16 +465,15 @@ forward_propagate_into_comparison (gimple_stmt_iterator *gsi) gimple stmt = gsi_stmt (*gsi); tree tmp; bool cfg_changed = false; + tree type = TREE_TYPE (gimple_assign_lhs (stmt)); tree rhs1 = gimple_assign_rhs1 (stmt); tree rhs2 = gimple_assign_rhs2 (stmt); /* Combine the comparison with defining statements. */ tmp = forward_propagate_into_comparison_1 (stmt, gimple_assign_rhs_code (stmt), - TREE_TYPE - (gimple_assign_lhs (stmt)), - rhs1, rhs2); - if (tmp) + type, rhs1, rhs2); + if (tmp && useless_type_conversion_p (type, TREE_TYPE (tmp))) { gimple_assign_set_rhs_from_tree (gsi, tmp); fold_stmt (gsi); -- 2.30.2