Commit cc788fcc by Richard Guenther Committed by Richard Biener

re PR tree-optimization/43269 (removing non dead store)

2010-03-08  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/43269
	* tree-ssa-dse.c (dse_possible_dead_store_p): Fix post-dom
	region detection.

	* gcc.c-torture/execute/pr43269.c: New testcase.

From-SVN: r157276
parent 69c103c7
2010-03-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43269
* tree-ssa-dse.c (dse_possible_dead_store_p): Fix post-dom
region detection.
2010-03-08 Martin Jambor <mjambor@suse.cz> 2010-03-08 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_descriptor): Removed the called field. * ipa-prop.h (struct ipa_param_descriptor): Removed the called field.
......
2010-03-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43269
* gcc.c-torture/execute/pr43269.c: New testcase.
2010-03-08 Janus Weil <janus@gcc.gnu.org> 2010-03-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/43256 PR fortran/43256
......
int g_21;
int g_211;
int g_261;
static void __attribute__((noinline,noclone))
func_32 (int b)
{
if (b) {
lbl_370:
g_21 = 1;
}
for (g_261 = -1; g_261 > -2; g_261--) {
if (g_211 + 1) {
return;
} else {
g_21 = 1;
goto lbl_370;
}
}
}
extern void abort (void);
int main(void)
{
func_32(0);
if (g_261 != -1)
abort ();
return 0;
}
...@@ -161,7 +161,7 @@ dse_possible_dead_store_p (gimple stmt, gimple *use_stmt) ...@@ -161,7 +161,7 @@ dse_possible_dead_store_p (gimple stmt, gimple *use_stmt)
temp = stmt; temp = stmt;
do do
{ {
gimple prev, use_stmt; gimple use_stmt;
imm_use_iterator ui; imm_use_iterator ui;
bool fail = false; bool fail = false;
tree defvar; tree defvar;
...@@ -175,28 +175,33 @@ dse_possible_dead_store_p (gimple stmt, gimple *use_stmt) ...@@ -175,28 +175,33 @@ dse_possible_dead_store_p (gimple stmt, gimple *use_stmt)
defvar = PHI_RESULT (temp); defvar = PHI_RESULT (temp);
else else
defvar = gimple_vdef (temp); defvar = gimple_vdef (temp);
prev = temp;
temp = NULL; temp = NULL;
FOR_EACH_IMM_USE_STMT (use_stmt, ui, defvar) FOR_EACH_IMM_USE_STMT (use_stmt, ui, defvar)
{ {
cnt++; cnt++;
/* If we ever reach our DSE candidate stmt again fail. We
cannot handle dead stores in loops. */
if (use_stmt == stmt)
{
fail = true;
BREAK_FROM_IMM_USE_STMT (ui);
}
/* In simple cases we can look through PHI nodes, but we /* In simple cases we can look through PHI nodes, but we
have to be careful with loops and with memory references have to be careful with loops and with memory references
containing operands that are also operands of PHI nodes. containing operands that are also operands of PHI nodes.
See gcc.c-torture/execute/20051110-*.c. */ See gcc.c-torture/execute/20051110-*.c. */
if (gimple_code (use_stmt) == GIMPLE_PHI) else if (gimple_code (use_stmt) == GIMPLE_PHI)
{ {
if (temp if (temp
/* We can look through PHIs to post-dominated regions /* Make sure we are not in a loop latch block. */
without worrying if the use not also dominates prev || gimple_bb (stmt) == gimple_bb (use_stmt)
(in which case it would be a loop PHI with the use
in a latch block). */
|| gimple_bb (prev) == gimple_bb (use_stmt)
|| !dominated_by_p (CDI_POST_DOMINATORS,
gimple_bb (prev), gimple_bb (use_stmt))
|| dominated_by_p (CDI_DOMINATORS, || dominated_by_p (CDI_DOMINATORS,
gimple_bb (prev), gimple_bb (use_stmt))) gimple_bb (stmt), gimple_bb (use_stmt))
/* We can look through PHIs to regions post-dominating
the DSE candidate stmt. */
|| !dominated_by_p (CDI_POST_DOMINATORS,
gimple_bb (stmt), gimple_bb (use_stmt)))
{ {
fail = true; fail = true;
BREAK_FROM_IMM_USE_STMT (ui); BREAK_FROM_IMM_USE_STMT (ui);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment