[patch] for another problem in PR 26247

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Mon Feb 13 12:22:00 GMT 2006


Hello,

when fixing PR 26247, I noticed a problem that I already fixed once in
killloop-branch, but this fix apparently disappeared during merge to
mainline.  If invariant (set REG something) is moved from loop, we
replace it with (set REG' something), so that we do not run into
problems if reg is set somewhere else in the loop.  The uses of REG
that are only reached by the set are replaced by REG'.  We however
cannot do this for read-write uses (setting a subreg of REG).  This patch
prevents us from copy propagating into such partial sets.

Bootstrapped & regtested on ia64.

Zdenek

	* loop-invariant.c (invariant_for_use, check_dependencies): Fail for
	read-write uses.

Index: loop-invariant.c
===================================================================
*** loop-invariant.c	(revision 110898)
--- loop-invariant.c	(working copy)
*************** invariant_for_use (struct df_ref *use)
*** 232,237 ****
--- 232,240 ----
    struct df_ref *def;
    basic_block bb = BLOCK_FOR_INSN (use->insn), def_bb;
  
+   if (use->flags & DF_REF_READ_WRITE)
+     return NULL;
+ 
    defs = DF_REF_CHAIN (use);
    if (!defs || defs->next)
      return NULL;
*************** check_dependencies (rtx insn, bitmap dep
*** 683,688 ****
--- 687,695 ----
  
    for (use = DF_INSN_GET (df, insn)->uses; use; use = use->next_ref)
      {
+       if (use->flags & DF_REF_READ_WRITE)
+ 	return false;
+ 
        defs = DF_REF_CHAIN (use);
        if (!defs)
  	continue;



More information about the Gcc-patches mailing list