[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 Eric Botcazou changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #36 from Eric Botcazou 2011-02-10 06:25:05 UTC --- .
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 --- Comment #35 from Steve Ellcey 2011-02-09 23:42:57 UTC --- I think it is PR47614, I tried the first patch in that defect report and it fixed my test case.
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #34 from Jakub Jelinek 2011-02-09 22:51:37 UTC --- Maybe you're hitting PR47614?
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 Steve Ellcey changed: What|Removed |Added Status|RESOLVED|REOPENED CC||sje at cup dot hp.com Resolution|FIXED | --- Comment #33 from Steve Ellcey 2011-02-09 22:44:20 UTC --- I am reopening this bug because I am getting a failure of gcc.dg/torture/vector-2.c that started when this patch was checked in. I think this is the same test that used to be gcc.c-torture/execute/vector-2.c. I have a cut down test case that fails (prints 'one') when compiled with -O1 -fno-guess-branch-probability starting at r169782. The -fno-guess-branch-probability is needed to generate code that uses auto-inc and trigger the bug. This fails on IA64 Linux and HP-UX. It does not require the -fpic flag. Let me know if I should open a new bug instead of re-opening this one. extern int printf(const char *, ...); extern void exit(int); struct __attribute__((packed)) B { unsigned short j : 1, k : 11; }; struct B sB; void testB (void) { int i; unsigned int mask, v, a, r; struct B x; sB.k = 750; r = 750; x.j = sB.j = 0; printf("%d %d\n", (int) x.j, (int) sB.j); printf("%d %d\n", (int) sB.k, (int) r); if (x.j != sB.j || sB.k != r) printf ("one\n"); } int main (void) { testB (); exit (0); }
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 Alexandre Oliva changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED AssignedTo|unassigned at gcc dot |aoliva at gcc dot gnu.org |gnu.org | --- Comment #32 from Alexandre Oliva 2011-02-03 06:07:58 UTC --- Fixed
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 --- Comment #31 from Alexandre Oliva 2011-02-03 06:04:07 UTC --- Author: aoliva Date: Thu Feb 3 06:04:04 2011 New Revision: 169782 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169782 Log: PR debug/43092 PR rtl-optimization/43494 * rtl.h (for_each_inc_dec_fn): New type. (for_each_inc_dec): Declare. * rtlanal.c (struct for_each_inc_dec_ops): New type. (for_each_inc_dec_find_inc_dec): New fn. (for_each_inc_dec_find_mem): New fn. (for_each_inc_dec): New fn. * dse.c (struct insn_size): Remove. (replace_inc_dec, replace_inc_dec_mem): Remove. (emit_inc_dec_insn_before): New fn. (check_for_inc_dec): Use it, along with for_each_inc_dec. (canon_address): Pass mem modes to cselib_lookup. * cselib.h (cselib_lookup): Add memmode argument. Adjust callers. (cselib_lookup_from_insn): Likewise. (cselib_subst_to_values): Likewise. * cselib.c (find_slot_memmode): New var. (cselib_find_slot): New fn. Use it instead of htab_find_slot_with_hash everywhere. (entry_and_rtx_equal_p): Use find_slot_memmode. (autoinc_split): New fn. (rtx_equal_for_cselib_p): Rename and implement in terms of... (rtx_equal_for_cselib_1): ... this. Take memmode, pass it on. Deal with autoinc. Special-case recursion into MEMs. (cselib_hash_rtx): Likewise. (cselib_lookup_mem): Infer pmode from address mode. Distinguish address and MEM modes. (cselib_subst_to_values): Add memmode, pass it on. Deal with autoinc. (cselib_lookup): Add memmode argument, pass it on. (cselib_lookup_from_insn): Add memmode. (cselib_invalidate_rtx): Discard obsolete push_operand handling. (struct cselib_record_autoinc_data): New. (cselib_record_autoinc_cb): New fn. (cselib_record_sets): Use it, along with for_each_inc_dec. Pass MEM mode to cselib_lookup. Reset autoinced REGs here instead of... (cselib_process_insn): ... here. * var-tracking.c (replace_expr_with_values, use_type): Pass MEM mode to cselib_lookup. (add_uses): Likewise, also to cselib_subst_to_values. (add_stores): Likewise. * sched-deps.c (add_insn_mem_dependence): Pass mode to cselib_subst_to_values. (sched_analyze_1, sched_analyze_2): Likewise. Adjusted. * gcse.c (do_local_cprop): Adjusted. * postreload.c (reload_cse_simplify_set): Adjusted. (reload_cse_simplify_operands): Adjusted. * sel-sched-dump (debug_mem_addr_value): Pass mode. Modified: trunk/gcc/ChangeLog trunk/gcc/cselib.c trunk/gcc/cselib.h trunk/gcc/dse.c trunk/gcc/gcse.c trunk/gcc/postreload.c trunk/gcc/rtl.h trunk/gcc/rtlanal.c trunk/gcc/sched-deps.c trunk/gcc/sel-sched-dump.c trunk/gcc/var-tracking.c
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 Eric Botcazou changed: What|Removed |Added CC||ebotcazou at gcc dot ||gnu.org Known to fail|| --- Comment #30 from Eric Botcazou 2011-01-27 10:46:35 UTC --- I'll review Alexandre's patch later today.
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 --- Comment #29 from rguenther at suse dot de 2011-01-13 10:55:01 UTC --- On Thu, 13 Jan 2011, aoliva at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 > > --- Comment #28 from Alexandre Oliva 2011-01-13 > 10:31:21 UTC --- > Created attachment 22957 > --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22957 > Updated patch, still awaiting review > > The patch to fix this bug, posted on Sept 21, is still awaiting review :-( > > This updated version fixes just a whitespace difference that caused it to fail > to apply. I suppose pinging it on the ML is better than pinging it here.
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 --- Comment #28 from Alexandre Oliva 2011-01-13 10:31:21 UTC --- Created attachment 22957 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22957 Updated patch, still awaiting review The patch to fix this bug, posted on Sept 21, is still awaiting review :-( This updated version fixes just a whitespace difference that caused it to fail to apply.
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494 Jakub Jelinek changed: What|Removed |Added Target Milestone|4.4.5 |4.4.6
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #27 from aoliva at gcc dot gnu dot org 2010-09-10 23:16 --- > Shouldn't we do something else when hashing PRE_MODIFY? I don't know, what else do you have in mind? I'm posting an updated patch that implements your other suggestions momentarily. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #26 from bernds at gcc dot gnu dot org 2010-08-19 13:38 --- (In reply to comment #25) > Alex Oliva posted some patches to make cselib handle autoinc stuff. > No idea whether http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01038.html > is the latest version or if he has a newer one. Doesn't look bad, but I dislike the name change to _addr variants for functions that look up not just addresses. I think we should just fix up all the callers to pass in a mode. I'm also not sure we need a global cselib_record_autoinc flag - why not just do that always? Shouldn't we do something else when hashing PRE_MODIFY? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #25 from jakub at gcc dot gnu dot org 2010-08-18 19:00 --- Alex Oliva posted some patches to make cselib handle autoinc stuff. No idea whether http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01038.html is the latest version or if he has a newer one. -- jakub at gcc dot gnu dot org changed: What|Removed |Added CC||aoliva at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #24 from bernds at gcc dot gnu dot org 2010-08-18 14:36 --- It should be possible to do better in cselib_subst_to_values - for POST_* we could look up the value of the inner expression, and for PRE_* we could probably construct a PLUS of some kind. That would be an enhancement, but it's unrelated to the bug. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #23 from steven at gcc dot gnu dot org 2010-08-18 10:50 --- So the scheduler uses cselib to get a better view of the address, but cselib doesn't actually give a better address. And the solution is to just give up in that case? It seems to me that if cselib doesn't give a better address than XEXP(MEM,0) then the original address should be used. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #22 from bernds at gcc dot gnu dot org 2010-08-17 13:14 --- (In reply to comment #19) > x_addr is a VALUE that has no locs: That happens because it's an autoincrement, and cselib_subst_to_values just creates an empty value. It seems to me that we simply need to add a VALUE case to rtx_varies_p. Can you test that? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #21 from amonakov at gcc dot gnu dot org 2010-07-21 10:07 --- (In reply to comment #20) > (Even sel-sched apparently does not use cselib, that's surprising!) Offtopic: yes, using cselib in sel-sched is not quite straightforward, since we need it to work on arbitrary regions (as I understand cselib is designed to work on EBBs). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #20 from steven at gcc dot gnu dot org 2010-07-21 09:49 --- Since this bug only triggers if cselib is used, the bug affects schedule_ebbs only. The other schedulers are !use_cselib schedulers. (Even sel-sched apparently does not use cselib, that's surprising!) OTOH, this bug can probably be triggered with -fsched2-use-superblocks on any target. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #19 from steven at gcc dot gnu dot org 2010-07-21 09:33 --- x_addr is a VALUE that has no locs: Breakpoint 4, true_dependence (mem=0x205ddf68, mem_mode=VOIDmode, x=0x205ddfb0, varies=0x20496720) at ../../trunk/gcc/alias.c:2330 2330 if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) (gdb) cont Continuing. Breakpoint 11, get_addr (x=0x60316e28) at ../../trunk/gcc/alias.c:1726 1726 if (GET_CODE (x) != VALUE) (gdb) up #1 0x4036eb50 in true_dependence (mem=0x205ddf68, mem_mode=SImode, x=0x205ddfb0, varies=0x20496720) at ../../trunk/gcc/alias.c:2367 2367 x_addr = get_addr (x_addr); (gdb) down #0 get_addr (x=0x60316e28) at ../../trunk/gcc/alias.c:1726 1726 if (GET_CODE (x) != VALUE) (gdb) next 1728 v = CSELIB_VAL_PTR (x); (gdb) 1729 if (v) (gdb) 1731 for (l = v->locs; l; l = l->next) (gdb) p v->locs $72 = (struct elt_loc_list *) 0x0 (gdb) p debug_rtx(x) (value:DI 10:10 @0x60316e28/0x60316d10) $73 = void (gdb) So get_addr just returns the VALUE. Is it *ever* OK for get_addr to return a VALUE rtx? It seems to me this should never happen, and we should assert that. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #18 from steven at gcc dot gnu dot org 2010-07-21 09:27 --- Created an attachment (id=21277) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21277&action=view) debug log I think the problem is that fixed_scalar_and_varying_struct_p is called with a VALUE address, i.e. not expanded. See attached debug log. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #17 from amonakov at gcc dot gnu dot org 2010-07-21 08:32 --- (In reply to comment #16) > OK, I think I finally understand what Alexander tried to explain, and I've > annotated the code. Alexander, does this look right to you? Yes, thanks. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #16 from steven at gcc dot gnu dot org 2010-07-21 08:22 --- OK, I think I finally understand what Alexander tried to explain, and I've annotated the code. Alexander, does this look right to you? f1: // vector int f1(vector int t) .mmi mov r15 = r12 // 30: r12 = @temp1 mov r14 = r12 // 29: r14 = @temp1 addl r16 = 1, r0// 34: r16 = 1 ;; .mmi st8 [r15] = r32, 8 // 36: temp1[0:1] = t[0:1], r...@temp[2] ;; st8 [r15] = r33, -4 // 37: temp1[2:3] = t[2:3], r...@temp[1] nop 0 .mii ld8 r8 = [r14], 8 // 21: r8 = temp[0:1] nop 0 ;; nop 0 .mmb ld8 r9 = [r14] // 28: r9 = temp[2:3] st4 [r15] = r16 // 9: temp[1] = 1 br.ret.sptk.many b0 // 40: return r8:r9 .endp f1# -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.4.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494
[Bug rtl-optimization/43494] [4.4/4.5/4.6 Regression] Overlooked dependency causes wrong scheduling, wrong code
--- Comment #15 from steven at gcc dot gnu dot org 2010-07-20 18:08 --- Works with "gcc-4.3 (Debian 4.3.5-1) 4.3.5", both with -fpic and with -fno-inline. That makes this bug a regression. CC:RM - who happens to know a thing or two about the alias analysis code also. -- steven at gcc dot gnu dot org changed: What|Removed |Added CC||rguenth at gcc dot gnu dot ||org Known to work||4.3.5 Summary|Overlooked dependency causes|[4.4/4.5/4.6 Regression] |wrong scheduling, wrong code|Overlooked dependency causes ||wrong scheduling, wrong code http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43494