This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] pr65779 - [5/6 Regression] undefined local symbol on powerpc
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, Alexandre Oliva <aoliva at redhat dot com>
- Date: Tue, 21 Apr 2015 14:30:15 +0200
- Subject: Re: [Patch] pr65779 - [5/6 Regression] undefined local symbol on powerpc
- Authentication-results: sourceware.org; auth=none
- References: <20150420031049 dot GB12627 at bubble dot grove dot modra dot org> <20150420073507 dot GA1725 at tucnak dot redhat dot com> <20150420084226 dot GC12627 at bubble dot grove dot modra dot org> <20150420085556 dot GE1725 at tucnak dot redhat dot com> <20150420130032 dot GD12627 at bubble dot grove dot modra dot org> <20150420131721 dot GH1725 at tucnak dot redhat dot com> <20150421113804 dot GH12627 at bubble dot grove dot modra dot org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Apr 21, 2015 at 09:08:04PM +0930, Alan Modra wrote:
> + if (DEBUG_INSN_P (dinsn)
> + && insn_uses_reg (dinsn, dregno, end_dregno))
> + {
> + if (live_bbs.is_empty ())
> + /* Put debug info for the insn we'll be moving
> + into the destination block. */
> + {
> + rtx_insn *newdinsn
> + = emit_debug_insn_after (copy_rtx (PATTERN (dinsn)),
> + bb_note (bb));
> + df_insn_rescan (newdinsn);
> + }
This isn't safe. There could be a debug_insn for the same decl anywhere in
between the dinsn and bb_note (bb) on the chosen live path, if there is,
this change will break stuff.
> + /* If the insn is a simple reg-reg copy, then reset
> + the debug insn to point to src. */
> + if (REG_P (src) && GET_MODE (src) == GET_MODE (dest))
> + {
> + INSN_VAR_LOCATION_LOC (dinsn)
> + = simplify_replace_rtx (INSN_VAR_LOCATION_LOC (dinsn),
> + dest, src);
> + df_insn_rescan (dinsn);
> + }
> + else
> + {
> + /* Otherwise remove anything about this variable. */
> + INSN_VAR_LOCATION_LOC (dinsn)
> + = gen_rtx_UNKNOWN_VAR_LOC ();
> + df_insn_rescan_debug_internal (dinsn);
> + }
This works (though the simplify_replace_rtx alone is dangerous, you'd better
use propagate_for_debug), but is unnecessarily limitting. You could just insert a debug
insn with a debug temp before the original insn and replace all the uses of
the reg with the debug temporary.
And, as you are walking all the bbs on the path insn by insn anyway,
supposedly you could instead use the valtrack APIs for that.
Thus, call
dead_debug_local_init (&debug, NULL, NULL);
before walking the first bb, then call
dead_debug_add on each FOR_EACH_INSN_INFO_USE of the debug insns that
overlaps the dest REG, and finally
dead_debug_insert_temp with DEBUG_TEMP_BEFORE_WITH_VALUE and
finally dead_debug_local_finish. Of course all this guarded with
MAY_HAVE_DEBUG_INSNS.
Jakub