public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error
@ 2021-08-10 17:39 bergner at gcc dot gnu.org
  2021-08-10 17:40 ` [Bug target/101849] " bergner at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-08-10 17:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101849
           Summary: MMA built-in dies with a verify_gimple failed error
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

bergner@pike:~/gcc/BUGS/MMA/ICE$ cat bug.i 
__vector_pair vp;
void
foo (double *x)
{
   vp = __builtin_vsx_lxvp(0, (__vector_pair *)(void *)x);
}

bergner@pike:~/gcc/BUGS/MMA/IC3$ gcc -S -O2 -mcpu=power10 bug.i 
bug.i: In function ‘foo’:
bug.i:3:1: error: non-trivial conversion in ‘mem_ref’
    3 | foo (double *x)
      | ^~~
__vector_pair
double
_1 = *_2;
during GIMPLE pass: lower
bug.i:3:1: internal compiler error: ‘verify_gimple’ failed
0x114e804f verify_gimple_in_seq(gimple*)
        /home/bergner/gcc/gcc-fsf-mainline/gcc/tree-cfg.c:5183
0x11188afb execute_function_todo
        /home/bergner/gcc/gcc-fsf-mainline/gcc/passes.c:2044
0x111872cb do_per_function
        /home/bergner/gcc/gcc-fsf-mainline/gcc/passes.c:1687
0x11188de3 execute_todo
        /home/bergner/gcc/gcc-fsf-mainline/gcc/passes.c:2096
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] 11+ messages in thread

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
@ 2021-08-10 17:40 ` bergner at gcc dot gnu.org
  2021-08-10 17:41 ` bergner at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-08-10 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |bergner at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-08-10

--- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> ---
This is a target bug with my new __builtin_vsx_lxvp built-in.  Mine.

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
  2021-08-10 17:40 ` [Bug target/101849] " bergner at gcc dot gnu.org
@ 2021-08-10 17:41 ` bergner at gcc dot gnu.org
  2021-08-10 21:23 ` bergner at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-08-10 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|                            |powerpc64*-linux-gnu
   Target Milestone|---                         |12.0
      Known to fail|                            |11.0, 12.0

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
  2021-08-10 17:40 ` [Bug target/101849] " bergner at gcc dot gnu.org
  2021-08-10 17:41 ` bergner at gcc dot gnu.org
@ 2021-08-10 21:23 ` bergner at gcc dot gnu.org
  2021-08-11  7:24 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-08-10 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Peter Bergner <bergner at gcc dot gnu.org> ---
So it seems when we go to expand the gimple builtin, the cast of the pointer is
already stripped away:

(gdb) ps gsi_stmt(*gsi)
_1 = __builtin_vsx_lxvp (0, x);

We will only will get as far as expanding the builtin if there is a cast of the
double *x pointer to a __vector_pair * pointer, so the simple fix seems to be
just to look for a non __vector_pair pointer and cast it during the expansion
to the correct __vector_pair * pointer.  Doing that fixes the ICE for me.  I'll
kick off a round of testing.

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-08-10 21:23 ` bergner at gcc dot gnu.org
@ 2021-08-11  7:24 ` rguenth at gcc dot gnu.org
  2021-08-11 22:20 ` bergner at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-11  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
If you are using build_simple_mem_ref then the pointer type has to be
"correct",
but you can simply build the MEM_REF with build2 giving it the desired
access type - the pointer type is irrelevant.  Note the TBAA relevant alias set
is represented in the offset operand.

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-08-11  7:24 ` rguenth at gcc dot gnu.org
@ 2021-08-11 22:20 ` bergner at gcc dot gnu.org
  2021-08-12 18:06 ` bergner at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-08-11 22:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> If you are using build_simple_mem_ref then the pointer type has to be
> "correct",
> but you can simply build the MEM_REF with build2 giving it the desired
> access type - the pointer type is irrelevant.  

Is there a benefit of one over the other?  ...other than the build2 code being
simpler since we'd just pass in the type we want.


> Note the TBAA relevant alias set is represented in the offset operand.

Is that something I need to (or should) set?  ...or is it handled
automatically?

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-08-11 22:20 ` bergner at gcc dot gnu.org
@ 2021-08-12 18:06 ` bergner at gcc dot gnu.org
  2021-08-19 22:34 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-08-12 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Peter Bergner from comment #4)
> Is there a benefit of one over the other?  ...other than the build2 code
> being simpler since we'd just pass in the type we want.

So the following seems to work which seems a little simpler than what I
submitted.  I'll test this along with a little beefier test case with multiple
offsets, with some not constant.

      tree ptr_t = build_pointer_type (vector_pair_type_node);
      tree mem = build2 (MEM_REF, vector_pair_type_node,
                         build2 (POINTER_PLUS_EXPR, ptr_t, ptr, offset),
                         build_int_cst (ptr_t, 0));

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-08-12 18:06 ` bergner at gcc dot gnu.org
@ 2021-08-19 22:34 ` cvs-commit at gcc dot gnu.org
  2021-09-02 19:09 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-19 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Peter Bergner <bergner@gcc.gnu.org>:

https://gcc.gnu.org/g:b0963c4379becafaebd8e52b0b42698ff151c293

commit r12-3034-gb0963c4379becafaebd8e52b0b42698ff151c293
Author: Peter Bergner <bergner@linux.ibm.com>
Date:   Thu Aug 19 17:33:29 2021 -0500

    rs6000: Fix ICE expanding lxvp and stxvp gimple built-ins [PR101849]

    PR101849 shows we ICE on a test case when we pass a non __vector_pair *
    pointer to the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
    that is cast to __vector_pair *.  The problem is that when we expand
    the built-in, the cast has already been removed from gimple and we are
    only given the base pointer.  The solution used here (which fixes the ICE)
    is to catch this case and convert the pointer to a __vector_pair * pointer
    when expanding the built-in.

    2021-08-19  Peter Bergner  <bergner@linux.ibm.com>

    gcc/
            PR target/101849
            * config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin):
Cast
            pointer to __vector_pair *.

    gcc/testsuite/
            PR target/101849
            * gcc.target/powerpc/pr101849.c: New test.

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-08-19 22:34 ` cvs-commit at gcc dot gnu.org
@ 2021-09-02 19:09 ` cvs-commit at gcc dot gnu.org
  2021-09-03  1:48 ` cvs-commit at gcc dot gnu.org
  2021-09-03  2:31 ` bergner at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-02 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Peter Bergner
<bergner@gcc.gnu.org>:

https://gcc.gnu.org/g:585667735e9fb7a38357a84d4d25206a8ccec576

commit r11-8951-g585667735e9fb7a38357a84d4d25206a8ccec576
Author: Peter Bergner <bergner@linux.ibm.com>
Date:   Thu Aug 19 17:33:29 2021 -0500

    rs6000: Fix ICE expanding lxvp and stxvp gimple built-ins [PR101849]

    PR101849 shows we ICE on a test case when we pass a non __vector_pair *
    pointer to the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
    that is cast to __vector_pair *.  The problem is that when we expand
    the built-in, the cast has already been removed from gimple and we are
    only given the base pointer.  The solution used here (which fixes the ICE)
    is to catch this case and convert the pointer to a __vector_pair * pointer
    when expanding the built-in.

    2021-08-19  Peter Bergner  <bergner@linux.ibm.com>

    gcc/
            PR target/101849
            * config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin):
Cast
            pointer to __vector_pair *.

    gcc/testsuite/
            PR target/101849
            * gcc.target/powerpc/pr101849.c: New test.

    (cherry picked from commit b0963c4379becafaebd8e52b0b42698ff151c293)

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-09-02 19:09 ` cvs-commit at gcc dot gnu.org
@ 2021-09-03  1:48 ` cvs-commit at gcc dot gnu.org
  2021-09-03  2:31 ` bergner at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-03  1:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Peter Bergner
<bergner@gcc.gnu.org>:

https://gcc.gnu.org/g:de2114d2f1792beae55dccb512c4c521b934e72b

commit r10-10091-gde2114d2f1792beae55dccb512c4c521b934e72b
Author: Peter Bergner <bergner@linux.ibm.com>
Date:   Thu Aug 19 17:33:29 2021 -0500

    rs6000: Fix ICE expanding lxvp and stxvp gimple built-ins [PR101849]

    PR101849 shows we ICE on a test case when we pass a non __vector_pair *
    pointer to the __builtin_vsx_lxvp and __builtin_vsx_stxvp built-ins
    that is cast to __vector_pair *.  The problem is that when we expand
    the built-in, the cast has already been removed from gimple and we are
    only given the base pointer.  The solution used here (which fixes the ICE)
    is to catch this case and convert the pointer to a __vector_pair * pointer
    when expanding the built-in.

    2021-08-19  Peter Bergner  <bergner@linux.ibm.com>

    gcc/
            PR target/101849
            * config/rs6000/rs6000-call.c (rs6000_gimple_fold_mma_builtin):
Cast
            pointer to __vector_pair *.

    gcc/testsuite/
            PR target/101849
            * gcc.target/powerpc/pr101849.c: New test.

    (cherry picked from commit b0963c4379becafaebd8e52b0b42698ff151c293)

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

* [Bug target/101849] MMA built-in dies with a verify_gimple failed error
  2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-09-03  1:48 ` cvs-commit at gcc dot gnu.org
@ 2021-09-03  2:31 ` bergner at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2021-09-03  2:31 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

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

--- Comment #9 from Peter Bergner <bergner at gcc dot gnu.org> ---
Fixed everywhere.

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

end of thread, other threads:[~2021-09-03  2:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 17:39 [Bug target/101849] New: MMA built-in dies with a verify_gimple failed error bergner at gcc dot gnu.org
2021-08-10 17:40 ` [Bug target/101849] " bergner at gcc dot gnu.org
2021-08-10 17:41 ` bergner at gcc dot gnu.org
2021-08-10 21:23 ` bergner at gcc dot gnu.org
2021-08-11  7:24 ` rguenth at gcc dot gnu.org
2021-08-11 22:20 ` bergner at gcc dot gnu.org
2021-08-12 18:06 ` bergner at gcc dot gnu.org
2021-08-19 22:34 ` cvs-commit at gcc dot gnu.org
2021-09-02 19:09 ` cvs-commit at gcc dot gnu.org
2021-09-03  1:48 ` cvs-commit at gcc dot gnu.org
2021-09-03  2:31 ` bergner 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).