[PATCH: PR/40416] stop sinking expression if the target bb post dominates from bb
Carrot Wei
carrot@google.com
Tue Jun 16 09:05:00 GMT 2009
Hi
This patch is to fix the bug
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40416
If the target bb post dominates from bb and we move the expression to target
bb, it can't be executed less frequently. So we can't get any benefit from it.
ChangeLog:
2009-06-16 Carrot Wei <carrot@google.com>
PR/40416
* tree-ssa-sink.c: add code to stop sinking expression if the target
bb post dominates from bb.
Test:
x86 bootstrap.
Gcc regression tests for x86.
One new ICE testsuite/gcc.dg/pr35065.c. It is occurred in a very late rtl pass
machine_reorg with an invalid x86 address expression. It should be caused by
an unknown bug in rtl passes.
thanks
Carrot
Index: tree-ssa-sink.c
===================================================================
--- tree-ssa-sink.c (revision 148480)
+++ tree-ssa-sink.c (working copy)
@@ -384,6 +384,9 @@ statement_sink_location (gimple stmt, ba
|| sinkbb->loop_father != frombb->loop_father)
return false;
+ if (dominated_by_p (CDI_POST_DOMINATORS, frombb, sinkbb))
+ return false;
+
*togsi = gsi_for_stmt (use);
return true;
}
@@ -411,6 +414,9 @@ statement_sink_location (gimple stmt, ba
|| sinkbb->loop_father != frombb->loop_father)
return false;
+ if (dominated_by_p (CDI_POST_DOMINATORS, frombb, sinkbb))
+ return false;
+
*togsi = gsi_after_labels (sinkbb);
return true;
More information about the Gcc-patches
mailing list