diff options
author | Richard Guenther <rguenther@suse.de> | 2008-08-29 08:36:10 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-08-29 08:36:10 +0000 |
commit | a4b930608f389022fdcb256796c187719307b410 (patch) | |
tree | 81dde4fb09ba070d53dbbe9adb6f6574611ea46a /gcc/tree-vrp.c | |
parent | a0491ba7b4d126b941e43a73d61427828a459b1e (diff) | |
download | gcc-a4b930608f389022fdcb256796c187719307b410.tar.gz |
re PR tree-optimization/37207 (ice at tree-ssa-ifcombine.c:222 for -Os)
2008-08-29 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37207
* tree-vrp.c (extract_range_from_binary_expr): Also try
to constant fold if only one of the operands is a constant.
* gcc.dg/tree-ssa/vrp46.c: New testcase.
From-SVN: r139754
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 17fbcdbb770..7579ee1330b 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -2058,10 +2058,13 @@ extract_range_from_binary_expr (value_range_t *vr, && code != TRUTH_OR_EXPR) { /* We can still do constant propagation here. */ - if ((op0 = op_with_constant_singleton_value_range (op0)) != NULL_TREE - && (op1 = op_with_constant_singleton_value_range (op1)) != NULL_TREE) + tree const_op0 = op_with_constant_singleton_value_range (op0); + tree const_op1 = op_with_constant_singleton_value_range (op1); + if (const_op0 || const_op1) { - tree tem = fold_binary (code, expr_type, op0, op1); + tree tem = fold_binary (code, expr_type, + const_op0 ? const_op0 : op0, + const_op1 ? const_op1 : op1); if (tem && is_gimple_min_invariant (tem) && !is_overflow_infinity (tem)) |