From da78c088b8ef930975ed8e7b77818066c26a641f Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 28 Jun 2017 14:24:00 +0000 Subject: 2017-06-28 Richard Biener PR middle-end/81227 * fold-const.c (negate_expr_p): Use TYPE_UNSIGNED, not TYPE_OVERFLOW_WRAPS. * match.pd (negate_expr_p): Likewise. * tree-ssa-reassoc.c (optimize_range_tests_diff): Use fold_build2, not fold_binary. * gcc.dg/pr81227.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249742 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 379a30ea285..1bcbbb58154 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -383,7 +383,7 @@ negate_expr_p (tree t) switch (TREE_CODE (t)) { case INTEGER_CST: - if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type)) + if (INTEGRAL_TYPE_P (type) && TYPE_UNSIGNED (type)) return true; /* Check that -CST will not overflow type. */ -- cgit v1.2.1 From 14c7029b1a1ab618631851340ba3b5697f3457fd Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 19 Jul 2017 12:31:59 +0000 Subject: PR tree-optimization/81346 * fold-const.h (fold_div_compare, range_check_type): Declare. * fold-const.c (range_check_type): New function. (build_range_check): Use range_check_type. (fold_div_compare): No longer static, rewritten into a match.pd helper function. (fold_comparison): Don't call fold_div_compare here. * match.pd (X / C1 op C2): New optimization using fold_div_compare as helper function. * gcc.dg/tree-ssa/pr81346-1.c: New test. * gcc.dg/tree-ssa/pr81346-2.c: New test. * gcc.dg/tree-ssa/pr81346-3.c: New test. * gcc.dg/tree-ssa/pr81346-4.c: New test. * gcc.target/i386/umod-3.c: Hide comparison against 1 from the compiler to avoid X / C1 op C2 optimization to trigger. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250338 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 228 ++++++++++++++++++++----------------------------------- 1 file changed, 84 insertions(+), 144 deletions(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1bcbbb58154..d702de2f97f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -132,7 +132,6 @@ static tree fold_binary_op_with_conditional_arg (location_t, enum tree_code, tree, tree, tree, tree, tree, int); -static tree fold_div_compare (location_t, enum tree_code, tree, tree, tree); static tree fold_negate_const (tree, tree); static tree fold_not_const (const_tree, tree); static tree fold_relational_const (enum tree_code, tree, tree, tree); @@ -4787,6 +4786,39 @@ maskable_range_p (const_tree low, const_tree high, tree type, tree *mask, return true; } +/* Helper routine for build_range_check and match.pd. Return the type to + perform the check or NULL if it shouldn't be optimized. */ + +tree +range_check_type (tree etype) +{ + /* First make sure that arithmetics in this type is valid, then make sure + that it wraps around. */ + if (TREE_CODE (etype) == ENUMERAL_TYPE || TREE_CODE (etype) == BOOLEAN_TYPE) + etype = lang_hooks.types.type_for_size (TYPE_PRECISION (etype), + TYPE_UNSIGNED (etype)); + + if (TREE_CODE (etype) == INTEGER_TYPE && !TYPE_OVERFLOW_WRAPS (etype)) + { + tree utype, minv, maxv; + + /* Check if (unsigned) INT_MAX + 1 == (unsigned) INT_MIN + for the type in question, as we rely on this here. */ + utype = unsigned_type_for (etype); + maxv = fold_convert (utype, TYPE_MAX_VALUE (etype)); + maxv = range_binop (PLUS_EXPR, NULL_TREE, maxv, 1, + build_int_cst (TREE_TYPE (maxv), 1), 1); + minv = fold_convert (utype, TYPE_MIN_VALUE (etype)); + + if (integer_zerop (range_binop (NE_EXPR, integer_type_node, + minv, 1, maxv, 1))) + etype = utype; + else + return NULL_TREE; + } + return etype; +} + /* Given a range, LOW, HIGH, and IN_P, an expression, EXP, and a result type, TYPE, return an expression to test if EXP is in (or out of, depending on IN_P) the range. Return 0 if the test couldn't be created. */ @@ -4869,31 +4901,10 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, } /* Optimize (c>=low) && (c<=high) into (c-low>=0) && (c-low<=high-low). - This requires wrap-around arithmetics for the type of the expression. - First make sure that arithmetics in this type is valid, then make sure - that it wraps around. */ - if (TREE_CODE (etype) == ENUMERAL_TYPE || TREE_CODE (etype) == BOOLEAN_TYPE) - etype = lang_hooks.types.type_for_size (TYPE_PRECISION (etype), - TYPE_UNSIGNED (etype)); - - if (TREE_CODE (etype) == INTEGER_TYPE && !TYPE_OVERFLOW_WRAPS (etype)) - { - tree utype, minv, maxv; - - /* Check if (unsigned) INT_MAX + 1 == (unsigned) INT_MIN - for the type in question, as we rely on this here. */ - utype = unsigned_type_for (etype); - maxv = fold_convert_loc (loc, utype, TYPE_MAX_VALUE (etype)); - maxv = range_binop (PLUS_EXPR, NULL_TREE, maxv, 1, - build_int_cst (TREE_TYPE (maxv), 1), 1); - minv = fold_convert_loc (loc, utype, TYPE_MIN_VALUE (etype)); - - if (integer_zerop (range_binop (NE_EXPR, integer_type_node, - minv, 1, maxv, 1))) - etype = utype; - else - return 0; - } + This requires wrap-around arithmetics for the type of the expression. */ + etype = range_check_type (etype); + if (etype == NULL_TREE) + return NULL_TREE; high = fold_convert_loc (loc, etype, high); low = fold_convert_loc (loc, etype, low); @@ -6548,65 +6559,55 @@ fold_real_zero_addition_p (const_tree type, const_tree addend, int negate) return negate && !HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type)); } -/* Subroutine of fold() that optimizes comparisons of a division by +/* Subroutine of match.pd that optimizes comparisons of a division by a nonzero integer constant against an integer constant, i.e. X/C1 op C2. CODE is the comparison operator: EQ_EXPR, NE_EXPR, GT_EXPR, LT_EXPR, - GE_EXPR or LE_EXPR. TYPE is the type of the result and ARG0 and ARG1 - are the operands of the comparison. ARG1 must be a TREE_REAL_CST. - - The function returns the constant folded tree if a simplification - can be made, and NULL_TREE otherwise. */ + GE_EXPR or LE_EXPR. ARG01 and ARG1 must be a INTEGER_CST. */ -static tree -fold_div_compare (location_t loc, - enum tree_code code, tree type, tree arg0, tree arg1) +enum tree_code +fold_div_compare (enum tree_code code, tree c1, tree c2, tree *lo, + tree *hi, bool *neg_overflow) { - tree prod, tmp, hi, lo; - tree arg00 = TREE_OPERAND (arg0, 0); - tree arg01 = TREE_OPERAND (arg0, 1); - signop sign = TYPE_SIGN (TREE_TYPE (arg0)); - bool neg_overflow = false; + tree prod, tmp, type = TREE_TYPE (c1); + signop sign = TYPE_SIGN (type); bool overflow; /* We have to do this the hard way to detect unsigned overflow. - prod = int_const_binop (MULT_EXPR, arg01, arg1); */ - wide_int val = wi::mul (arg01, arg1, sign, &overflow); - prod = force_fit_type (TREE_TYPE (arg00), val, -1, overflow); - neg_overflow = false; + prod = int_const_binop (MULT_EXPR, c1, c2); */ + wide_int val = wi::mul (c1, c2, sign, &overflow); + prod = force_fit_type (type, val, -1, overflow); + *neg_overflow = false; if (sign == UNSIGNED) { - tmp = int_const_binop (MINUS_EXPR, arg01, - build_int_cst (TREE_TYPE (arg01), 1)); - lo = prod; + tmp = int_const_binop (MINUS_EXPR, c1, build_int_cst (type, 1)); + *lo = prod; - /* Likewise hi = int_const_binop (PLUS_EXPR, prod, tmp). */ + /* Likewise *hi = int_const_binop (PLUS_EXPR, prod, tmp). */ val = wi::add (prod, tmp, sign, &overflow); - hi = force_fit_type (TREE_TYPE (arg00), val, - -1, overflow | TREE_OVERFLOW (prod)); + *hi = force_fit_type (type, val, -1, overflow | TREE_OVERFLOW (prod)); } - else if (tree_int_cst_sgn (arg01) >= 0) + else if (tree_int_cst_sgn (c1) >= 0) { - tmp = int_const_binop (MINUS_EXPR, arg01, - build_int_cst (TREE_TYPE (arg01), 1)); - switch (tree_int_cst_sgn (arg1)) + tmp = int_const_binop (MINUS_EXPR, c1, build_int_cst (type, 1)); + switch (tree_int_cst_sgn (c2)) { case -1: - neg_overflow = true; - lo = int_const_binop (MINUS_EXPR, prod, tmp); - hi = prod; + *neg_overflow = true; + *lo = int_const_binop (MINUS_EXPR, prod, tmp); + *hi = prod; break; - case 0: - lo = fold_negate_const (tmp, TREE_TYPE (arg0)); - hi = tmp; + case 0: + *lo = fold_negate_const (tmp, type); + *hi = tmp; break; - case 1: - hi = int_const_binop (PLUS_EXPR, prod, tmp); - lo = prod; + case 1: + *hi = int_const_binop (PLUS_EXPR, prod, tmp); + *lo = prod; break; default: @@ -6618,24 +6619,23 @@ fold_div_compare (location_t loc, /* A negative divisor reverses the relational operators. */ code = swap_tree_comparison (code); - tmp = int_const_binop (PLUS_EXPR, arg01, - build_int_cst (TREE_TYPE (arg01), 1)); - switch (tree_int_cst_sgn (arg1)) + tmp = int_const_binop (PLUS_EXPR, c1, build_int_cst (type, 1)); + switch (tree_int_cst_sgn (c2)) { case -1: - hi = int_const_binop (MINUS_EXPR, prod, tmp); - lo = prod; + *hi = int_const_binop (MINUS_EXPR, prod, tmp); + *lo = prod; break; - case 0: - hi = fold_negate_const (tmp, TREE_TYPE (arg0)); - lo = tmp; + case 0: + *hi = fold_negate_const (tmp, type); + *lo = tmp; break; - case 1: - neg_overflow = true; - lo = int_const_binop (PLUS_EXPR, prod, tmp); - hi = prod; + case 1: + *neg_overflow = true; + *lo = int_const_binop (PLUS_EXPR, prod, tmp); + *hi = prod; break; default: @@ -6643,63 +6643,17 @@ fold_div_compare (location_t loc, } } - switch (code) - { - case EQ_EXPR: - if (TREE_OVERFLOW (lo) && TREE_OVERFLOW (hi)) - return omit_one_operand_loc (loc, type, integer_zero_node, arg00); - if (TREE_OVERFLOW (hi)) - return fold_build2_loc (loc, GE_EXPR, type, arg00, lo); - if (TREE_OVERFLOW (lo)) - return fold_build2_loc (loc, LE_EXPR, type, arg00, hi); - return build_range_check (loc, type, arg00, 1, lo, hi); + if (code != EQ_EXPR && code != NE_EXPR) + return code; - case NE_EXPR: - if (TREE_OVERFLOW (lo) && TREE_OVERFLOW (hi)) - return omit_one_operand_loc (loc, type, integer_one_node, arg00); - if (TREE_OVERFLOW (hi)) - return fold_build2_loc (loc, LT_EXPR, type, arg00, lo); - if (TREE_OVERFLOW (lo)) - return fold_build2_loc (loc, GT_EXPR, type, arg00, hi); - return build_range_check (loc, type, arg00, 0, lo, hi); + if (TREE_OVERFLOW (*lo) + || operand_equal_p (*lo, TYPE_MIN_VALUE (type), 0)) + *lo = NULL_TREE; + if (TREE_OVERFLOW (*hi) + || operand_equal_p (*hi, TYPE_MAX_VALUE (type), 0)) + *hi = NULL_TREE; - case LT_EXPR: - if (TREE_OVERFLOW (lo)) - { - tmp = neg_overflow ? integer_zero_node : integer_one_node; - return omit_one_operand_loc (loc, type, tmp, arg00); - } - return fold_build2_loc (loc, LT_EXPR, type, arg00, lo); - - case LE_EXPR: - if (TREE_OVERFLOW (hi)) - { - tmp = neg_overflow ? integer_zero_node : integer_one_node; - return omit_one_operand_loc (loc, type, tmp, arg00); - } - return fold_build2_loc (loc, LE_EXPR, type, arg00, hi); - - case GT_EXPR: - if (TREE_OVERFLOW (hi)) - { - tmp = neg_overflow ? integer_one_node : integer_zero_node; - return omit_one_operand_loc (loc, type, tmp, arg00); - } - return fold_build2_loc (loc, GT_EXPR, type, arg00, hi); - - case GE_EXPR: - if (TREE_OVERFLOW (lo)) - { - tmp = neg_overflow ? integer_one_node : integer_zero_node; - return omit_one_operand_loc (loc, type, tmp, arg00); - } - return fold_build2_loc (loc, GE_EXPR, type, arg00, lo); - - default: - break; - } - - return NULL_TREE; + return code; } @@ -8793,20 +8747,6 @@ fold_comparison (location_t loc, enum tree_code code, tree type, } } - /* We can fold X/C1 op C2 where C1 and C2 are integer constants - into a single range test. */ - if (TREE_CODE (arg0) == TRUNC_DIV_EXPR - && TREE_CODE (arg1) == INTEGER_CST - && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST - && !integer_zerop (TREE_OPERAND (arg0, 1)) - && !TREE_OVERFLOW (TREE_OPERAND (arg0, 1)) - && !TREE_OVERFLOW (arg1)) - { - tem = fold_div_compare (loc, code, type, arg0, arg1); - if (tem != NULL_TREE) - return tem; - } - return NULL_TREE; } -- cgit v1.2.1 From 2c42281526deda5e19b6b72c979e8f24a8c0c8ec Mon Sep 17 00:00:00 2001 From: pinskia Date: Fri, 21 Jul 2017 17:16:51 +0000 Subject: 2017-07-21 Andrew Pinski * tree-ssa-sccvn.c (vn_nary_op_eq): Check BIT_INSERT_EXPR's operand 1 to see if the types precision matches. * fold-const.c (operand_equal_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250431 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index d702de2f97f..c061f3e2f89 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3184,9 +3184,18 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) flags &= ~OEP_ADDRESS_OF; return OP_SAME (0); + case BIT_INSERT_EXPR: + /* BIT_INSERT_EXPR has an implict operand as the type precision + of op1. Need to check to make sure they are the same. */ + if (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST + && TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST + && TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 1))) + != TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 1)))) + return false; + /* FALLTHRU */ + case VEC_COND_EXPR: case DOT_PROD_EXPR: - case BIT_INSERT_EXPR: return OP_SAME (0) && OP_SAME (1) && OP_SAME (2); case MODIFY_EXPR: -- cgit v1.2.1 From 3f4c84656a8657c8266d596274e5247518c7b74e Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 25 Jul 2017 07:04:07 +0000 Subject: 2017-07-25 Richard Biener PR middle-end/81505 * fold-const.c (fold_negate_const): TREE_OVERFLOW should be sticky. * gcc.dg/ubsan/pr81505.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250494 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c061f3e2f89..ecba3ffada4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13702,8 +13702,8 @@ fold_negate_const (tree arg0, tree type) bool overflow; wide_int val = wi::neg (arg0, &overflow); t = force_fit_type (type, val, 1, - (overflow | TREE_OVERFLOW (arg0)) - && !TYPE_UNSIGNED (type)); + (overflow && ! TYPE_UNSIGNED (type)) + || TREE_OVERFLOW (arg0)); break; } -- cgit v1.2.1 From b4fce8f9228d4a823dc8b73ceef3354a81a9ab86 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 28 Jul 2017 10:37:51 +0000 Subject: PR sanitizer/80998 * sanopt.c (pass_sanopt::execute): Handle IFN_UBSAN_PTR. * tree-ssa-alias.c (call_may_clobber_ref_p_1): Likewise. * flag-types.h (enum sanitize_code): Add SANITIZER_POINTER_OVERFLOW. Or it into SANITIZER_UNDEFINED. * ubsan.c: Include gimple-fold.h and varasm.h. (ubsan_expand_ptr_ifn): New function. (instrument_pointer_overflow): New function. (maybe_instrument_pointer_overflow): New function. (instrument_object_size): Formatting fix. (pass_ubsan::execute): Call instrument_pointer_overflow and maybe_instrument_pointer_overflow. * internal-fn.c (expand_UBSAN_PTR): New function. * ubsan.h (ubsan_expand_ptr_ifn): Declare. * sanitizer.def (__ubsan_handle_pointer_overflow, __ubsan_handle_pointer_overflow_abort): New builtins. * tree-ssa-tail-merge.c (merge_stmts_p): Handle IFN_UBSAN_PTR. * internal-fn.def (UBSAN_PTR): New internal function. * opts.c (sanitizer_opts): Add pointer-overflow. * lto-streamer-in.c (input_function): Handle IFN_UBSAN_PTR. * fold-const.c (build_range_check): Compute pointer range check in integral type if pointer arithmetics would be needed. Formatting fixes. gcc/testsuite/ * c-c++-common/ubsan/ptr-overflow-1.c: New test. * c-c++-common/ubsan/ptr-overflow-2.c: New test. libsanitizer/ * ubsan/ubsan_handlers.cc: Cherry-pick upstream r304461. * ubsan/ubsan_checks.inc: Likewise. * ubsan/ubsan_handlers.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250656 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ecba3ffada4..d40b9aaaeb4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4859,21 +4859,21 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, if (low == 0) return fold_build2_loc (loc, LE_EXPR, type, exp, - fold_convert_loc (loc, etype, high)); + fold_convert_loc (loc, etype, high)); if (high == 0) return fold_build2_loc (loc, GE_EXPR, type, exp, - fold_convert_loc (loc, etype, low)); + fold_convert_loc (loc, etype, low)); if (operand_equal_p (low, high, 0)) return fold_build2_loc (loc, EQ_EXPR, type, exp, - fold_convert_loc (loc, etype, low)); + fold_convert_loc (loc, etype, low)); if (TREE_CODE (exp) == BIT_AND_EXPR && maskable_range_p (low, high, etype, &mask, &value)) return fold_build2_loc (loc, EQ_EXPR, type, fold_build2_loc (loc, BIT_AND_EXPR, etype, - exp, mask), + exp, mask), value); if (integer_zerop (low)) @@ -4905,7 +4905,7 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, exp = fold_convert_loc (loc, etype, exp); } return fold_build2_loc (loc, GT_EXPR, type, exp, - build_int_cst (etype, 0)); + build_int_cst (etype, 0)); } } @@ -4915,25 +4915,15 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, if (etype == NULL_TREE) return NULL_TREE; + if (POINTER_TYPE_P (etype)) + etype = unsigned_type_for (etype); + high = fold_convert_loc (loc, etype, high); low = fold_convert_loc (loc, etype, low); exp = fold_convert_loc (loc, etype, exp); value = const_binop (MINUS_EXPR, high, low); - - if (POINTER_TYPE_P (etype)) - { - if (value != 0 && !TREE_OVERFLOW (value)) - { - low = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (low), low); - return build_range_check (loc, type, - fold_build_pointer_plus_loc (loc, exp, low), - 1, build_int_cst (etype, 0), value); - } - return 0; - } - if (value != 0 && !TREE_OVERFLOW (value)) return build_range_check (loc, type, fold_build2_loc (loc, MINUS_EXPR, etype, exp, low), -- cgit v1.2.1 From a07b1b1503647e93050e89c603e6950aaffee03b Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 28 Jul 2017 11:27:45 +0000 Subject: 2017-07-28 Richard Biener PR tree-optimization/81502 * match.pd: Add pattern combining BIT_INSERT_EXPR with BIT_FIELD_REF. * tree-cfg.c (verify_expr): Verify types of BIT_FIELD_REF size/pos operands. (verify_gimple_assign_ternary): Likewise for BIT_INSERT_EXPR pos. * gimple-fold.c (maybe_canonicalize_mem_ref_addr): Use bitsizetype for BIT_FIELD_REF args. * fold-const.c (make_bit_field_ref): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise. * gcc.target/i386/pr81502.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250659 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index d40b9aaaeb4..ae946596528 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3936,7 +3936,7 @@ make_bit_field_ref (location_t loc, tree inner, tree orig_inner, tree type, bftype = build_nonstandard_integer_type (bitsize, 0); result = build3_loc (loc, BIT_FIELD_REF, bftype, inner, - size_int (bitsize), bitsize_int (bitpos)); + bitsize_int (bitsize), bitsize_int (bitpos)); REF_REVERSE_STORAGE_ORDER (result) = reversep; if (bftype != type) -- cgit v1.2.1 From 64a50bc9ad1e59c26f970357a710c1c2a1fd1295 Mon Sep 17 00:00:00 2001 From: tbsaunde Date: Sat, 29 Jul 2017 01:38:19 +0000 Subject: use c++ instead of buildN_stat{,_loc} gcc/ChangeLog: 2017-07-28 Trevor Saunders * fold-const.c (fold_build1_stat_loc): Adjust. (fold_build2_stat_loc): Likewise. (fold_build3_stat_loc): Likewise. * tree.c (build0_stat): Remove _stat from name. (build1_stat): Likewise. (build2_stat): Likewise. (build3_stat): Likewise. (build4_stat): Likewise. (build5_stat): Likewise. * tree.h (build1_loc): Remove macro, and rename _stat function to this. (build2_loc): Likewise. (build3_loc): Likewise. (build4_loc): Likewise. (build5_loc): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250698 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ae946596528..5c1bd4360dd 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -12212,7 +12212,7 @@ fold_build1_stat_loc (location_t loc, tem = fold_unary_loc (loc, code, type, op0); if (!tem) - tem = build1_stat_loc (loc, code, type, op0 PASS_MEM_STAT); + tem = build1_loc (loc, code, type, op0 PASS_MEM_STAT); #ifdef ENABLE_FOLD_CHECKING md5_init_ctx (&ctx); @@ -12258,7 +12258,7 @@ fold_build2_stat_loc (location_t loc, tem = fold_binary_loc (loc, code, type, op0, op1); if (!tem) - tem = build2_stat_loc (loc, code, type, op0, op1 PASS_MEM_STAT); + tem = build2_loc (loc, code, type, op0, op1 PASS_MEM_STAT); #ifdef ENABLE_FOLD_CHECKING md5_init_ctx (&ctx); @@ -12318,7 +12318,7 @@ fold_build3_stat_loc (location_t loc, enum tree_code code, tree type, gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp); tem = fold_ternary_loc (loc, code, type, op0, op1, op2); if (!tem) - tem = build3_stat_loc (loc, code, type, op0, op1, op2 PASS_MEM_STAT); + tem = build3_loc (loc, code, type, op0, op1, op2 PASS_MEM_STAT); #ifdef ENABLE_FOLD_CHECKING md5_init_ctx (&ctx); -- cgit v1.2.1 From 35da66527c8894de7f798cabc4edf002f329e75e Mon Sep 17 00:00:00 2001 From: tbsaunde Date: Sat, 29 Jul 2017 01:39:48 +0000 Subject: use c++ for fold_buildN_loc gcc/ChangeLog: 2017-07-28 Trevor Saunders * fold-const.c (fold_build1_stat_loc): Remove _stat from name. (fold_build2_stat_loc): Likewise. (fold_build3_stat_loc): Likewise. * fold-const.h (fold_build1, fold_build2, fold_build3): Adjust. (fold_build1_loc): Remove macro. (fold_build2_loc): Likewise. (fold_build3_loc): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250712 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5c1bd4360dd..524208ae564 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -12195,8 +12195,8 @@ debug_fold_checksum (const_tree t) expression with code CODE of type TYPE with an operand OP0. */ tree -fold_build1_stat_loc (location_t loc, - enum tree_code code, tree type, tree op0 MEM_STAT_DECL) +fold_build1_loc (location_t loc, + enum tree_code code, tree type, tree op0 MEM_STAT_DECL) { tree tem; #ifdef ENABLE_FOLD_CHECKING @@ -12232,7 +12232,7 @@ fold_build1_stat_loc (location_t loc, OP0 and OP1. */ tree -fold_build2_stat_loc (location_t loc, +fold_build2_loc (location_t loc, enum tree_code code, tree type, tree op0, tree op1 MEM_STAT_DECL) { @@ -12285,7 +12285,7 @@ fold_build2_stat_loc (location_t loc, type TYPE with operands OP0, OP1, and OP2. */ tree -fold_build3_stat_loc (location_t loc, enum tree_code code, tree type, +fold_build3_loc (location_t loc, enum tree_code code, tree type, tree op0, tree op1, tree op2 MEM_STAT_DECL) { tree tem; -- cgit v1.2.1