This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Fix SSA constant propagation
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH]: Fix SSA constant propagation
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: Sun, 26 Aug 2001 02:25:57 -0400
- Cc: law at redhat dot com
Of course, I meant to emit a new move, rather than try to set the
pattern of the old def to the result of gen_move_insn.
I'll commit the second part of the patch as obvious, however, now that
i think about it more, i'm not sure about the first one in all cases.
The before code (I.E. what is there now, not what i changed it to) is
clearly wrong.
I'm pretty sure the code i've changed it to won't handle parallels or
sequences in some cases (since we'll delete the entire insn, rather
than just nullify the set in question).
What the heck is the right thing to do here?
Should i have it just nullify the set (rather than delete the whole
insn), but otherwise leave the code as i've got it written below?
2001-08-25 Daniel Berlin <dan@cgsoftware.com>
* ssa-ccp.c: Include expr.h for gen_move_insn prototype.
(ssa_ccp_substitute_constants): We can't just replace
SET_SRC, we have no guarantee the result will be valid.
2001-08-25 Daniel Berlin <dan@cgsoftware.co>
* ssa-ccp.c (ssa_ccp_df_delete_unreachable_insns):
find_unreachable_blocks uses BB_REACHABLE stored in the flags, not
the aux pointer.
Index: ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ssa-ccp.c,v
retrieving revision 1.7
diff -c -3 -p -w -B -b -r1.7 ssa-ccp.c
*** ssa-ccp.c 2001/08/22 14:35:44 1.7
--- ssa-ccp.c 2001/08/26 06:15:43
*************** Software Foundation, 59 Temple Place - S
*** 73,78 ****
--- 73,79 ----
#include "ggc.h"
#include "df.h"
#include "function.h"
+ #include "expr.h"
/* Possible lattice values. */
*************** ssa_ccp_substitute_constants ()
*** 869,881 ****
are consecutive at the start of the basic block. */
if (! PHI_NODE_P (def))
{
if (rtl_dump_file)
fprintf (rtl_dump_file,
"Register %d is now set to a constant\n",
SSA_NAME (PATTERN (def)));
! SET_SRC (set) = values[i].const_value;
! INSN_CODE (def) = -1;
! df_insn_modify (df_analyzer, BLOCK_FOR_INSN (def), def);
}
/* Iterate through all the uses of this entry and try replacements
--- 870,886 ----
are consecutive at the start of the basic block. */
if (! PHI_NODE_P (def))
{
+ rtx insn;
if (rtl_dump_file)
fprintf (rtl_dump_file,
"Register %d is now set to a constant\n",
SSA_NAME (PATTERN (def)));
! insn = emit_block_insn_before (gen_move_insn
! (SET_DEST (set),
! values[i].const_value), def,
! BLOCK_FOR_INSN (def));
! df_insn_modify (df_analyzer, BLOCK_FOR_INSN (def), insn );
! df_insn_delete (df_analyzer, BLOCK_FOR_INSN (def), def);
}
/* Iterate through all the uses of this entry and try replacements
*************** ssa_ccp_df_delete_unreachable_insns ()
*** 936,945 ****
{
basic_block b = BASIC_BLOCK (i);
! if (b->aux != NULL)
! /* This block was found. Tidy up the mark. */
! b->aux = NULL;
! else
{
rtx start = b->head;
rtx end = b->end;
--- 941,947 ----
{
basic_block b = BASIC_BLOCK (i);
! if (!(b->flags & BB_REACHABLE))
{
rtx start = b->head;
rtx end = b->end;
--
"My VCR flashes 01:35, 01:35, 01:35, ...
"-Steven Wright