Re: [PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-06-26 Thread Andrew Pinski via Gcc-patches
On Mon, Jun 26, 2023 at 12:41 PM Andrew Pinski  wrote:
>
> On Mon, Jun 26, 2023 at 11:49 AM Andrew Pinski  wrote:
> >
> > On Mon, Jun 26, 2023 at 9:13 AM Andrew Pinski  wrote:
> > >
> > > On Sun, Jun 25, 2023 at 10:59 PM Jan-Benedict Glaw  
> > > wrote:
> > > >
> > > > Hi Andrew,
> > > >
> > > > On Fri, 2023-05-05 08:17:19 -0700, Andrew Pinski via Gcc-patches 
> > > >  wrote:
> > > > > While looking into a different issue, I noticed that it
> > > > > would take until the second forwprop pass to do some
> > > > > forward proping and it was because the ssa name was
> > > > > used more than once but the second statement was
> > > > > "dead" and we don't remove that until much later.
> > > > [...]
> > > > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
> > > >
> > > > Since this patch, I see a bit of fallout building the Linux kernel
> > > > using the adder875_defconfig:
> > > >
> > > > # CC  arch/powerpc/kernel/ptrace/ptrace-view.o
> > > >   powerpc-linux-gcc 
> > > > -Wp,-MMD,arch/powerpc/kernel/ptrace/.ptrace-view.o.d -nostdinc 
> > > > -I./arch/powerpc/include -I./arch/powerpc/include/generated  
> > > > -I./include -I./arch/powerpc/include/uapi 
> > > > -I./arch/powerpc/include/generated/uapi -I./include/uapi 
> > > > -I./include/generated/uapi -include ./include/linux/compiler-version.h 
> > > > -include ./include/linux/kconfig.h -include 
> > > > ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc 
> > > > -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes 
> > > > -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE 
> > > > -Werror=implicit-function-declaration -Werror=implicit-int 
> > > > -Werror=return-type -Wno-format-security -funsigned-char -std=gnu11 
> > > > -mbig-endian -m32 -msoft-float -pipe -ffixed-r2 -mmultiple 
> > > > -mno-readonly-in-sdata -mcpu=860 -mno-prefixed -mno-pcrel -mno-altivec 
> > > > -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string 
> > > > -mbig-endian -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 
> > > > -fno-delete-null-pointer-checks -Wno-frame-address 
> > > > -Wno-format-truncation -Wno-format-overflow 
> > > > -Wno-address-of-packed-member -O2 -fno-allow-store-data-races 
> > > > -Wframe-larger-than=1024 -fstack-protector-strong -Wno-main 
> > > > -Wno-unused-but-set-variable -Wno-unused-const-variable 
> > > > -Wno-dangling-pointer -fomit-frame-pointer -ftrivial-auto-var-init=zero 
> > > > -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla 
> > > > -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation 
> > > > -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized 
> > > > -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 
> > > > -fno-strict-overflow -fno-stack-check -fconserve-stack 
> > > > -Werror=date-time -Werror=incompatible-pointer-types 
> > > > -Werror=designated-init -Wno-packed-not-aligned -g 
> > > > -mstack-protector-guard-offset=544 -Werror -DUTS_MACHINE='"ppc"'
> > > > -DKBUILD_MODFILE='"arch/powerpc/kernel/ptrace/ptrace-view"' 
> > > > -DKBUILD_BASENAME='"ptrace_view"' -DKBUILD_MODNAME='"ptrace_view"' 
> > > > -D__KBUILD_MODNAME=kmod_ptrace_view -c -o 
> > > > arch/powerpc/kernel/ptrace/ptrace-view.o 
> > > > arch/powerpc/kernel/ptrace/ptrace-view.c
> > > > during GIMPLE pass: pre
> > > > arch/powerpc/kernel/ptrace/ptrace-view.c: In function 
> > > > 'gpr32_set_common':
> > > > arch/powerpc/kernel/ptrace/ptrace-view.c:649:5: internal compiler 
> > > > error: in gimple_redirect_edge_and_branch, at tree-cfg.cc:6262
> > > >   649 | int gpr32_set_common(struct task_struct *target,
> > > >   | ^~~~
> > > > 0x1a562a6 internal_error(char const*, ...)
> > > >  ???:0
> > > > 0x826ea1 fancy_abort(char const*, int, char const*)
> > > >  ???:0
> > > > 0x9b77c9 redirect_edge_and_branch(edge_def*, basic_block_def*)
> > > >  ???:0
> > > > 0x9b7e43 split_edge(edge_def*)
> > > >  ???:0
> > > > 0xee1cc7 split_critical_edges(bool)
> > > >  ???:0
> > > > Please submit a full bug report, with preprocessed source (by using 
> > > > -freport-bug).
> > > > Please include the complete backtrace with any bug report.
> > > > See  for instructions.
> > > > make[4]: *** [scripts/Makefile.build:252: 
> > > > arch/powerpc/kernel/ptrace/ptrace-view.o] Error 1
> > > > make[3]: *** [scripts/Makefile.build:494: arch/powerpc/kernel/ptrace] 
> > > > Error 2
> > > > make[2]: *** [scripts/Makefile.build:494: arch/powerpc/kernel] Error 2
> > > > make[1]: *** [scripts/Makefile.build:494: arch/powerpc] Error 2
> > > > make: *** [Makefile:2026: .] Error 2
> > >
> > > Can you file a bug (https://gcc.gnu.org/bugzilla/) with the
> > > preprocessed source (which -freport-bug will provide). In the meantime
> > > I will try to reproduce it and see what is going on.
> >
> > Note I am suspecting it is related to GCC PR 103979 . I am still
> > trying to reproduce the ICE.
>
> I am 99% sure it is more 

Re: [PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-06-26 Thread Jan-Benedict Glaw
Hi Andrew,

On Mon, 2023-06-26 09:13:51 -0700, Andrew Pinski  wrote:
> On Sun, Jun 25, 2023 at 10:59 PM Jan-Benedict Glaw  wrote:
> > On Fri, 2023-05-05 08:17:19 -0700, Andrew Pinski via Gcc-patches 
> >  wrote:
> > > While looking into a different issue, I noticed that it
> > > would take until the second forwprop pass to do some
> > > forward proping and it was because the ssa name was
> > > used more than once but the second statement was
> > > "dead" and we don't remove that until much later.
> > [...]
> > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
> >
> > Since this patch, I see a bit of fallout building the Linux kernel
> > using the adder875_defconfig:
> >
> > # CC  arch/powerpc/kernel/ptrace/ptrace-view.o
[...]
> Can you file a bug (https://gcc.gnu.org/bugzilla/) with the
> preprocessed source (which -freport-bug will provide). In the meantime
> I will try to reproduce it and see what is going on.

Here it is:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110420

Once again an asm goto.

MfG, JBG

-- 


signature.asc
Description: PGP signature


Re: [PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-06-26 Thread Andrew Pinski via Gcc-patches
On Mon, Jun 26, 2023 at 11:49 AM Andrew Pinski  wrote:
>
> On Mon, Jun 26, 2023 at 9:13 AM Andrew Pinski  wrote:
> >
> > On Sun, Jun 25, 2023 at 10:59 PM Jan-Benedict Glaw  
> > wrote:
> > >
> > > Hi Andrew,
> > >
> > > On Fri, 2023-05-05 08:17:19 -0700, Andrew Pinski via Gcc-patches 
> > >  wrote:
> > > > While looking into a different issue, I noticed that it
> > > > would take until the second forwprop pass to do some
> > > > forward proping and it was because the ssa name was
> > > > used more than once but the second statement was
> > > > "dead" and we don't remove that until much later.
> > > [...]
> > > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
> > >
> > > Since this patch, I see a bit of fallout building the Linux kernel
> > > using the adder875_defconfig:
> > >
> > > # CC  arch/powerpc/kernel/ptrace/ptrace-view.o
> > >   powerpc-linux-gcc -Wp,-MMD,arch/powerpc/kernel/ptrace/.ptrace-view.o.d 
> > > -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
> > > -I./include -I./arch/powerpc/include/uapi 
> > > -I./arch/powerpc/include/generated/uapi -I./include/uapi 
> > > -I./include/generated/uapi -include ./include/linux/compiler-version.h 
> > > -include ./include/linux/kconfig.h -include 
> > > ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc 
> > > -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes 
> > > -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE 
> > > -Werror=implicit-function-declaration -Werror=implicit-int 
> > > -Werror=return-type -Wno-format-security -funsigned-char -std=gnu11 
> > > -mbig-endian -m32 -msoft-float -pipe -ffixed-r2 -mmultiple 
> > > -mno-readonly-in-sdata -mcpu=860 -mno-prefixed -mno-pcrel -mno-altivec 
> > > -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string 
> > > -mbig-endian -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 
> > > -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation 
> > > -Wno-format-overflow -Wno-address-of-packed-member -O2 
> > > -fno-allow-store-data-races -Wframe-larger-than=1024 
> > > -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable 
> > > -Wno-unused-const-variable -Wno-dangling-pointer -fomit-frame-pointer 
> > > -ftrivial-auto-var-init=zero -fno-stack-clash-protection 
> > > -Wdeclaration-after-statement -Wvla -Wno-pointer-sign 
> > > -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow 
> > > -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds 
> > > -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow 
> > > -fno-stack-check -fconserve-stack -Werror=date-time 
> > > -Werror=incompatible-pointer-types -Werror=designated-init 
> > > -Wno-packed-not-aligned -g -mstack-protector-guard-offset=544 -Werror 
> > > -DUTS_MACHINE='"ppc"'
> > > -DKBUILD_MODFILE='"arch/powerpc/kernel/ptrace/ptrace-view"' 
> > > -DKBUILD_BASENAME='"ptrace_view"' -DKBUILD_MODNAME='"ptrace_view"' 
> > > -D__KBUILD_MODNAME=kmod_ptrace_view -c -o 
> > > arch/powerpc/kernel/ptrace/ptrace-view.o 
> > > arch/powerpc/kernel/ptrace/ptrace-view.c
> > > during GIMPLE pass: pre
> > > arch/powerpc/kernel/ptrace/ptrace-view.c: In function 'gpr32_set_common':
> > > arch/powerpc/kernel/ptrace/ptrace-view.c:649:5: internal compiler error: 
> > > in gimple_redirect_edge_and_branch, at tree-cfg.cc:6262
> > >   649 | int gpr32_set_common(struct task_struct *target,
> > >   | ^~~~
> > > 0x1a562a6 internal_error(char const*, ...)
> > >  ???:0
> > > 0x826ea1 fancy_abort(char const*, int, char const*)
> > >  ???:0
> > > 0x9b77c9 redirect_edge_and_branch(edge_def*, basic_block_def*)
> > >  ???:0
> > > 0x9b7e43 split_edge(edge_def*)
> > >  ???:0
> > > 0xee1cc7 split_critical_edges(bool)
> > >  ???:0
> > > Please submit a full bug report, with preprocessed source (by using 
> > > -freport-bug).
> > > Please include the complete backtrace with any bug report.
> > > See  for instructions.
> > > make[4]: *** [scripts/Makefile.build:252: 
> > > arch/powerpc/kernel/ptrace/ptrace-view.o] Error 1
> > > make[3]: *** [scripts/Makefile.build:494: arch/powerpc/kernel/ptrace] 
> > > Error 2
> > > make[2]: *** [scripts/Makefile.build:494: arch/powerpc/kernel] Error 2
> > > make[1]: *** [scripts/Makefile.build:494: arch/powerpc] Error 2
> > > make: *** [Makefile:2026: .] Error 2
> >
> > Can you file a bug (https://gcc.gnu.org/bugzilla/) with the
> > preprocessed source (which -freport-bug will provide). In the meantime
> > I will try to reproduce it and see what is going on.
>
> Note I am suspecting it is related to GCC PR 103979 . I am still
> trying to reproduce the ICE.

I am 99% sure it is more related to PR 105165 really. Where PRE is now
trying to insert on a critical edge and that is failing ...
Basically my patch removes some extra statements (unrelated to the asm
goto) and that causes the IR to be enough different that PRE is now
failing.

Thanks,

Re: [PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-06-26 Thread Andrew Pinski via Gcc-patches
On Mon, Jun 26, 2023 at 9:13 AM Andrew Pinski  wrote:
>
> On Sun, Jun 25, 2023 at 10:59 PM Jan-Benedict Glaw  wrote:
> >
> > Hi Andrew,
> >
> > On Fri, 2023-05-05 08:17:19 -0700, Andrew Pinski via Gcc-patches 
> >  wrote:
> > > While looking into a different issue, I noticed that it
> > > would take until the second forwprop pass to do some
> > > forward proping and it was because the ssa name was
> > > used more than once but the second statement was
> > > "dead" and we don't remove that until much later.
> > [...]
> > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
> >
> > Since this patch, I see a bit of fallout building the Linux kernel
> > using the adder875_defconfig:
> >
> > # CC  arch/powerpc/kernel/ptrace/ptrace-view.o
> >   powerpc-linux-gcc -Wp,-MMD,arch/powerpc/kernel/ptrace/.ptrace-view.o.d 
> > -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
> > -I./include -I./arch/powerpc/include/uapi 
> > -I./arch/powerpc/include/generated/uapi -I./include/uapi 
> > -I./include/generated/uapi -include ./include/linux/compiler-version.h 
> > -include ./include/linux/kconfig.h -include 
> > ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc 
> > -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes 
> > -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE 
> > -Werror=implicit-function-declaration -Werror=implicit-int 
> > -Werror=return-type -Wno-format-security -funsigned-char -std=gnu11 
> > -mbig-endian -m32 -msoft-float -pipe -ffixed-r2 -mmultiple 
> > -mno-readonly-in-sdata -mcpu=860 -mno-prefixed -mno-pcrel -mno-altivec 
> > -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string -mbig-endian 
> > -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 
> > -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation 
> > -Wno-format-overflow -Wno-address-of-packed-member -O2 
> > -fno-allow-store-data-races -Wframe-larger-than=1024 
> > -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable 
> > -Wno-unused-const-variable -Wno-dangling-pointer -fomit-frame-pointer 
> > -ftrivial-auto-var-init=zero -fno-stack-clash-protection 
> > -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type 
> > -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict 
> > -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than 
> > -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check 
> > -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types 
> > -Werror=designated-init -Wno-packed-not-aligned -g 
> > -mstack-protector-guard-offset=544 -Werror -DUTS_MACHINE='"ppc"'
> > -DKBUILD_MODFILE='"arch/powerpc/kernel/ptrace/ptrace-view"' 
> > -DKBUILD_BASENAME='"ptrace_view"' -DKBUILD_MODNAME='"ptrace_view"' 
> > -D__KBUILD_MODNAME=kmod_ptrace_view -c -o 
> > arch/powerpc/kernel/ptrace/ptrace-view.o 
> > arch/powerpc/kernel/ptrace/ptrace-view.c
> > during GIMPLE pass: pre
> > arch/powerpc/kernel/ptrace/ptrace-view.c: In function 'gpr32_set_common':
> > arch/powerpc/kernel/ptrace/ptrace-view.c:649:5: internal compiler error: in 
> > gimple_redirect_edge_and_branch, at tree-cfg.cc:6262
> >   649 | int gpr32_set_common(struct task_struct *target,
> >   | ^~~~
> > 0x1a562a6 internal_error(char const*, ...)
> >  ???:0
> > 0x826ea1 fancy_abort(char const*, int, char const*)
> >  ???:0
> > 0x9b77c9 redirect_edge_and_branch(edge_def*, basic_block_def*)
> >  ???:0
> > 0x9b7e43 split_edge(edge_def*)
> >  ???:0
> > 0xee1cc7 split_critical_edges(bool)
> >  ???:0
> > Please submit a full bug report, with preprocessed source (by using 
> > -freport-bug).
> > Please include the complete backtrace with any bug report.
> > See  for instructions.
> > make[4]: *** [scripts/Makefile.build:252: 
> > arch/powerpc/kernel/ptrace/ptrace-view.o] Error 1
> > make[3]: *** [scripts/Makefile.build:494: arch/powerpc/kernel/ptrace] Error 
> > 2
> > make[2]: *** [scripts/Makefile.build:494: arch/powerpc/kernel] Error 2
> > make[1]: *** [scripts/Makefile.build:494: arch/powerpc] Error 2
> > make: *** [Makefile:2026: .] Error 2
>
> Can you file a bug (https://gcc.gnu.org/bugzilla/) with the
> preprocessed source (which -freport-bug will provide). In the meantime
> I will try to reproduce it and see what is going on.

Note I am suspecting it is related to GCC PR 103979 . I am still
trying to reproduce the ICE.

>
> Thanks,
> Andrew
>
>
> >
> >
> > (Full log at 
> > http://toolchain.lug-owl.de/laminar/jobs/linux-powerpc-adder875_defconfig/100)
> >
> > Thanks,
> >   Jan-Benedict
> >
> > --


Re: [PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-06-26 Thread Andrew Pinski via Gcc-patches
On Sun, Jun 25, 2023 at 10:59 PM Jan-Benedict Glaw  wrote:
>
> Hi Andrew,
>
> On Fri, 2023-05-05 08:17:19 -0700, Andrew Pinski via Gcc-patches 
>  wrote:
> > While looking into a different issue, I noticed that it
> > would take until the second forwprop pass to do some
> > forward proping and it was because the ssa name was
> > used more than once but the second statement was
> > "dead" and we don't remove that until much later.
> [...]
> > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
>
> Since this patch, I see a bit of fallout building the Linux kernel
> using the adder875_defconfig:
>
> # CC  arch/powerpc/kernel/ptrace/ptrace-view.o
>   powerpc-linux-gcc -Wp,-MMD,arch/powerpc/kernel/ptrace/.ptrace-view.o.d 
> -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
> -I./include -I./arch/powerpc/include/uapi 
> -I./arch/powerpc/include/generated/uapi -I./include/uapi 
> -I./include/generated/uapi -include ./include/linux/compiler-version.h 
> -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h 
> -D__KERNEL__ -I ./arch/powerpc -fmacro-prefix-map=./= -Wall -Wundef 
> -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common 
> -fshort-wchar -fno-PIE -Werror=implicit-function-declaration 
> -Werror=implicit-int -Werror=return-type -Wno-format-security -funsigned-char 
> -std=gnu11 -mbig-endian -m32 -msoft-float -pipe -ffixed-r2 -mmultiple 
> -mno-readonly-in-sdata -mcpu=860 -mno-prefixed -mno-pcrel -mno-altivec 
> -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string -mbig-endian 
> -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 
> -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation 
> -Wno-format-overflow -Wno-address-of-packed-member -O2 
> -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong 
> -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable 
> -Wno-dangling-pointer -fomit-frame-pointer -ftrivial-auto-var-init=zero 
> -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla 
> -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation 
> -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized 
> -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 
> -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time 
> -Werror=incompatible-pointer-types -Werror=designated-init 
> -Wno-packed-not-aligned -g -mstack-protector-guard-offset=544 -Werror 
> -DUTS_MACHINE='"ppc"'
> -DKBUILD_MODFILE='"arch/powerpc/kernel/ptrace/ptrace-view"' 
> -DKBUILD_BASENAME='"ptrace_view"' -DKBUILD_MODNAME='"ptrace_view"' 
> -D__KBUILD_MODNAME=kmod_ptrace_view -c -o 
> arch/powerpc/kernel/ptrace/ptrace-view.o 
> arch/powerpc/kernel/ptrace/ptrace-view.c
> during GIMPLE pass: pre
> arch/powerpc/kernel/ptrace/ptrace-view.c: In function 'gpr32_set_common':
> arch/powerpc/kernel/ptrace/ptrace-view.c:649:5: internal compiler error: in 
> gimple_redirect_edge_and_branch, at tree-cfg.cc:6262
>   649 | int gpr32_set_common(struct task_struct *target,
>   | ^~~~
> 0x1a562a6 internal_error(char const*, ...)
>  ???:0
> 0x826ea1 fancy_abort(char const*, int, char const*)
>  ???:0
> 0x9b77c9 redirect_edge_and_branch(edge_def*, basic_block_def*)
>  ???:0
> 0x9b7e43 split_edge(edge_def*)
>  ???:0
> 0xee1cc7 split_critical_edges(bool)
>  ???:0
> Please submit a full bug report, with preprocessed source (by using 
> -freport-bug).
> Please include the complete backtrace with any bug report.
> See  for instructions.
> make[4]: *** [scripts/Makefile.build:252: 
> arch/powerpc/kernel/ptrace/ptrace-view.o] Error 1
> make[3]: *** [scripts/Makefile.build:494: arch/powerpc/kernel/ptrace] Error 2
> make[2]: *** [scripts/Makefile.build:494: arch/powerpc/kernel] Error 2
> make[1]: *** [scripts/Makefile.build:494: arch/powerpc] Error 2
> make: *** [Makefile:2026: .] Error 2

Can you file a bug (https://gcc.gnu.org/bugzilla/) with the
preprocessed source (which -freport-bug will provide). In the meantime
I will try to reproduce it and see what is going on.

Thanks,
Andrew


>
>
> (Full log at 
> http://toolchain.lug-owl.de/laminar/jobs/linux-powerpc-adder875_defconfig/100)
>
> Thanks,
>   Jan-Benedict
>
> --


Re: [PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-06-25 Thread Jan-Benedict Glaw
Hi Andrew,

On Fri, 2023-05-05 08:17:19 -0700, Andrew Pinski via Gcc-patches 
 wrote:
> While looking into a different issue, I noticed that it
> would take until the second forwprop pass to do some
> forward proping and it was because the ssa name was
> used more than once but the second statement was
> "dead" and we don't remove that until much later.
[...]
> OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Since this patch, I see a bit of fallout building the Linux kernel
using the adder875_defconfig:

# CC  arch/powerpc/kernel/ptrace/ptrace-view.o
  powerpc-linux-gcc -Wp,-MMD,arch/powerpc/kernel/ptrace/.ptrace-view.o.d 
-nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
-I./include -I./arch/powerpc/include/uapi 
-I./arch/powerpc/include/generated/uapi -I./include/uapi 
-I./include/generated/uapi -include ./include/linux/compiler-version.h -include 
./include/linux/kconfig.h -include ./include/linux/compiler_types.h 
-D__KERNEL__ -I ./arch/powerpc -fmacro-prefix-map=./= -Wall -Wundef 
-Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common 
-fshort-wchar -fno-PIE -Werror=implicit-function-declaration 
-Werror=implicit-int -Werror=return-type -Wno-format-security -funsigned-char 
-std=gnu11 -mbig-endian -m32 -msoft-float -pipe -ffixed-r2 -mmultiple 
-mno-readonly-in-sdata -mcpu=860 -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx 
-mno-mma -fno-asynchronous-unwind-tables -mno-string -mbig-endian 
-mstack-protector-guard=tls -mstack-protector-guard-reg=r2 
-fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation 
-Wno-format-overflow -Wno-address-of-packed-member -O2 
-fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong 
-Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable 
-Wno-dangling-pointer -fomit-frame-pointer -ftrivial-auto-var-init=zero 
-fno-stack-clash-protection -Wdeclaration-after-statement -Wvla 
-Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation 
-Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds 
-Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow 
-fno-stack-check -fconserve-stack -Werror=date-time 
-Werror=incompatible-pointer-types -Werror=designated-init 
-Wno-packed-not-aligned -g -mstack-protector-guard-offset=544 -Werror 
-DUTS_MACHINE='"ppc"'
-DKBUILD_MODFILE='"arch/powerpc/kernel/ptrace/ptrace-view"' 
-DKBUILD_BASENAME='"ptrace_view"' -DKBUILD_MODNAME='"ptrace_view"' 
-D__KBUILD_MODNAME=kmod_ptrace_view -c -o 
arch/powerpc/kernel/ptrace/ptrace-view.o 
arch/powerpc/kernel/ptrace/ptrace-view.c  
during GIMPLE pass: pre
arch/powerpc/kernel/ptrace/ptrace-view.c: In function 'gpr32_set_common':
arch/powerpc/kernel/ptrace/ptrace-view.c:649:5: internal compiler error: in 
gimple_redirect_edge_and_branch, at tree-cfg.cc:6262
  649 | int gpr32_set_common(struct task_struct *target,
  | ^~~~
0x1a562a6 internal_error(char const*, ...)
 ???:0
0x826ea1 fancy_abort(char const*, int, char const*)
 ???:0
0x9b77c9 redirect_edge_and_branch(edge_def*, basic_block_def*)
 ???:0
0x9b7e43 split_edge(edge_def*)
 ???:0
0xee1cc7 split_critical_edges(bool)
 ???:0
Please submit a full bug report, with preprocessed source (by using 
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
make[4]: *** [scripts/Makefile.build:252: 
arch/powerpc/kernel/ptrace/ptrace-view.o] Error 1
make[3]: *** [scripts/Makefile.build:494: arch/powerpc/kernel/ptrace] Error 2
make[2]: *** [scripts/Makefile.build:494: arch/powerpc/kernel] Error 2
make[1]: *** [scripts/Makefile.build:494: arch/powerpc] Error 2
make: *** [Makefile:2026: .] Error 2


(Full log at 
http://toolchain.lug-owl.de/laminar/jobs/linux-powerpc-adder875_defconfig/100)

Thanks,
  Jan-Benedict

-- 


signature.asc
Description: PGP signature


Re: [PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-05-08 Thread Richard Biener via Gcc-patches
On Fri, May 5, 2023 at 5:18 PM Andrew Pinski via Gcc-patches
 wrote:
>
> While looking into a different issue, I noticed that it
> would take until the second forwprop pass to do some
> forward proping and it was because the ssa name was
> used more than once but the second statement was
> "dead" and we don't remove that until much later.
>
> So this uses simple_dce_from_worklist instead of manually
> removing of the known unused statements instead.
> Propagate engine does not do a cleanupcfg afterwards either but manually
> cleans up possible EH edges so simple_dce_from_worklist
> needs to communicate that back to the propagate engine.
>
> Some testcases needed to be updated/changed even because of better 
> optimization.
> gcc.dg/pr81192.c even had to be changed to be using the gimple FE so it would
> be less fragile in the future too.
> gcc.dg/tree-ssa/pr98737-1.c was failing because __atomic_fetch_ was being 
> matched
> but in those cases, the result was not being used so both __atomic_fetch_ and
> __atomic_x_and_fetch_ are valid choices and would not make a code generation 
> difference.
> evrp7.c, evrp8.c, vrp35.c, vrp36.c: just needed a slightly change as the 
> removal message
> is different slightly.
> kernels-alias-8.c: ccp1 is able to remove an unused load which causes ealias 
> to have
> one less load to analysis so update the expected scan #.
>
> OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

OK.

Thanks,
Richard.

> gcc/ChangeLog:
>
> PR tree-optimization/109691
> * tree-ssa-dce.cc (simple_dce_from_worklist): Add need_eh_cleanup
> argument.
> If the removed statement can throw, have need_eh_cleanup
> include the bb of that statement.
> * tree-ssa-dce.h (simple_dce_from_worklist): Update declaration.
> * tree-ssa-propagate.cc (struct prop_stats_d): Remove
> num_dce.
> (substitute_and_fold_dom_walker::substitute_and_fold_dom_walker):
> Initialize dceworklist instead of stmts_to_remove.
> (substitute_and_fold_dom_walker::~substitute_and_fold_dom_walker):
> Destore dceworklist instead of stmts_to_remove.
> (substitute_and_fold_dom_walker::before_dom_children):
> Set dceworklist instead of adding to stmts_to_remove.
> (substitute_and_fold_engine::substitute_and_fold):
> Call simple_dce_from_worklist instead of poping
> from the list.
> Don't update the stat on removal statements.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/tree-ssa/evrp7.c: Update for output change.
> * gcc.dg/tree-ssa/evrp8.c: Likewise.
> * gcc.dg/tree-ssa/vrp35.c: Likewise.
> * gcc.dg/tree-ssa/vrp36.c: Likewise.
> * gcc.dg/tree-ssa/pr98737-1.c: Update scan-tree-dump-not
> to check for assignment too instead of just a call.
> * c-c++-common/goacc/kernels-alias-8.c: Update test
> for removal of load.
> * gcc.dg/pr81192.c: Rewrite testcase in gimple based test.
> ---
>  .../c-c++-common/goacc/kernels-alias-8.c  |  6 +-
>  gcc/testsuite/gcc.dg/pr81192.c| 64 ---
>  gcc/testsuite/gcc.dg/tree-ssa/evrp7.c |  2 +-
>  gcc/testsuite/gcc.dg/tree-ssa/evrp8.c |  2 +-
>  gcc/testsuite/gcc.dg/tree-ssa/pr98737-1.c |  7 +-
>  gcc/testsuite/gcc.dg/tree-ssa/vrp35.c |  2 +-
>  gcc/testsuite/gcc.dg/tree-ssa/vrp36.c |  2 +-
>  gcc/tree-ssa-dce.cc   |  7 +-
>  gcc/tree-ssa-dce.h|  2 +-
>  gcc/tree-ssa-propagate.cc | 39 ++-
>  10 files changed, 82 insertions(+), 51 deletions(-)
>
> diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c 
> b/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c
> index 69200ccf192..c3922e33241 100644
> --- a/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c
> +++ b/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c
> @@ -16,7 +16,9 @@ foo (int *a, size_t n)
>}
>  }
>
> -/* Only the omp_data_i related loads should be annotated with cliques.  */
> -/* { dg-final { scan-tree-dump-times "clique 1 base 1" 2 "ealias" } } */
> +/* Only the omp_data_i related loads should be annotated with cliques.
> +   Note ccp can remove one of the omp_data_i loads which is why there
> +   is there only one clique base still there.  */
> +/* { dg-final { scan-tree-dump-times "clique 1 base 1" 1 "ealias" } } */
>  /* { dg-final { scan-tree-dump-times "(?n)clique 1 base 0" 2 "ealias" } } */
>
> diff --git a/gcc/testsuite/gcc.dg/pr81192.c b/gcc/testsuite/gcc.dg/pr81192.c
> index 6cab6056558..f6d201ee71a 100644
> --- a/gcc/testsuite/gcc.dg/pr81192.c
> +++ b/gcc/testsuite/gcc.dg/pr81192.c
> @@ -1,5 +1,58 @@
> -/* { dg-options "-Os -fdump-tree-pre-details -fdisable-tree-evrp 
> -fno-tree-dse" } */
> +/* { dg-options "-Os -fgimple -fdump-tree-pre-details -fdisable-tree-evrp 
> -fno-tree-dse" } */
>
> +#if __SIZEOF_INT__ == 2
> +#define unsigned 

[PATCH] Move substitute_and_fold over to use simple_dce_from_worklist

2023-05-05 Thread Andrew Pinski via Gcc-patches
While looking into a different issue, I noticed that it
would take until the second forwprop pass to do some
forward proping and it was because the ssa name was
used more than once but the second statement was
"dead" and we don't remove that until much later.

So this uses simple_dce_from_worklist instead of manually
removing of the known unused statements instead.
Propagate engine does not do a cleanupcfg afterwards either but manually
cleans up possible EH edges so simple_dce_from_worklist
needs to communicate that back to the propagate engine.

Some testcases needed to be updated/changed even because of better optimization.
gcc.dg/pr81192.c even had to be changed to be using the gimple FE so it would
be less fragile in the future too.
gcc.dg/tree-ssa/pr98737-1.c was failing because __atomic_fetch_ was being 
matched
but in those cases, the result was not being used so both __atomic_fetch_ and
__atomic_x_and_fetch_ are valid choices and would not make a code generation 
difference.
evrp7.c, evrp8.c, vrp35.c, vrp36.c: just needed a slightly change as the 
removal message
is different slightly.
kernels-alias-8.c: ccp1 is able to remove an unused load which causes ealias to 
have
one less load to analysis so update the expected scan #.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

PR tree-optimization/109691
* tree-ssa-dce.cc (simple_dce_from_worklist): Add need_eh_cleanup
argument.
If the removed statement can throw, have need_eh_cleanup
include the bb of that statement.
* tree-ssa-dce.h (simple_dce_from_worklist): Update declaration.
* tree-ssa-propagate.cc (struct prop_stats_d): Remove
num_dce.
(substitute_and_fold_dom_walker::substitute_and_fold_dom_walker):
Initialize dceworklist instead of stmts_to_remove.
(substitute_and_fold_dom_walker::~substitute_and_fold_dom_walker):
Destore dceworklist instead of stmts_to_remove.
(substitute_and_fold_dom_walker::before_dom_children):
Set dceworklist instead of adding to stmts_to_remove.
(substitute_and_fold_engine::substitute_and_fold):
Call simple_dce_from_worklist instead of poping
from the list.
Don't update the stat on removal statements.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/evrp7.c: Update for output change.
* gcc.dg/tree-ssa/evrp8.c: Likewise.
* gcc.dg/tree-ssa/vrp35.c: Likewise.
* gcc.dg/tree-ssa/vrp36.c: Likewise.
* gcc.dg/tree-ssa/pr98737-1.c: Update scan-tree-dump-not
to check for assignment too instead of just a call.
* c-c++-common/goacc/kernels-alias-8.c: Update test
for removal of load.
* gcc.dg/pr81192.c: Rewrite testcase in gimple based test.
---
 .../c-c++-common/goacc/kernels-alias-8.c  |  6 +-
 gcc/testsuite/gcc.dg/pr81192.c| 64 ---
 gcc/testsuite/gcc.dg/tree-ssa/evrp7.c |  2 +-
 gcc/testsuite/gcc.dg/tree-ssa/evrp8.c |  2 +-
 gcc/testsuite/gcc.dg/tree-ssa/pr98737-1.c |  7 +-
 gcc/testsuite/gcc.dg/tree-ssa/vrp35.c |  2 +-
 gcc/testsuite/gcc.dg/tree-ssa/vrp36.c |  2 +-
 gcc/tree-ssa-dce.cc   |  7 +-
 gcc/tree-ssa-dce.h|  2 +-
 gcc/tree-ssa-propagate.cc | 39 ++-
 10 files changed, 82 insertions(+), 51 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c 
b/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c
index 69200ccf192..c3922e33241 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-alias-8.c
@@ -16,7 +16,9 @@ foo (int *a, size_t n)
   }
 }
 
-/* Only the omp_data_i related loads should be annotated with cliques.  */
-/* { dg-final { scan-tree-dump-times "clique 1 base 1" 2 "ealias" } } */
+/* Only the omp_data_i related loads should be annotated with cliques.
+   Note ccp can remove one of the omp_data_i loads which is why there
+   is there only one clique base still there.  */
+/* { dg-final { scan-tree-dump-times "clique 1 base 1" 1 "ealias" } } */
 /* { dg-final { scan-tree-dump-times "(?n)clique 1 base 0" 2 "ealias" } } */
 
diff --git a/gcc/testsuite/gcc.dg/pr81192.c b/gcc/testsuite/gcc.dg/pr81192.c
index 6cab6056558..f6d201ee71a 100644
--- a/gcc/testsuite/gcc.dg/pr81192.c
+++ b/gcc/testsuite/gcc.dg/pr81192.c
@@ -1,5 +1,58 @@
-/* { dg-options "-Os -fdump-tree-pre-details -fdisable-tree-evrp 
-fno-tree-dse" } */
+/* { dg-options "-Os -fgimple -fdump-tree-pre-details -fdisable-tree-evrp 
-fno-tree-dse" } */
 
+#if __SIZEOF_INT__ == 2
+#define unsigned __UINT32_TYPE__
+#define int __INT32_TYPE__
+#endif
+
+unsigned a;
+int b, c;
+
+void __GIMPLE(ssa, startwith("pre")) fn2   ()
+{
+  int b_lsm6;
+  int j;
+  int c0_1;
+  int iftmp2_8;
+
+  __BB(2):
+  a = _Literal (unsigned)30;
+  c0_1 = c;
+  b_lsm6_9 = b;
+  goto __BB7;
+
+  __BB(3):
+  if