public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa
@ 2023-11-04 14:32 sjames at gcc dot gnu.org
  2023-11-04 14:32 ` [Bug rtl-optimization/112380] " sjames at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-04 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112380
           Summary: [14 regression] ICE when building mesa
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 56505
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56505&action=edit
nir_nir_to_tgsi.c.i.xz

Originally reported downstream in Gentoo by Agostino Sarubbo at
https://bugs.gentoo.org/916852.

gcc -c nir_nir_to_tgsi.c.i -O2 seems to be enough to reproduce.

```
FAILED: src/gallium/auxiliary/libgallium.a.p/nir_nir_to_tgsi.c.o
x86_64-pc-linux-gnu-gcc -Isrc/gallium/auxiliary/libgallium.a.p
-Isrc/gallium/auxiliary -I../mesa-23.2.1/src/gallium/auxiliary -Isrc/loader
-I../mesa-23.2.1/src/loader -I../mesa-23.2.1/src/gallium/include -Isrc
-I../mesa-23.2.1/src -Iinclude -I../mesa-23.2.1/include
-I../mesa-23.2.1/src/gallium/auxiliary/util -Isrc/compiler/nir
-I../mesa-23.2.1/src/compiler/nir -I/usr/include/libdrm -fvisibility=hidden
-fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11
-O0 -g '-DPACKAGE_VERSION="23.2.1"'
'-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"'
-DHAVE_OPENGL=1 -DHAVE_OPENGL_ES_1=0 -DHAVE_OPENGL_ES_2=1 -DHAVE_CROCUS
-DHAVE_I915 -DHAVE_IRIS -DHAVE_NOUVEAU -DHAVE_R300 -DHAVE_R600 -DHAVE_RADEONSI
-DHAVE_SWRAST -DVIDEO_CODEC_VC1DEC=1 -DVIDEO_CODEC_H264DEC=1
-DVIDEO_CODEC_H264ENC=1 -DVIDEO_CODEC_H265DEC=1 -DVIDEO_CODEC_H265ENC=1
-DHAVE_X11_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_DRM_PLATFORM
-DHAVE_XCB_PLATFORM -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0
-DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM
-DGLAPI_EXPORT_PROTO_ENTRY_POINTS=0 -DALLOW_KCMP -DDEBUG -DENABLE_SHADER_CACHE
-DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ
-DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT
-DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT
-DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE
-DHAVE___BUILTIN_TYPES_COMPATIBLE_P -DHAVE_FUNC_ATTRIBUTE_CONST
-DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC
-DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED
-DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK
-DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED
-DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_ALIAS
-DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_UINT128
-DHAVE_REALLOCARRAY -DHAVE_FMEMOPEN -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS
-DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY
-DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H
-DHAVE_CET_H -DHAVE_SYS_INOTIFY_H -DHAVE_STRTOF -DHAVE_MKOSTEMP
-DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R
-DHAVE_GETRANDOM -DHAVE_POSIX_FALLOCATE -DHAVE_GNU_QSORT_R
-DHAVE_STRUCT_TIMESPEC -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_ISSIGNALING
-DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR
-DHAVE_DL_ITERATE_PHDR -DSUPPORT_INTEL_INTEGRATED_GPUS -DHAVE_ZLIB -DHAVE_ZSTD
-DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM
-DHAVE_LIBUDEV -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="16.0.6"'
-DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE -DUSE_LIBELF -DUSE_LIBGLVND=1
-DHAVE_OPENMP -DXCB_KEYSYMS_AVAILABLE -DHAVE_DRI -DHAVE_DRI2 -DHAVE_DRI3
-DHAVE_DRI3_MODIFIERS -DHAVE_DRISW_KMS -mtls-dialect=gnu2
-Werror=implicit-function-declaration -Werror=missing-prototypes
-Werror=return-type -Werror=empty-body -Werror=incompatible-pointer-types
-Werror=int-conversion -Wimplicit-fallthrough -Wmisleading-indentation
-Wno-missing-field-initializers -Wno-format-truncation -Wno-nonnull-compare
-fno-math-errno -fno-trapping-math -fno-common -Wno-unused-function
-Werror=format -Wformat-security -ffunction-sections -fdata-sections -O2
-march=x86-64 -pipe -frecord-gcc-switches -fno-diagnostics-color
-fmessage-length=0 -fPIC -pthread -isystem/usr/lib/llvm/16/include
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -Werror=pointer-arith -Werror=vla -MD -MQ
src/gallium/auxiliary/libgallium.a.p/nir_nir_to_tgsi.c.o -MF
src/gallium/auxiliary/libgallium.a.p/nir_nir_to_tgsi.c.o.d -o
src/gallium/auxiliary/libgallium.a.p/nir_nir_to_tgsi.c.o -c
../mesa-23.2.1/src/gallium/auxiliary/nir/nir_to_tgsi.c
during RTL pass: combine
../mesa-23.2.1/src/gallium/auxiliary/nir/nir_to_tgsi.c: In function
‘ntt_emit_alu’:
../mesa-23.2.1/src/gallium/auxiliary/nir/nir_to_tgsi.c:1715:1: internal
compiler error: in simplify_subreg, at simplify-rtx.cc:7554
 1715 | }
      | ^
0x563ef78ca654 simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/simplify-rtx.cc:7554
0x563ef8ef091d simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/simplify-rtx.cc:7804
0x563ef8ef097d simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/simplify-rtx.cc:7805
0x563ef8ef091d simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/simplify-rtx.cc:7804
0x563ef9091703 make_compound_operation_int
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/rtl.h:3516
0x563ef9091703 make_compound_operation(rtx_def*, rtx_code)
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:8439
0x563ef9091f14 make_compound_operation_int
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:8198
0x563ef9091f14 make_compound_operation(rtx_def*, rtx_code)
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:8439
0x563ef908e22c simplify_set
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:6954
0x563ef8fb86d7 subst
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:5609
0x563ef8fb8bb9 subst
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:5470
0x563ef8faedc3 try_combine
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:3369
0x563ef8f3494c combine_instructions
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:1357
0x563ef8f318d9 rest_of_handle_combine
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:15080
0x563ef8f318d9 execute
       
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/combine.cc:15124
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-14.0.0.9999/work/gcc-14.0.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python
--enable-languages=c,c++,fortran,rust --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=yes,extra,rtl
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened
14.0.0 p, commit 2b02f083e67e97f8187d3ec023c3d281f49232c0'
--with-gcc-major-version-only --enable-libstdcxx-time --enable-lto
--disable-libstdcxx-pch --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
--with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all
--enable-libgomp --disable-libssp --disable-libada --enable-cet
--disable-systemtap --enable-valgrind-annotations --disable-vtable-verify
--disable-libvtv --with-zstd --with-isl --disable-isl-version-check
--enable-default-pie --enable-host-pie --enable-host-bind-now
--enable-default-ssp --with-build-config='bootstrap-O3 bootstrap-lto
bootstrap-cet'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231104 (experimental)
8d22ac6a18cf542cd541c06b2a7df8fdd293946d (Gentoo Hardened 14.0.0 p, commit
2b02f083e67e97f8187d3ec023c3d281f49232c0)
```

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building mesa
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
@ 2023-11-04 14:32 ` sjames at gcc dot gnu.org
  2023-11-04 15:45 ` sjames at gcc dot gnu.org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-04 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
I'll try reduce it now.

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building mesa
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
  2023-11-04 14:32 ` [Bug rtl-optimization/112380] " sjames at gcc dot gnu.org
@ 2023-11-04 15:45 ` sjames at gcc dot gnu.org
  2023-11-04 15:57 ` sjames at gcc dot gnu.org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-04 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
reduced:

```
enum { TGSI_FILE_NULL };
struct ureg_src {
  unsigned File : 4;
  unsigned : 2;
  unsigned : 2;
  unsigned : 2;
  unsigned : 1;
  unsigned IndirectFile : 4;
  unsigned IndirectSwizzle : 2;
  int : 16;
  int : 6;
  int : 16;
  int : 16;
  unsigned : 10;
} __trans_tmp_1;

int ureg_src_indirect_addr_1, ntt_emit_texture_instr_sampler_handle_src;

void ureg_scalar(struct ureg_src);

void ntt_emit_texture_instr() {
  struct ureg_src sampler;
  if (ntt_emit_texture_instr_sampler_handle_src)
    sampler = __trans_tmp_1;
  struct ureg_src reg = sampler;
  reg.File != TGSI_FILE_NULL;
  reg.IndirectFile = reg.IndirectSwizzle = ureg_src_indirect_addr_1;
  sampler = reg;
  ureg_scalar(reg);
}
```

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building mesa
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
  2023-11-04 14:32 ` [Bug rtl-optimization/112380] " sjames at gcc dot gnu.org
  2023-11-04 15:45 ` sjames at gcc dot gnu.org
@ 2023-11-04 15:57 ` sjames at gcc dot gnu.org
  2023-11-04 17:01 ` pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-04 15:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
might not be a 14 regression, I need to build older gccs with more checking

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building mesa
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-11-04 15:57 ` sjames at gcc dot gnu.org
@ 2023-11-04 17:01 ` pinskia at gcc dot gnu.org
  2023-11-04 17:47 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) sjames at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-04 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |14.0

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg)
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-11-04 17:01 ` pinskia at gcc dot gnu.org
@ 2023-11-04 17:47 ` sjames at gcc dot gnu.org
  2023-11-04 18:02 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-04 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Sam James from comment #3)
> might not be a 14 regression, I need to build older gccs with more checking

ok, it is a 14 regression

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg)
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-11-04 17:47 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) sjames at gcc dot gnu.org
@ 2023-11-04 18:02 ` pinskia at gcc dot gnu.org
  2023-11-04 19:16 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-4612-g6decda1a35be57 sjames at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-04 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
Trying 25, 31, 32 -> 34:
   25: strict_low_part(r114:TI#0)=r102:QI
      REG_DEAD r102:QI
   31: {r131:SI=r130:SI&0x1f800;clobber flags:CC;}
      REG_DEAD r130:SI
      REG_UNUSED flags:CC
   32: {r132:SI=r114:TI#0&0xfffffffffffe07ff;clobber flags:CC;}
      REG_UNUSED flags:CC
   34: {r134:DI=zero_extend(r131:SI|r132:SI);clobber flags:CC;}
      REG_UNUSED flags:CC
      REG_DEAD r131:SI
      REG_DEAD r132:SI
```
Then crash.

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-4612-g6decda1a35be57
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-11-04 18:02 ` pinskia at gcc dot gnu.org
@ 2023-11-04 19:16 ` sjames at gcc dot gnu.org
  2023-11-04 19:32 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-04 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
            Summary|[14 regression] ICE when    |[14 regression] ICE when
                   |building Mesa (in combine,  |building Mesa (in combine,
                   |internal compiler error: in |internal compiler error: in
                   |simplify_subreg)            |simplify_subreg) since
                   |                            |r14-4612-g6decda1a35be57

--- Comment #6 from Sam James <sjames at gcc dot gnu.org> ---
bisect says:

commit r14-4612-g6decda1a35be57
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Oct 12 11:34:57 2023 +0200

    tree-optimization/111779 - Handle some BIT_FIELD_REFs in SRA

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-4612-g6decda1a35be57
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-11-04 19:16 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-4612-g6decda1a35be57 sjames at gcc dot gnu.org
@ 2023-11-04 19:32 ` pinskia at gcc dot gnu.org
  2023-11-04 19:40 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-04 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Sam James from comment #6)
> bisect says:
> 
> commit r14-4612-g6decda1a35be57
> Author: Richard Biener <rguenther@suse.de>
> Date:   Thu Oct 12 11:34:57 2023 +0200
> 
>     tree-optimization/111779 - Handle some BIT_FIELD_REFs in SRA

That almost definitely just exposed the issue. Let me see if I can get a
testcase that fails without depending on that.

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-4612-g6decda1a35be57
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-11-04 19:32 ` pinskia at gcc dot gnu.org
@ 2023-11-04 19:40 ` pinskia at gcc dot gnu.org
  2023-11-05  9:19 ` sjames at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-04 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-11-04
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> That almost definitely just exposed the issue. Let me see if I can get a
> testcase that fails without depending on that.

New testcase which seems to have the same IR going into expand for GCC 13.2.0
and the trunk:
```
struct ureg_src {
  unsigned File : 4;
  unsigned : 2;
  unsigned : 2;
  unsigned : 2;
  unsigned : 1;
  unsigned IndirectFile : 4;
  unsigned IndirectSwizzle : 2;
  int : 16;
  int : 6;
  int : 16;
  int : 16;
  unsigned : 10;
} __trans_tmp_1;

int hh, nn;

void ureg_scalar(struct ureg_src);

void ntt_emit_texture_instr() {
  struct ureg_src sampler;
  unsigned char *t = ((char*)&sampler);
  unsigned char t1;
  unsigned t2, t3;
  if (nn) {
    sampler = __trans_tmp_1;
    t1 = *t;
    t2 = sampler.IndirectFile;
    t3 = sampler.IndirectSwizzle;
  }
  struct ureg_src reg = sampler;
  *t = t1;
  ureg_scalar(reg);
}
```

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-4612-g6decda1a35be57
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-11-04 19:40 ` pinskia at gcc dot gnu.org
@ 2023-11-05  9:19 ` sjames at gcc dot gnu.org
  2023-11-05 19:15 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2 roger at nextmovesoftware dot com
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-05  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at nextmovesoftware dot com

--- Comment #9 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> (In reply to Andrew Pinski from comment #7)
> > That almost definitely just exposed the issue. Let me see if I can get a
> > testcase that fails without depending on that.
> 
> New testcase which seems to have the same IR going into expand for GCC
> 13.2.0 and the trunk:
> [...]

This one seems to have started with:

commit r14-2526-g8911879415d6c2
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Fri Jul 14 18:10:05 2023 +0100

    i386: Improved insv of DImode/DFmode {high,low}parts into TImode.

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2023-11-05  9:19 ` sjames at gcc dot gnu.org
@ 2023-11-05 19:15 ` roger at nextmovesoftware dot com
  2023-11-12 22:42 ` sjames at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: roger at nextmovesoftware dot com @ 2023-11-05 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |roger at nextmovesoftware dot com
             Status|NEW                         |ASSIGNED

--- Comment #10 from Roger Sayle <roger at nextmovesoftware dot com> ---
combine.cc's expand_field_assignment needs to defend against gen_lowpart (which
is gen_lowpart_for_combine) returning a CLOBBER.  Otherwise, we end up calling
simplify_set on:

(set (reg:DI 134)
    (and:DI (subreg:DI (ior:SI (ior:SI (and:SI (subreg:SI (reg/v:TI 114 [
sampler ]) 0)
                        (const_int -129280 [0xfffffffffffe0700]))
                    (and:SI (clobber:TI (const_int 0 [0]))
                        (const_int -129025 [0xfffffffffffe07ff])))
                (and:SI (reg:SI 130)
                    (const_int 129024 [0x1f800]))) 0)
        (const_int 4294967295 [0xffffffff])))

where if you look closely the "(clobber:TI (const_int 0))" causes no end of fun
in simplify_rtx; it's not surprising that an assert is eventually triggered in
simplify_subreg.

I'm testing a patch.

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2023-11-05 19:15 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2 roger at nextmovesoftware dot com
@ 2023-11-12 22:42 ` sjames at gcc dot gnu.org
  2023-11-12 23:26 ` roger at nextmovesoftware dot com
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-12 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Roger Sayle from comment #10)
> 
> I'm testing a patch.

Did you get anywhere in the end?

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2023-11-12 22:42 ` sjames at gcc dot gnu.org
@ 2023-11-12 23:26 ` roger at nextmovesoftware dot com
  2023-12-11 17:33 ` cvs-commit at gcc dot gnu.org
  2023-12-16  9:25 ` roger at nextmovesoftware dot com
  14 siblings, 0 replies; 16+ messages in thread
From: roger at nextmovesoftware dot com @ 2023-11-12 23:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Roger Sayle <roger at nextmovesoftware dot com> ---
Patch proposed (actually two alternatives proposed) at
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636203.html

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2023-11-12 23:26 ` roger at nextmovesoftware dot com
@ 2023-12-11 17:33 ` cvs-commit at gcc dot gnu.org
  2023-12-16  9:25 ` roger at nextmovesoftware dot com
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-11 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:

https://gcc.gnu.org/g:624e274ca3a4405a55662fa72d1163120df0e03d

commit r14-6424-g624e274ca3a4405a55662fa72d1163120df0e03d
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Mon Dec 11 17:30:20 2023 +0000

    PR rtl-optimization/112380: Defend against CLOBBERs in combine.cc

    This patch addresses PR rtl-optimization/112380, an ICE-on-valid regression
    where a (clobber (const_int 0)) encounters a sanity checking gcc_assert
    (at line 7554) in simplify-rtx.cc.  These CLOBBERs are used internally
    by GCC's combine pass much like error_mark_node is used by various
    language front-ends.

    The solutions are either to handle/accept these CLOBBERs through-out
    (or in more places in) the middle-end's RTL optimizers, including functions
    in simplify-rtx.cc that are used by passes other than combine, and/or
    attempt to prevent these CLOBBERs escaping from try_combine into the
    RTX/RTL stream.  The benefit of the second approach is that it actually
    allows for better optimization: when try_combine fails to simplify an
    expression instead of substituting a CLOBBER to avoid the instruction
    pattern being recognized, noticing the CLOBBER often allows combine
    to attempt alternate simplifications/transformations looking for those
    that can be recognized.

    This first alternative is the minimal fix to address the CLOBBER
    encountered in the bugzilla PR.

    2023-12-11  Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR rtl-optimization/112380
            * combine.cc (expand_field_assignment): Check if gen_lowpart
            returned a CLOBBER, and avoid calling gen_simplify_binary with
            it if so.

    gcc/testsuite/ChangeLog
            PR rtl-optimization/112380
            * gcc.dg/pr112380.c: New test case.

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

* [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2
  2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2023-12-11 17:33 ` cvs-commit at gcc dot gnu.org
@ 2023-12-16  9:25 ` roger at nextmovesoftware dot com
  14 siblings, 0 replies; 16+ messages in thread
From: roger at nextmovesoftware dot com @ 2023-12-16  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

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

--- Comment #14 from Roger Sayle <roger at nextmovesoftware dot com> ---
This should now be fixed on mainline, but similar issues may still be latent in
combine (see the longer alternative in comment #12).

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

end of thread, other threads:[~2023-12-16  9:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-04 14:32 [Bug rtl-optimization/112380] New: [14 regression] ICE when building mesa sjames at gcc dot gnu.org
2023-11-04 14:32 ` [Bug rtl-optimization/112380] " sjames at gcc dot gnu.org
2023-11-04 15:45 ` sjames at gcc dot gnu.org
2023-11-04 15:57 ` sjames at gcc dot gnu.org
2023-11-04 17:01 ` pinskia at gcc dot gnu.org
2023-11-04 17:47 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) sjames at gcc dot gnu.org
2023-11-04 18:02 ` pinskia at gcc dot gnu.org
2023-11-04 19:16 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-4612-g6decda1a35be57 sjames at gcc dot gnu.org
2023-11-04 19:32 ` pinskia at gcc dot gnu.org
2023-11-04 19:40 ` pinskia at gcc dot gnu.org
2023-11-05  9:19 ` sjames at gcc dot gnu.org
2023-11-05 19:15 ` [Bug rtl-optimization/112380] [14 regression] ICE when building Mesa (in combine, internal compiler error: in simplify_subreg) since r14-2526-g8911879415d6c2 roger at nextmovesoftware dot com
2023-11-12 22:42 ` sjames at gcc dot gnu.org
2023-11-12 23:26 ` roger at nextmovesoftware dot com
2023-12-11 17:33 ` cvs-commit at gcc dot gnu.org
2023-12-16  9:25 ` roger at nextmovesoftware dot com

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).