public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
@ 2020-12-15 12:43 zsojka at seznam dot cz
  2020-12-15 14:02 ` [Bug rtl-optimization/98287] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2020-12-15 12:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

            Bug ID: 98287
           Summary: [10/11 Regression] ICE: in expand_expr_real_2, at
                    expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Created attachment 49768
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49768&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O2 -fno-tree-ccp -fno-tree-forwprop testcase.c
during RTL pass: expand
testcase.c: In function 'bar':
testcase.c:7:22: internal compiler error: in expand_expr_real_2, at
expr.c:10000
    7 |   return v >> s << s | v >> s >> 63;
      |          ~~~~~~~~~~~~^~~~~~~~~~~~~~
0x661c3d expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        /repo/gcc-trunk/gcc/expr.c:10000
0xc21188 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /repo/gcc-trunk/gcc/expr.c:10201
0xaeb6ab expand_expr
        /repo/gcc-trunk/gcc/expr.h:282
0xaeb6ab expand_return
        /repo/gcc-trunk/gcc/cfgexpand.c:3764
0xaeb6ab expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.c:3873
0xaeb6ab expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.c:3999
0xaf0c4b expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.c:6036
0xaf27c6 execute
        /repo/gcc-trunk/gcc/cfgexpand.c:6720
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r11-6041-20201215101608-g69bd5d473d2-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r11-6041-20201215101608-g69bd5d473d2-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.0.0 20201215 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
@ 2020-12-15 14:02 ` jakub at gcc dot gnu.org
  2020-12-21 11:22 ` zsojka at seznam dot cz
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-12-15 14:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |10.3
           Priority|P3                          |P2

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r10-2805-ge944354ec05891474b0d204c6c239c04ee7b527b
I think this is another case of harmful folding after last veclower, in this
case during vrp2.  After last veclower we need to be careful not to introduce
vector arithmetics that isn't supported by the target, as the expander doesn't
have fallback for that, it relies on tree-vect-generic.c doing its job.
So, either we need to guard all such match.pd etc. simplifications with checks
whether the operations are supported on the vectors if we are after last
veclower
- in this particular case it is the x >> 1 << 1 optimization to x & { ~1 },
where the backend announces V1DImode >> and << but not AND, or schedule another
veclower right before *.optimized dump to cover anything that got broken (or
before isel and hope isel doesn't fold things?), or add fallback to the
expander (the V1* vectors would be fairly easy, but anything else would be hard
and ugly).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
  2020-12-15 14:02 ` [Bug rtl-optimization/98287] " jakub at gcc dot gnu.org
@ 2020-12-21 11:22 ` zsojka at seznam dot cz
  2021-01-04 15:10 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2020-12-21 11:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> ---
Created attachment 49818
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49818&action=edit
another testcase

$ x86_64-pc-linux-gnu-gcc -Og -fipa-cp another_testcase.c
during RTL pass: expand
another_testcase.c: In function 'bar.constprop':
another_testcase.c:7:23: internal compiler error: in expand_expr_real_2, at
expr.c:10000
    7 |   return v << (s & 3) >> (s & 3);
      |          ~~~~~~~~~~~~~^~~~~~~~~~
0x667803 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        /repo/gcc-trunk/gcc/expr.c:10000
0xc280cb expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /repo/gcc-trunk/gcc/expr.c:10201
0xaf2b5b expand_expr
        /repo/gcc-trunk/gcc/expr.h:282
0xaf2b5b expand_return
        /repo/gcc-trunk/gcc/cfgexpand.c:3764
0xaf2b5b expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.c:3873
0xaf2b5b expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.c:3999
0xaf80fb expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.c:6036
0xaf9c76 execute
        /repo/gcc-trunk/gcc/cfgexpand.c:6720
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
  2020-12-15 14:02 ` [Bug rtl-optimization/98287] " jakub at gcc dot gnu.org
  2020-12-21 11:22 ` zsojka at seznam dot cz
@ 2021-01-04 15:10 ` rguenth at gcc dot gnu.org
  2021-02-01 12:39 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-04 15:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
We need to guard the patterns.  Handling V1 modes in the expanders is possible
but it doesn't fix the root cause (there's also vector-by-scalar shifts).

Maybe we should define/document a set of arithmetics we assume available
for all vector modes (including bitwise and) and make this one a target bug?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2021-01-04 15:10 ` rguenth at gcc dot gnu.org
@ 2021-02-01 12:39 ` jakub at gcc dot gnu.org
  2021-02-03  8:10 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-01 12:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50108
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50108&action=edit
gcc11-pr98287.patch

I'd be afraid it could be hundreds of patterns potentially affected by this.
So I think it is much easier to handle that in the infrastructure.

This patch attempts to do that when PROP_gimple_lvec property is set for cases
for which expand_vector_operations_1 does something (except I've skipped the
VEC_PERM_EXPR and VEC_COND_EXPR/COND_EXPR checks for now).

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2021-02-01 12:39 ` jakub at gcc dot gnu.org
@ 2021-02-03  8:10 ` cvs-commit at gcc dot gnu.org
  2021-02-03  8:11 ` [Bug rtl-optimization/98287] [10 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-03  8:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:1b5572edb8caaed2f31a7235b8c58628da6bdb8f

commit r11-7050-g1b5572edb8caaed2f31a7235b8c58628da6bdb8f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 3 09:04:26 2021 +0100

    i386: Remove V1DImode shift expanders [PR98287]

    On Tue, Feb 02, 2021 at 02:23:55PM +0100, Richard Biener wrote:
    > All I say is that the x86 target
    > should either not advertise V1DF shifts or advertise the basic
    > ops that reasonable simplification would expect to exist.

    The backend has several V1?Imode shifts, but optab only for those V1DImode
    ones:

    grep '[la]sh[lr]v1[qhsdtox]' tmp-mddump.md
    (define_insn ("mmx_ashlv1di3")
    (define_insn ("mmx_lshrv1di3")
    (define_insn ("avx512bw_ashlv1ti3")
    (define_insn ("avx512bw_lshrv1ti3")
    (define_insn ("sse2_ashlv1ti3")
    (define_insn ("sse2_lshrv1ti3")
    (define_expand ("ashlv1di3")
    (define_expand ("lshrv1di3")
      emit_insn (gen_sse2_lshrv1ti3 (tmp, gen_lowpart (V1TImode, operands[1]),

    I think it has been introduced with
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89021#c13

    Before we didn't have any V1DImode expanders (except mov/movmisalign, but
    those are needed and are supplied for other V1??mode modes too).

    This patch just removes the two V1DImode shift expanders with standard
names.

    2021-02-03  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/98287
            * config/i386/mmx.md (<insn><mode>3): For shifts don't enable
expander
            for V1DImode.

            * gcc.dg/pr98287.c: New test.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2021-02-03  8:10 ` cvs-commit at gcc dot gnu.org
@ 2021-02-03  8:11 ` jakub at gcc dot gnu.org
  2021-03-19 23:28 ` cvs-commit at gcc dot gnu.org
  2021-03-20  8:05 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-03  8:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2021-02-03
            Summary|[10/11 Regression] ICE: in  |[10 Regression] ICE: in
                   |expand_expr_real_2, at      |expand_expr_real_2, at
                   |expr.c:10000 with -O2       |expr.c:10000 with -O2
                   |-fno-tree-ccp               |-fno-tree-ccp
                   |-fno-tree-forwprop          |-fno-tree-forwprop
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2021-02-03  8:11 ` [Bug rtl-optimization/98287] [10 " jakub at gcc dot gnu.org
@ 2021-03-19 23:28 ` cvs-commit at gcc dot gnu.org
  2021-03-20  8:05 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-19 23:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:487bca0ffbf13372a4edf0bb827a9f654df4a507

commit r10-9461-g487bca0ffbf13372a4edf0bb827a9f654df4a507
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Feb 3 09:04:26 2021 +0100

    i386: Remove V1DImode shift expanders [PR98287]

    On Tue, Feb 02, 2021 at 02:23:55PM +0100, Richard Biener wrote:
    > All I say is that the x86 target
    > should either not advertise V1DF shifts or advertise the basic
    > ops that reasonable simplification would expect to exist.

    The backend has several V1?Imode shifts, but optab only for those V1DImode
    ones:

    grep '[la]sh[lr]v1[qhsdtox]' tmp-mddump.md
    (define_insn ("mmx_ashlv1di3")
    (define_insn ("mmx_lshrv1di3")
    (define_insn ("avx512bw_ashlv1ti3")
    (define_insn ("avx512bw_lshrv1ti3")
    (define_insn ("sse2_ashlv1ti3")
    (define_insn ("sse2_lshrv1ti3")
    (define_expand ("ashlv1di3")
    (define_expand ("lshrv1di3")
      emit_insn (gen_sse2_lshrv1ti3 (tmp, gen_lowpart (V1TImode, operands[1]),

    I think it has been introduced with
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89021#c13

    Before we didn't have any V1DImode expanders (except mov/movmisalign, but
    those are needed and are supplied for other V1??mode modes too).

    This patch just removes the two V1DImode shift expanders with standard
names.

    2021-02-03  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/98287
            * config/i386/mmx.md (<insn><mode>3): For shifts don't enable
expander
            for V1DImode.

            * gcc.dg/pr98287.c: New test.

    (cherry picked from commit 1b5572edb8caaed2f31a7235b8c58628da6bdb8f)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/98287] [10 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop
  2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2021-03-19 23:28 ` cvs-commit at gcc dot gnu.org
@ 2021-03-20  8:05 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-20  8:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98287

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.3 too.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-20  8:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 12:43 [Bug rtl-optimization/98287] New: [10/11 Regression] ICE: in expand_expr_real_2, at expr.c:10000 with -O2 -fno-tree-ccp -fno-tree-forwprop zsojka at seznam dot cz
2020-12-15 14:02 ` [Bug rtl-optimization/98287] " jakub at gcc dot gnu.org
2020-12-21 11:22 ` zsojka at seznam dot cz
2021-01-04 15:10 ` rguenth at gcc dot gnu.org
2021-02-01 12:39 ` jakub at gcc dot gnu.org
2021-02-03  8:10 ` cvs-commit at gcc dot gnu.org
2021-02-03  8:11 ` [Bug rtl-optimization/98287] [10 " jakub at gcc dot gnu.org
2021-03-19 23:28 ` cvs-commit at gcc dot gnu.org
2021-03-20  8:05 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).