From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@lucon.org (H.J. Lu) To: law@cygnus.com Cc: hjl@lucon.org, wilson@cygnus.com, scox@cygnus.com, crux@pool.informatik.rwth-aachen.de, egcs@cygnus.com Subject: Re: More fp bug in egcs Date: Mon, 04 May 1998 18:07:00 -0000 Message-id: References: <11888.894315233@hurl.cygnus.com> X-SW-Source: 1998-05/msg00105.html > > > In message < m0yWMtF-000268C@ocean.lucon.org >you write: > > > > > > One reason for keeping output reloads, even though the register is dead, > > is > > > for debugging purposes. With your patch, it looks like debugging of > > > unoptimized code would not work right. It would be OK to do this > > > when optimizing, but that would not fix the x86 bug. > > > > > > > If the register is clobbered, isn't the value in it random? If it is > > tru, how can it help debugging? I changed my patch to omit the output > > reload if it is in the source and is clobbered. Does it look safe? > >From the compiler's standpoint it is clobbered. > > However, the value in the clobbered register might have meaning to > the user that is debugging code. > Since the value in the clobbered register is controlled by the compiler, may depend on the user source code, may change from release to release and the clobbered register itself may disappear from release to release, how will the user know what the value in the clobbered register should be? It seems to me that as far as the user is concerned, any value in the clobbered register is be ok as long as the destination of the instruction is valid. I am enclosing a modified patch. It is very conservative. Does it look safe? -- Mon May 4 07:43:05 1998 H.J. Lu (hjl@gnu.org) * reload1.c (emit_reload_insns): Don't output the last reload insn if OLD is not the dest of NSN and is in the src and is clobbered by INSN. --- ../../../import/egcs/gcc/reload1.c Mon Apr 20 08:23:47 1998 +++ ./reload1.c Mon May 4 13:41:46 1998 @@ -6730,8 +6730,18 @@ emit_reload_insns (insn) /* Output the last reload insn. */ if (! special) - gen_reload (old, reloadreg, reload_opnum[j], - reload_when_needed[j]); + { + rtx set; + + /* Don't output the last reload if OLD is not the dest of + INSN and is in the src and is clobbered by INSN. */ + if (GET_CODE (old) != REG || !(set = single_set (insn)) + || rtx_equal_p (old, SET_DEST (set)) + || !reg_mentioned_p (old, SET_SRC (set)) + || !regno_clobbered_p (REGNO (old), insn)) + gen_reload (old, reloadreg, reload_opnum[j], + reload_when_needed[j]); + } #ifdef PRESERVE_DEATH_INFO_REGNO_P /* If final will look at death notes for this reg,