From 8710e30220d182f6ab4fe6058360fd726c153990 Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Fri, 26 Jun 2015 11:12:20 +0000 Subject: [PATCH] re PR bootstrap/66638 (profiledbootstrap failure on x86-64 with LTO) PR bootstrap/66638 * tree-ssa-loop-niter.c (loop_exits_before_overflow): Skip if assertion failed. Remove assertion itself. From-SVN: r225008 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-loop-niter.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4398ee744f5..862bfe2fdc7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-26 Bin Cheng + + PR bootstrap/66638 + * tree-ssa-loop-niter.c (loop_exits_before_overflow): Skip if + assertion failed. Remove assertion itself. + 2015-06-26 Richard Biener * fold-const.c (fold_binary_loc): Remove -A CMP -B -> A CMP B diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 855d32ceeb0..c5adb1c2d82 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3955,7 +3955,21 @@ loop_exits_before_overflow (tree base, tree step, if (!CONVERT_EXPR_P (e) || !operand_equal_p (e, unsigned_base, 0)) continue; e = TREE_OPERAND (e, 0); - gcc_assert (operand_equal_p (e, base, 0)); + /* It may still be possible to prove no overflow even if condition + "operand_equal_p (e, base, 0)" isn't satisfied here, like below + example: + + e : ssa_var ; unsigned long type + base : (int) ssa_var + unsigned_base : (unsigned int) ssa_var + + Unfortunately this is a rare case observed during GCC profiled + bootstrap. See PR66638 for more information. + + For now, we just skip the possibility. */ + if (!operand_equal_p (e, base, 0)) + continue; + if (tree_int_cst_sign_bit (step)) { code = LT_EXPR; -- 2.30.2