diff options
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 1401092..a3afe87 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -7507,7 +7507,8 @@ gimple_fold_stmt_to_constant_1 (gimple *stmt, tree (*valueize) (tree), tree op1 = (*valueize) (gimple_assign_rhs2 (stmt)); tree op2 = (*valueize) (gimple_assign_rhs3 (stmt)); return fold_ternary_loc (loc, subcode, - gimple_expr_type (stmt), op0, op1, op2); + TREE_TYPE (gimple_assign_lhs (stmt)), + op0, op1, op2); } default: @@ -8901,16 +8902,17 @@ gimple_assign_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, int depth) { enum tree_code code = gimple_assign_rhs_code (stmt); + tree type = TREE_TYPE (gimple_assign_lhs (stmt)); switch (get_gimple_rhs_class (code)) { case GIMPLE_UNARY_RHS: return tree_unary_nonnegative_warnv_p (gimple_assign_rhs_code (stmt), - gimple_expr_type (stmt), + type, gimple_assign_rhs1 (stmt), strict_overflow_p, depth); case GIMPLE_BINARY_RHS: return tree_binary_nonnegative_warnv_p (gimple_assign_rhs_code (stmt), - gimple_expr_type (stmt), + type, gimple_assign_rhs1 (stmt), gimple_assign_rhs2 (stmt), strict_overflow_p, depth); @@ -8938,12 +8940,12 @@ gimple_call_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, gimple_call_arg (stmt, 0) : NULL_TREE; tree arg1 = gimple_call_num_args (stmt) > 1 ? gimple_call_arg (stmt, 1) : NULL_TREE; - - return tree_call_nonnegative_warnv_p (gimple_expr_type (stmt), - gimple_call_combined_fn (stmt), - arg0, - arg1, - strict_overflow_p, depth); + tree lhs = gimple_call_lhs (stmt); + return (lhs + && tree_call_nonnegative_warnv_p (TREE_TYPE (lhs), + gimple_call_combined_fn (stmt), + arg0, arg1, + strict_overflow_p, depth)); } /* Return true if return value of call STMT is known to be non-negative. |