[PATCH] Fix PR optimization/14235

Eric Botcazou ebotcazou@libertysurf.fr
Wed Mar 3 10:03:00 GMT 2004


Hi,

This is an ICE in verify_local_live_at start at -O3, a regression present on 
mainline and 3.4 branch.

The call to update_life_info comes from regrename which, by renaming one 
register, causes the liveness of another one to be propagated up in the insn 
chains.  However, I think the real problem comes for the middle-end and 
pertain to this chunk of code:

typedef signed char        int8_t;
typedef unsigned long long uint64_t;

uint64_t tempA = 0;

tempA = (int8_t)tempA;


The .01.rtl file contains this:

(insn 21 19 23 (set (reg/v:DI 70 [ tempA ])
        (const_int 0 [0x0])) -1 (nil)
    (nil))

(insn 46 45 47 (clobber (reg/v:DI 70 [ tempA ])) -1 (nil)
    (nil))

(insn 47 46 48 (set (subreg:SI (reg/v:DI 70 [ tempA ]) 0)
        (sign_extend:SI (subreg:QI (reg/v:DI 70 [ tempA ]) 0))) -1 (nil)
    (nil))

(insn 48 47 49 (parallel [
            (set (reg/v:DI 70 [ tempA ])
                (sign_extend:DI (subreg:SI (reg/v:DI 70 [ tempA ]) 0)))
            (clobber (reg:CC 17 flags))
            (clobber (scratch:SI))
        ]) -1 (nil)
    (nil))

that is, the CLOBBER hides the initial SET.


The CLOBBER is issued by convert_move:

      /* Next, try converting via full word.  */
      else if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD
	       && ((code = can_extend_p (to_mode, word_mode, unsignedp))
		   != CODE_FOR_nothing))
	{
	  if (GET_CODE (to) == REG)
	    emit_insn (gen_rtx_CLOBBER (VOIDmode, to));
	  convert_move (gen_lowpart (word_mode, to), from, unsignedp);
	  emit_unop_insn (code, to,
			  gen_lowpart (word_mode, to), equiv_code);
	  return;
	}


I'm not really sure what is the best place to fix this.  After various 
attempts, I settled for the expander of NOP_EXPR.


2004-03-03  Eric Botcazou  <ebotcazou@libertysurf.fr>

        PR optimization/14235
        * expr.c (expand_expr_real) <NOP_EXPR>: Return a new
	pseudo when converting from a sub-word source to a
	larger-than-word register which conflicts with the source.


2004-03-03  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* gcc.c-torture/compile/20040303-1.c: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr14235.diff
Type: text/x-diff
Size: 1119 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040303/798c232c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr14235-2.c
Type: text/x-csrc
Size: 1385 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040303/798c232c/attachment-0001.bin>


More information about the Gcc-patches mailing list