Commit 5ba5ab9b by Kenneth Zadeck Committed by Kenneth Zadeck

re PR middle-end/36177 (g++.dg/opt/pr23714.C ICEs with 135041 -> 135057)

2008-05-08  Kenneth Zadeck  <zadeck@naturalbridge.com>

	PR middle-end/36117
	* dce.c (deletable_insn_p): Do not delete calls if 
	df_in_progress.
	(delete_unmarked_insns): When deleting a call, call 
	delete_unreachable_blocks.
	* rtl.texi (RTL_CONST_CALL_P, RTL_PURE_CALL_P,
	RTL_CONST_OR_PURE_CALL_P, RTL_LOOPING_CONST_OR_PURE_CALL_P): Fixed
	doc.

From-SVN: r135113
parent 7afa92c5
2008-05-08 Kenneth Zadeck <zadeck@naturalbridge.com>
PR middle-end/36117
* dce.c (deletable_insn_p): Do not delete calls if
df_in_progress.
(delete_unmarked_insns): When deleting a call, call
delete_unreachable_blocks.
* rtl.texi (RTL_CONST_CALL_P, RTL_PURE_CALL_P,
RTL_CONST_OR_PURE_CALL_P, RTL_LOOPING_CONST_OR_PURE_CALL_P): Fixed
doc.
2008-05-08 Richard Guenther <rguenther@suse.de> 2008-05-08 Richard Guenther <rguenther@suse.de>
* doc/invoke.texi (-fdump-tree-salias): Remove documentation. * doc/invoke.texi (-fdump-tree-salias): Remove documentation.
......
...@@ -99,11 +99,16 @@ deletable_insn_p (rtx insn, bool fast) ...@@ -99,11 +99,16 @@ deletable_insn_p (rtx insn, bool fast)
rtx body, x; rtx body, x;
int i; int i;
/* We can delete dead const or pure calls as long as they do not if (CALL_P (insn)
infinite loop and are not sibling calls. The problem with /* We cannot delete calls inside of the recursive dce because
sibling calls is that it is hard to see the result. */ this may cause basic blocks to be deleted and this messes up
if (CALL_P (insn) the rest of the stack of optimization passes. */
&& (!df_in_progress)
/* We cannot delete pure or const sibling calls because it is
hard to see the result. */
&& (!SIBLING_CALL_P (insn)) && (!SIBLING_CALL_P (insn))
/* We can delete dead const or pure calls as long as they do not
infinite loop. */
&& (RTL_CONST_OR_PURE_CALL_P (insn) && (RTL_CONST_OR_PURE_CALL_P (insn)
&& !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn))) && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)))
return true; return true;
...@@ -305,6 +310,7 @@ delete_unmarked_insns (void) ...@@ -305,6 +310,7 @@ delete_unmarked_insns (void)
{ {
basic_block bb; basic_block bb;
rtx insn, next; rtx insn, next;
bool must_clean = false;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
FOR_BB_INSNS_SAFE (bb, insn, next) FOR_BB_INSNS_SAFE (bb, insn, next)
...@@ -382,9 +388,19 @@ delete_unmarked_insns (void) ...@@ -382,9 +388,19 @@ delete_unmarked_insns (void)
remove_note (XEXP (note, 0), libcall_note); remove_note (XEXP (note, 0), libcall_note);
} }
/* If a pure or const call is deleted, this may make the cfg
have unreachable blocks. We rememeber this and call
delete_unreachable_blocks at the end. */
if (CALL_P (insn))
must_clean = true;
/* Now delete the insn. */ /* Now delete the insn. */
delete_insn_and_edges (insn); delete_insn_and_edges (insn);
} }
/* Deleted a pure or const call. */
if (must_clean)
delete_unreachable_blocks ();
} }
......
...@@ -559,13 +559,36 @@ In either case GCC assumes these addresses can be addressed directly, ...@@ -559,13 +559,36 @@ In either case GCC assumes these addresses can be addressed directly,
perhaps with the help of base registers. perhaps with the help of base registers.
Stored in the @code{unchanging} field and printed as @samp{/u}. Stored in the @code{unchanging} field and printed as @samp{/u}.
@findex CONST_OR_PURE_CALL_P @findex RTL_CONST_CALL_P
@cindex @code{call_insn} and @samp{/u} @cindex @code{call_insn} and @samp{/u}
@cindex @code{unchanging}, in @code{call_insn} @cindex @code{unchanging}, in @code{call_insn}
@item CONST_OR_PURE_CALL_P (@var{x}) @item RTLCONST_OR_PURE_CALL_P (@var{x})
In a @code{call_insn}, @code{note}, or an @code{expr_list} for notes, In a @code{call_insn} indicates that the insn represents a call to a
indicates that the insn represents a call to a const or pure function. const function. Stored in the @code{unchanging} field and printed as
Stored in the @code{unchanging} field and printed as @samp{/u}. @samp{/u}.
@findex RTL_PURE_CALL_P
@cindex @code{call_insn} and @samp{/i}
@cindex @code{return_val}, in @code{call_insn}
@item RTLCONST_OR_PURE_CALL_P (@var{x})
In a @code{call_insn} indicates that the insn represents a call to a
pure function. Stored in the @code{return_val} field and printed as
@samp{/i}.
@findex RTL_CONST_OR_PURE_CALL_P
@cindex @code{call_insn} and @samp{/u} or @samp{/i}
@item RTL_CONST_OR_PURE_CALL_P (@var{x})
In a @code{call_insn}, true if @code{RTL_CONST_CALL_P} or
@code{RTL_PURE_CALL_P} is true.
@findex RTL_LOOPING_CONST_OR_PURE_CALL_P
@cindex @code{call_insn} and @samp{/c}
@cindex @code{call}, in @code{call_insn}
@item RTL_LOOPING_CONST_OR_PURE_CALL_P (@var{x})
In a @code{call_insn} indicates that the insn represents a possibly
infinite looping call to a const or pure function. Stored in the
@code{call} field and printed as @samp{/c}. Only true if one of
@code{RTL_CONST_CALL_P} or @code{RTL_PURE_CALL_P} is true.
@findex INSN_ANNULLED_BRANCH_P @findex INSN_ANNULLED_BRANCH_P
@cindex @code{jump_insn} and @samp{/u} @cindex @code{jump_insn} and @samp{/u}
...@@ -869,6 +892,9 @@ These are the fields to which the above macros refer: ...@@ -869,6 +892,9 @@ These are the fields to which the above macros refer:
@item call @item call
In a @code{mem}, 1 means that the memory reference will not trap. In a @code{mem}, 1 means that the memory reference will not trap.
In a @code{call}, 1 means that this pure or const call may possibly
infinite loop.
In an RTL dump, this flag is represented as @samp{/c}. In an RTL dump, this flag is represented as @samp{/c}.
@findex frame_related @findex frame_related
...@@ -938,6 +964,8 @@ known not to be a member of a structure, union, or array. ...@@ -938,6 +964,8 @@ known not to be a member of a structure, union, or array.
In @code{symbol_ref} expressions, 1 means the referenced symbol is weak. In @code{symbol_ref} expressions, 1 means the referenced symbol is weak.
In @code{call} expressions, 1 means the call is pure.
In an RTL dump, this flag is represented as @samp{/i}. In an RTL dump, this flag is represented as @samp{/i}.
@findex jump @findex jump
...@@ -967,8 +995,8 @@ instruction, 1 means an annulling branch should be used. ...@@ -967,8 +995,8 @@ instruction, 1 means an annulling branch should be used.
In a @code{symbol_ref} expression, 1 means that this symbol addresses In a @code{symbol_ref} expression, 1 means that this symbol addresses
something in the per-function constant pool. something in the per-function constant pool.
In a @code{call_insn}, @code{note}, or an @code{expr_list} of notes, In a @code{call_insn} 1 means that this instruction is a call to a const
1 means that this instruction is a call to a const or pure function. function.
In an RTL dump, this flag is represented as @samp{/u}. In an RTL dump, this flag is represented as @samp{/u}.
......
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