public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/94266] New: aarch64:ICE during GIMPLE pass: forwprop
@ 2020-03-23  3:55 qianchao9 at huawei dot com
  2020-03-23  7:38 ` [Bug tree-optimization/94266] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: qianchao9 at huawei dot com @ 2020-03-23  3:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94266
           Summary: aarch64:ICE during GIMPLE pass: forwprop
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qianchao9 at huawei dot com
  Target Milestone: ---
            Target: aarch64

hello
I find an ICE when testing GCC10.0 on aarch64 with -march=armv8.2-a+sve
-msve-vector-bits=256 -ftree-loop-vectorize -O2:

Simple test case
---
#include <stdarg.h>
#define N 16
int out[N];
int a[2*N] =
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};

/* Outer-loop vectorization.  */
__attribute__ ((noinline)) void 
foo () 
{
  int i, j;
  int res;
  for (i = 0; i < N; i++)
    {
      res = 1000;

      for (j = 0; j < N; j++) 
        res = res - a[i+j];

      out[i] = res;
    }
}

int main ()
{
  foo ();
  return 0;
}
---
GCC version:
gcc version 10.0.1 20200309 (experimental) (GCC)

Runcommand:
gcc new_test.c -march=armv8.2-a+sve -msve-vector-bits=256 -ftree-loop-vectorize
-O2 -S -o new_test.s

Result:
during GIMPLE pass: forwprop
pr_xxx.c: In function ‘foo’:
pr_xxx.c:10:1: internal compiler error: in maybe_canonicalize_mem_ref_addr, at
gimple-fold.c:4899
   10 | foo ()
      | ^~~
0x97dd5b maybe_canonicalize_mem_ref_addr
        ../../gcc/gimple-fold.c:4899
0x988d97 fold_stmt_1
        ../../gcc/gimple-fold.c:4972
0x98cfa3 fold_stmt_inplace(gimple_stmt_iterator*)
        ../../gcc/gimple-fold.c:5328
0xde455f forward_propagate_addr_expr_1
        ../../gcc/tree-ssa-forwprop.c:878
0xde6513 forward_propagate_addr_expr
        ../../gcc/tree-ssa-forwprop.c:998
0xdea427 execute
        ../../gcc/tree-ssa-forwprop.c:2715

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

* [Bug tree-optimization/94266] aarch64:ICE during GIMPLE pass: forwprop
  2020-03-23  3:55 [Bug tree-optimization/94266] New: aarch64:ICE during GIMPLE pass: forwprop qianchao9 at huawei dot com
@ 2020-03-23  7:38 ` rguenth at gcc dot gnu.org
  2020-03-23  7:59 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-23  7:38 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2020-03-23
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, mine.

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

* [Bug tree-optimization/94266] aarch64:ICE during GIMPLE pass: forwprop
  2020-03-23  3:55 [Bug tree-optimization/94266] New: aarch64:ICE during GIMPLE pass: forwprop qianchao9 at huawei dot com
  2020-03-23  7:38 ` [Bug tree-optimization/94266] " rguenth at gcc dot gnu.org
@ 2020-03-23  7:59 ` rguenth at gcc dot gnu.org
  2020-03-23  9:36 ` qianchao9 at huawei dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-23  7:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
This looks latent somewhat.  The issue is manifold - first we end up
with &TARGET_MEM_REF [_1] where the TARGET_MEM_REF was not canonicalized
to a MEM_REF because

static tree
create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr,
                    bool verify)
...
  /* If possible use a plain MEM_REF instead of a TARGET_MEM_REF.
     ???  As IVOPTs does not follow restrictions to where the base
     pointer may point to create a MEM_REF only if we know that
     base is valid.  */
  if ((TREE_CODE (base) == ADDR_EXPR || TREE_CODE (base) == INTEGER_CST)

thus an SSA name base isn't wanted here.  That may be legacy.

The best action is probably to make forwprop not try to forward &TARGET_MEM_REF
since that's hardly a good idea and code in general isn't prepared to do that.
Will test a patch along that line.

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

* [Bug tree-optimization/94266] aarch64:ICE during GIMPLE pass: forwprop
  2020-03-23  3:55 [Bug tree-optimization/94266] New: aarch64:ICE during GIMPLE pass: forwprop qianchao9 at huawei dot com
  2020-03-23  7:38 ` [Bug tree-optimization/94266] " rguenth at gcc dot gnu.org
  2020-03-23  7:59 ` rguenth at gcc dot gnu.org
@ 2020-03-23  9:36 ` qianchao9 at huawei dot com
  2020-03-23  9:39 ` cvs-commit at gcc dot gnu.org
  2020-03-23  9:40 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: qianchao9 at huawei dot com @ 2020-03-23  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Qian Chao <qianchao9 at huawei dot com> ---
Created attachment 48082
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48082&action=edit
Add a check before forward propgating a ADDR_EXPR to a MEM_REF to solve the
ICE.

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

* [Bug tree-optimization/94266] aarch64:ICE during GIMPLE pass: forwprop
  2020-03-23  3:55 [Bug tree-optimization/94266] New: aarch64:ICE during GIMPLE pass: forwprop qianchao9 at huawei dot com
                   ` (2 preceding siblings ...)
  2020-03-23  9:36 ` qianchao9 at huawei dot com
@ 2020-03-23  9:39 ` cvs-commit at gcc dot gnu.org
  2020-03-23  9:40 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-23  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:263ee1260bc4017465a8ef722889ccc59fcee0d2

commit r10-7328-g263ee1260bc4017465a8ef722889ccc59fcee0d2
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Mar 23 10:38:57 2020 +0100

    tree-optimization/94266 - aovid propagating addresses of TARGET_MEM_REFs

    2020-03-23  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/94266
            * tree-ssa-forwprop.c (pass_forwprop::execute): Do not propagate
            addresses of TARGET_MEM_REFs.
     Please enter the commit message for your changes. Lines starting

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

* [Bug tree-optimization/94266] aarch64:ICE during GIMPLE pass: forwprop
  2020-03-23  3:55 [Bug tree-optimization/94266] New: aarch64:ICE during GIMPLE pass: forwprop qianchao9 at huawei dot com
                   ` (3 preceding siblings ...)
  2020-03-23  9:39 ` cvs-commit at gcc dot gnu.org
@ 2020-03-23  9:40 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-23  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-03-23  9:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23  3:55 [Bug tree-optimization/94266] New: aarch64:ICE during GIMPLE pass: forwprop qianchao9 at huawei dot com
2020-03-23  7:38 ` [Bug tree-optimization/94266] " rguenth at gcc dot gnu.org
2020-03-23  7:59 ` rguenth at gcc dot gnu.org
2020-03-23  9:36 ` qianchao9 at huawei dot com
2020-03-23  9:39 ` cvs-commit at gcc dot gnu.org
2020-03-23  9:40 ` rguenth 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).