diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-12 09:07:33 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-12 09:07:33 +0200 |
commit | 4a8b97cb8af6e8632e1674ac82611b4d45c17b53 (patch) | |
tree | 0f4472b112485841833a6fc41665c3fd3b1003ee /gcc/tree-ssa-reassoc.c | |
parent | 83d3ca284984623383cb03d7d0b05d0865b3442c (diff) | |
download | gcc-4a8b97cb8af6e8632e1674ac82611b4d45c17b53.zip gcc-4a8b97cb8af6e8632e1674ac82611b4d45c17b53.tar.gz gcc-4a8b97cb8af6e8632e1674ac82611b4d45c17b53.tar.bz2 |
re PR tree-optimization/77929 (ICE: verify_gimple failed (error: non-trivial conversion at assignment))
PR tree-optimization/77929
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Handle
(*ops)[ranges[i].idx]->op != ranges[i].exp case.
* gcc.c-torture/compile/pr77929.c: New test.
From-SVN: r241019
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 7666365..7b844dd 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -2994,12 +2994,26 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length, } else { - g = gimple_build_assign (make_ssa_name (TREE_TYPE (ranges[i].exp)), - ccode, rhs1, rhs2); + operand_entry *oe = (*ops)[ranges[i].idx]; + tree ctype = oe->op ? TREE_TYPE (oe->op) : boolean_type_node; + if (!INTEGRAL_TYPE_P (ctype) + || (TREE_CODE (ctype) != BOOLEAN_TYPE + && TYPE_PRECISION (ctype) != 1)) + ctype = boolean_type_node; + g = gimple_build_assign (make_ssa_name (ctype), ccode, rhs1, rhs2); gimple_set_uid (g, uid); gsi_insert_before (&gsi, g, GSI_SAME_STMT); + if (oe->op && ctype != TREE_TYPE (oe->op)) + { + g = gimple_build_assign (make_ssa_name (TREE_TYPE (oe->op)), + NOP_EXPR, gimple_assign_lhs (g)); + gimple_set_uid (g, uid); + gsi_insert_before (&gsi, g, GSI_SAME_STMT); + } ranges[i].exp = gimple_assign_lhs (g); - (*ops)[ranges[i].idx]->op = ranges[i].exp; + oe->op = ranges[i].exp; + ranges[i].low = build_zero_cst (TREE_TYPE (ranges[i].exp)); + ranges[i].high = ranges[i].low; } ranges[i].strict_overflow_p = false; operand_entry *oe = (*ops)[ranges[*idx].idx]; |