[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 Xi Ruoyao changed: What|Removed |Added Resolution|--- |FIXED CC||xry111 at gcc dot gnu.org Status|NEW |RESOLVED --- Comment #20 from Xi Ruoyao --- Marking as fixed as the patch is already pushed.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 Bug 110869 depends on bug 110867, which changed state. Bug 110867 Summary: [14 Regression] ICE in combine after 7cdd0860949c6c3232e6cff1d7ca37bb5234074c https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110867 What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #19 from CVS Commits --- The master branch has been updated by Stefan Schulze Frielinghaus : https://gcc.gnu.org/g:f3a8dde08b420dbe9cacbc1a1febaaf77357f4d4 commit r14-3074-gf3a8dde08b420dbe9cacbc1a1febaaf77357f4d4 Author: Stefan Schulze Frielinghaus Date: Tue Aug 8 08:53:12 2023 +0200 rtl-optimization/110869 Fix tests cmp-mem-const-*.c for sparc This fixes the rather new tests cmp-mem-const-{1,2,3,4,5,6}.c for sparc. For -1 and -2 we need at least optimization level 2 on sparc. For the sake of homogeneity, change all test cases to -O2. For -3 and -4 we do not end up with a comparison of memory and a constant, and finally for -5 and -6 the constants are reduced by a prior optimization which means there is nothing left to do. Thus excluding sparc from those tests. gcc/testsuite/ChangeLog: PR rtl-optimization/110869 * gcc.dg/cmp-mem-const-1.c: Use optimization level 2. * gcc.dg/cmp-mem-const-2.c: Dito. * gcc.dg/cmp-mem-const-3.c: Exclude sparc from this test. * gcc.dg/cmp-mem-const-4.c: Dito. * gcc.dg/cmp-mem-const-5.c: Dito. * gcc.dg/cmp-mem-const-6.c: Dito.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #18 from Stefan Schulze Frielinghaus --- Thanks again for testing. Very much appreciated! I like the idea of a comment and posted a patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626514.html
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #17 from ro at CeBiTec dot Uni-Bielefeld.DE --- > --- Comment #16 from Stefan Schulze Frielinghaus ibm.com> --- > Turns out that my dejagnu foo is weak ;-) I came up with a wrong target > selector. Should be fixed in the new attachment. Right: DejaGnu selector syntax is tricky indeed ;-( Now tested on sparc-sun-solaris2.11 and amd-64-pc-solaris2.11: works as expected. One suggestion: in case you exclude a particular target by triple, it's helpful to add a short comment explaining why this was done. This way, if the test later is discovered to FAIL on a different target, it's easier to see if this is the same issue. When using effective-target keywords instead, the semantics of the exclusion is easier to understand.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #16 from Stefan Schulze Frielinghaus --- Turns out that my dejagnu foo is weak ;-) I came up with a wrong target selector. Should be fixed in the new attachment.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #15 from Stefan Schulze Frielinghaus --- Created attachment 55688 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55688=edit Increase optimization and skip sparc for 4-6
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #14 from Stefan Schulze Frielinghaus --- For -3 and -4 I can confirm that we do not end up with a proper comparison during combine which means we should just ignore these on Sparc. I'm currently puzzled that -5 and -6 are actually processed on Sparc (32 or 64 bit) at all. Shouldn't this: /* { dg-do compile { target { lp64 } && ! target { sparc*-*-* } } } */ prevent this?
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #13 from ro at CeBiTec dot Uni-Bielefeld.DE --- > --- Comment #12 from Stefan Schulze Frielinghaus ibm.com> --- > I have done a test with a cross-compiler and it looks to me as if we need -O2 > instead of -O1 on Sparc in order to trigger the optimization. Can you give > the > attached patch a try? Sorry for all the hassle. We're getting there. The -1.c and -2.c tests PASS now, however the rest still FAILs: they lack "narrow comparison"... completely.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #12 from Stefan Schulze Frielinghaus --- I have done a test with a cross-compiler and it looks to me as if we need -O2 instead of -O1 on Sparc in order to trigger the optimization. Can you give the attached patch a try? Sorry for all the hassle.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #11 from Stefan Schulze Frielinghaus --- Created attachment 55686 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55686=edit Increase optimization
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #10 from Rainer Orth --- The tests still FAIL on Solaris/SPARC: FAIL: gcc.dg/cmp-mem-const-1.c scan-rtl-dump combine "narrow comparison from mode .I to QI" FAIL: gcc.dg/cmp-mem-const-2.c scan-rtl-dump combine "narrow comparison from mode .I to QI" FAIL: gcc.dg/cmp-mem-const-3.c scan-rtl-dump combine "narrow comparison from mode .I to HI" FAIL: gcc.dg/cmp-mem-const-4.c scan-rtl-dump combine "narrow comparison from mode .I to HI" FAIL: gcc.dg/cmp-mem-const-5.c scan-rtl-dump combine "narrow comparison from mode .I to SI" FAIL: gcc.dg/cmp-mem-const-6.c scan-rtl-dump combine "narrow comparison from mode .I to SI"
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #9 from Rainer Orth --- Created attachment 55684 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55684=edit 64-bit sparc-sun-solaris2.11 cmp-mem-const-1.c.289r.combine
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #8 from CVS Commits --- The master branch has been updated by Stefan Schulze Frielinghaus : https://gcc.gnu.org/g:41ef5a34161356817807be3a2e51fbdbe575ae85 commit r14-2932-g41ef5a34161356817807be3a2e51fbdbe575ae85 Author: Stefan Schulze Frielinghaus Date: Wed Aug 2 21:43:22 2023 +0200 rtl-optimization/110867 Fix narrow comparison of memory and constant In certain cases a constant may not fit into the mode used to perform a comparison. This may be the case for sign-extended constants which are used during an unsigned comparison as e.g. in (set (reg:CC 100 cc) (compare:CC (mem:SI (reg/v/f:SI 115 [ a ]) [1 *a_4(D)+0 S4 A64]) (const_int -2147483648 [0x8000]))) Fixed by ensuring that the constant fits into comparison mode. Furthermore, on some targets as e.g. sparc the constant used in a comparison is chopped off before combine which leads to failing test cases (see PR 110869). Fixed by not requiring that the source mode has to be DImode, and excluding sparc from the last two test cases entirely since there the constant cannot be further reduced. gcc/ChangeLog: PR rtl-optimization/110867 * combine.cc (simplify_compare_const): Try the optimization only in case the constant fits into the comparison mode. gcc/testsuite/ChangeLog: PR rtl-optimization/110869 * gcc.dg/cmp-mem-const-1.c: Relax mode for constant. * gcc.dg/cmp-mem-const-2.c: Relax mode for constant. * gcc.dg/cmp-mem-const-3.c: Relax mode for constant. * gcc.dg/cmp-mem-const-4.c: Relax mode for constant. * gcc.dg/cmp-mem-const-5.c: Exclude sparc since here the constant is already reduced. * gcc.dg/cmp-mem-const-6.c: Exclude sparc since here the constant is already reduced.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #7 from Stefan Schulze Frielinghaus --- I've send a patch for review: https://gcc.gnu.org/pipermail/gcc-patches/2023-August/626075.html and thanks for testing :)
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 Eric Botcazou changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed||2023-08-02 --- Comment #6 from Eric Botcazou --- > I guess that's best for Eric (Cc'ed) to say. No objections by me.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 Rainer Orth changed: What|Removed |Added CC||ebotcazou at gcc dot gnu.org --- Comment #5 from Rainer Orth --- (In reply to Stefan Schulze Frielinghaus from comment #4) > This would solve test cases cmp-mem-const-{1,2,3,4}.c. For > cmp-mem-const-{5,6} we have that the pre-optimization already chopped the > 64-bit constant into a 32-bit constant and thus leaves us with nothing to do > here. I'm not entirely sure how we handled such cases in the past. Though, > one solution would be to simply exclude sparc from this test: > > /* { dg-do compile { target { lp64 } && ! target { sparc*-*-* } } } */ > > Would that be ok? I guess that's best for Eric (Cc'ed) to say.
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #4 from Stefan Schulze Frielinghaus --- For sparc we already see some sort of pre-optimization which "breaks" the new test cases. For example, for test cmp-mem-const-1.c we have prior combine: (insn 14 13 41 2 (set (reg:SI 117) (ior:SI (reg:SI 118) (const_int 1023 [0x3ff]))) "cmp-mem-const-1.c":10:13 307 {iorsi3} (expr_list:REG_DEAD (reg:SI 118) (expr_list:REG_EQUAL (const_int 1073741823 [0x3fff]) (nil (insn 41 14 42 2 (set (reg:CC 100 %icc) (compare:CC (reg:SI 117) (reg:SI 116 [ *x_2(D) ]))) "cmp-mem-const-1.c":10:13 1 {*cmpsi_insn} (expr_list:REG_DEAD (reg:SI 117) (expr_list:REG_DEAD (reg:SI 116 [ *x_2(D) ]) (nil where the 64-bit constant 0x3fff already got chopped into a 32-bit constant 0x3fff. Thus in combine we only see narrow comparison from mode SI to QI: (MEM leu 0x3fff) to (MEM leu 0x3f) whereas I have been pretty strict in the new tests and demanded to see a 64-bit constant: scan-rtl-dump "narrow comparison from mode DI to QI" "combine" Thus one solution would be to not consider the source mode by using scan-rtl-dump "narrow comparison from mode .I to QI" "combine" This would solve test cases cmp-mem-const-{1,2,3,4}.c. For cmp-mem-const-{5,6} we have that the pre-optimization already chopped the 64-bit constant into a 32-bit constant and thus leaves us with nothing to do here. I'm not entirely sure how we handled such cases in the past. Though, one solution would be to simply exclude sparc from this test: /* { dg-do compile { target { lp64 } && ! target { sparc*-*-* } } } */ Would that be ok?
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #3 from ro at CeBiTec dot Uni-Bielefeld.DE --- > --- Comment #2 from ro at CeBiTec dot Uni-Bielefeld.DE Uni-Bielefeld.DE> --- >> --- Comment #1 from Andrew Pinski --- >> Can you test the patch in bug 110867 comment #1 to see if fixes the issue >> here >> too? > > Sure: sparc-sun-solaris2.11 bootstrap in progress... Bootstrap is restored with this patch, however all the new tests FAIL: FAIL: gcc.dg/cmp-mem-const-1.c scan-rtl-dump combine "narrow comparison from mode DI to QI" FAIL: gcc.dg/cmp-mem-const-2.c scan-rtl-dump combine "narrow comparison from mode DI to QI" FAIL: gcc.dg/cmp-mem-const-3.c scan-rtl-dump combine "narrow comparison from mode DI to HI" FAIL: gcc.dg/cmp-mem-const-4.c scan-rtl-dump combine "narrow comparison from mode DI to HI" FAIL: gcc.dg/cmp-mem-const-5.c scan-rtl-dump combine "narrow comparison from mode DI to SI" FAIL: gcc.dg/cmp-mem-const-6.c scan-rtl-dump combine "narrow comparison from mode DI to SI"
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #2 from ro at CeBiTec dot Uni-Bielefeld.DE --- > --- Comment #1 from Andrew Pinski --- > Can you test the patch in bug 110867 comment #1 to see if fixes the issue here > too? Sure: sparc-sun-solaris2.11 bootstrap in progress...
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 --- Comment #1 from Andrew Pinski --- Can you test the patch in bug 110867 comment #1 to see if fixes the issue here too?
[Bug middle-end/110869] [14 regression] ICE in decompose, at rtl.h:2297
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110869 Rainer Orth changed: What|Removed |Added Target Milestone|--- |14.0