[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209 Andrew Pinski changed: What|Removed |Added CC||zsojka at seznam dot cz --- Comment #9 from Andrew Pinski --- *** Bug 112760 has been marked as a duplicate of this bug. ***
[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209 Andrew Pinski changed: What|Removed |Added CC||sjames at gcc dot gnu.org --- Comment #8 from Andrew Pinski --- *** Bug 112572 has been marked as a duplicate of this bug. ***
[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
--- Comment #3 from ubizjak at gmail dot com 2009-07-24 06:25 --- Please also add the testcase from Comment #1 to gcc testsuite. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209
[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
--- Comment #4 from steven at gcc dot gnu dot org 2009-07-24 06:27 --- A hint, please, about why the patch of comment #2 would be the correct fix. As far as I can tell, loop-iv doesn't need the notes and shouldn't have to clean up other passes' mess. This patch also introduces a pass ordering restriction that shouldn't be there. And at the very least, if this bug gets papered over like this, then there should be a comment in loop-iv that the problem is only added to fix bugs elsewhere... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209
[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
--- Comment #5 from nvachhar at google dot com 2009-07-24 15:39 --- Subject: Re: ICE in iv_analyze_def caused by stale REG_UNUSED note loop-iv does need notes, albeit indirectly through the single_set function. single_set looks at the REG_UNUSED note, and if all but one set have that note on it, then it asserts that a parallel set is a single set. I do agree that this problem is pervasive through gcc. Any pass that uses single_set is implicitly a user of reg ntoes. On Thu, Jul 23, 2009 at 11:27 PM, steven at gcc dot gnu dot orggcc-bugzi...@gcc.gnu.org wrote: --- Comment #4 from steven at gcc dot gnu dot org 2009-07-24 06:27 --- A hint, please, about why the patch of comment #2 would be the correct fix. As far as I can tell, loop-iv doesn't need the notes and shouldn't have to clean up other passes' mess. This patch also introduces a pass ordering restriction that shouldn't be there. And at the very least, if this bug gets papered over like this, then there should be a comment in loop-iv that the problem is only added to fix bugs elsewhere... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209 --- You are receiving this mail because: --- You reported the bug, or are watching the reporter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209
[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
--- Comment #6 from steven at gcc dot gnu dot org 2009-07-24 17:04 --- Then we should write a new function, something like this in df.h perhaps: /* Given an INSN, return a SET expression if the insn has only one SET whose SET_DEST is used. If SET_DEST is memory, then the SET is assumed to be used somewhere, always. This means that: * If an insn has multiple SETs to only registers, but only one of those SETs is used, return that one set. * If an insn has multiple SETs to only registers, but none one of those SETs is used, return NULL_RTX. * If an insn has multiple SETs to registers and/or memory, but the SETs to registers are dead, return the one memory SET, or NULL_RTX if there are multiple sets to memory. Only accept INSNs. single_set() can take a pattern, but that is old skool style that should be abolished. May miss some single_set SETs that single_set() can find, because this function just looks for the number of uses of a register to determine whether a set is used (which may fail for hard registers and for unusual situations with pseudos that somehow are set twice but never used) whereas single_set() uses liveness information through REG_UNUSED notes. Still, I expect that, in practice, this function works just as well as single_set(). One more caveat: The DF user must use incremental scanning, or the DF_REG_USE_COUNT may be wrong. The result of df_single_set would be unconservative for new registers since the last scan (DF_REG_USE_COUNT will still be 0, indicating the new reg is unused and its SET can be ignored). */ rtx df_single_set (rtx insn) { rtx pat; gcc_assert (INSN_P (insn)); /* ??? Could even just fall back if the current DF mode is not incremental scanning. */ pat = PATTERN (insn); if (GET_CODE (pat) == SET) return pat; else if (GET_CODE (pat) == PARALLEL) { int i; rtx set = NULL_RTX; for (i = 0; i XVECLEN (pat, 0); i++) { rtx sub = XVECEXP (pat, 0, i); switch (GET_CODE (sub)) { case USE: case CLOBBER: break; case SET: if (! set) { rtx dest = SET_DEST (set); if (GET_CODE (dest) == SUBREG) dest = SUBREG_REG (dest); if (! REG_P (dest) || DF_REG_USE_COUNT (dest) 0) set = sub; } else return NULL_RTX; break; default: return NULL_RTX; } } } else return NULL_RTX; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209
[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
--- Comment #7 from nvachhar at google dot com 2009-07-24 17:47 --- Subject: Re: ICE in iv_analyze_def caused by stale REG_UNUSED note This looks reasonable to me. Given the caveats you mention in the comment, this would need to be tested for correctness (esp. w.r.t. the newly added registers) and obviously would need to be tested for performance regressions. On Fri, Jul 24, 2009 at 5:04 PM, steven at gcc dot gnu dot orggcc-bugzi...@gcc.gnu.org wrote: --- Comment #6 from steven at gcc dot gnu dot org 2009-07-24 17:04 --- Then we should write a new function, something like this in df.h perhaps: /* Given an INSN, return a SET expression if the insn has only one SET whose SET_DEST is used. If SET_DEST is memory, then the SET is assumed to be used somewhere, always. This means that: * If an insn has multiple SETs to only registers, but only one of those SETs is used, return that one set. * If an insn has multiple SETs to only registers, but none one of those SETs is used, return NULL_RTX. * If an insn has multiple SETs to registers and/or memory, but the SETs to registers are dead, return the one memory SET, or NULL_RTX if there are multiple sets to memory. Only accept INSNs. single_set() can take a pattern, but that is old skool style that should be abolished. May miss some single_set SETs that single_set() can find, because this function just looks for the number of uses of a register to determine whether a set is used (which may fail for hard registers and for unusual situations with pseudos that somehow are set twice but never used) whereas single_set() uses liveness information through REG_UNUSED notes. Still, I expect that, in practice, this function works just as well as single_set(). One more caveat: The DF user must use incremental scanning, or the DF_REG_USE_COUNT may be wrong. The result of df_single_set would be unconservative for new registers since the last scan (DF_REG_USE_COUNT will still be 0, indicating the new reg is unused and its SET can be ignored). */ rtx df_single_set (rtx insn) { rtx pat; gcc_assert (INSN_P (insn)); /* ??? Could even just fall back if the current DF mode is not incremental scanning. */ pat = PATTERN (insn); if (GET_CODE (pat) == SET) return pat; else if (GET_CODE (pat) == PARALLEL) { int i; rtx set = NULL_RTX; for (i = 0; i XVECLEN (pat, 0); i++) { rtx sub = XVECEXP (pat, 0, i); switch (GET_CODE (sub)) { case USE: case CLOBBER: break; case SET: if (! set) { rtx dest = SET_DEST (set); if (GET_CODE (dest) == SUBREG) dest = SUBREG_REG (dest); if (! REG_P (dest) || DF_REG_USE_COUNT (dest) 0) set = sub; } else return NULL_RTX; break; default: return NULL_RTX; } } } else return NULL_RTX; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209 --- You are receiving this mail because: --- You reported the bug, or are watching the reporter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209
[Bug rtl-optimization/40209] ICE in iv_analyze_def caused by stale REG_UNUSED note
--- Comment #2 from ian at gcc dot gnu dot org 2009-07-24 04:01 --- Subject: Bug 40209 Author: ian Date: Fri Jul 24 04:01:13 2009 New Revision: 150038 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=150038 Log: PR rtl-optimization/40209 * loop-iv.c (iv_analysis_loop_init): Call df_note_add_problem. Modified: trunk/gcc/ChangeLog trunk/gcc/loop-iv.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40209