This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/67915] ICE on valid code at -O2 and -O3 on x86_64-linux-gnu
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Oct 2015 09:50:43 +0000
- Subject: [Bug tree-optimization/67915] ICE on valid code at -O2 and -O3 on x86_64-linux-gnu
- Auto-submitted: auto-generated
- References: <bug-67915-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67915
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So sth like the following (ISTR some missed foldings that way, it's not too
long
ago that I tested this)
Index: gcc/tree-cfgcleanup.c
===================================================================
--- gcc/tree-cfgcleanup.c (revision 228706)
+++ gcc/tree-cfgcleanup.c (working copy)
@@ -110,10 +110,9 @@ cleanup_control_expr_graph (basic_block
switch (gimple_code (stmt))
{
case GIMPLE_COND:
- val = fold_binary_loc (loc, gimple_cond_code (stmt),
- boolean_type_node,
- gimple_cond_lhs (stmt),
- gimple_cond_rhs (stmt));
+ val = const_binop (gimple_cond_code (stmt),
+ boolean_type_node,
+ gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
break;
case GIMPLE_SWITCH:
Or alternatively try to go down
Index: gcc/passes.c
===================================================================
--- gcc/passes.c (revision 228750)
+++ gcc/passes.c (working copy)
@@ -1909,7 +1909,16 @@ execute_function_todo (function *fn, voi
push_cfun (fn);
- /* Always cleanup the CFG before trying to update SSA. */
+ if (flags & TODO_update_ssa_any)
+ {
+ /* Always delete unreachable blocks before trying to update SSA. */
+ if (!dom_info_available_p (CDI_DOMINATORS))
+ delete_unreachable_blocks ();
+
+ unsigned update_flags = flags & TODO_update_ssa_any;
+ update_ssa (update_flags);
+ }
+
if (flags & TODO_cleanup_cfg)
{
cleanup_tree_cfg ();
@@ -1930,10 +1939,9 @@ execute_function_todo (function *fn, voi
still need to do one. */
if (!(flags & TODO_update_ssa_any) && need_ssa_update_p (cfun))
flags |= TODO_update_ssa;
- }
- if (flags & TODO_update_ssa_any)
- {
+ /* ??? We want to fix the above issue by keeping SSA for up-to-date
+ which might be easier when we have updated SSA before CFG cleanup.
*/
unsigned update_flags = flags & TODO_update_ssa_any;
update_ssa (update_flags);
}
with all the consequences of even after fixing ??? the probably more expensive
SSA update (on a not cleaned up CFG).
I'm re-testing the first hunk (without instrumenting for regressions...)