This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42906] [4.5 Regression] Empty loop not removed
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2010 20:32:41 -0000
- Subject: [Bug tree-optimization/42906] [4.5 Regression] Empty loop not removed
- References: <bug-42906-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from steven at gcc dot gnu dot org 2010-01-30 20:32 -------
The safe thing to do, may be to ignore self control dependence, like so:
------------------------------------------------- 8< --------------
Index: tree-ssa-dce.c
===================================================================
--- tree-ssa-dce.c (revision 156352)
+++ tree-ssa-dce.c (working copy)
@@ -390,6 +390,11 @@
gimple stmt;
basic_block cd_bb = INDEX_EDGE_PRED_BB (el, edge_number);
+ /* Ignore control dependence on BB itself. This can happen with loops
+ but since we are here, we have already made BB necessary. */
+ if (cd_bb == bb)
+ continue;
+
if (TEST_BIT (last_stmt_necessary, cd_bb->index))
continue;
SET_BIT (last_stmt_necessary, cd_bb->index);
------------------------------------------------- 8< --------------
Needs testing, but I can't do that right now. Honza, richi...?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42906