public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108888] New: error: definition in block 26 follows the use
@ 2023-02-22 16:39 dcb314 at hotmail dot com
  2023-02-22 16:45 ` [Bug c++/108888] [13 Regression] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-22 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108888
           Summary: error: definition in block 26 follows the use
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this C++ code:

int scaleValueSaturate_scalefactor, scaleValueSaturate___trans_tmp_2,
    scaleValuesSaturate_i;
int scaleValueSaturate(int value) {
  int result = __builtin_clz(value);
  if (value)
    if (-result <= scaleValueSaturate_scalefactor)
      return 0;
  return scaleValueSaturate___trans_tmp_2;
}
short scaleValuesSaturate_dst;
short *scaleValuesSaturate_src;
void scaleValuesSaturate() {
  for (; scaleValuesSaturate_i; scaleValuesSaturate_i++)
    scaleValuesSaturate_dst =
        scaleValueSaturate(scaleValuesSaturate_src[scaleValuesSaturate_i]);
}

compiled with recent gcc trunk, does this:

[dcb36@fedora36 cvise]$ ~/gcc/results/bin/g++ -c -O1 bug887B.cc
[dcb36@fedora36 cvise]$ ~/gcc/results/bin/g++ -c -O2 bug887B.cc
bug887B.cc: In function ‘void scaleValuesSaturate()’:
bug887B.cc:12:6: error: definition in block 4 follows the use
   12 | void scaleValuesSaturate() {
      |      ^~~~~~~~~~~~~~~~~~~
for SSA_NAME: _25 in statement:
result_14 = .MASK_CALL (__builtin_clz, value.0_11, _25);
during GIMPLE pass: ifcvt
bug887B.cc:12:6: internal compiler error: verify_ssa failed
0x1316f05 verify_ssa(bool, bool)
        ../../trunk.d1/gcc/tree-ssa.cc:1211

The bug first seems to appear sometime between git hash g:a804419c89db9e1c
from yesterday and g:aee5ee35602e0098, from today.

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

* [Bug c++/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
@ 2023-02-22 16:45 ` mpolacek at gcc dot gnu.org
  2023-02-22 16:45 ` [Bug tree-optimization/108888] " mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-02-22 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
            Summary|error: definition in block  |[13 Regression] error:
                   |26 follows the use          |definition in block 26
                   |                            |follows the use
   Target Milestone|---                         |13.0
                 CC|                            |ams at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
           Priority|P3                          |P1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-6278-g3da77f217c8b20.

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

* [Bug tree-optimization/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
  2023-02-22 16:45 ` [Bug c++/108888] [13 Regression] " mpolacek at gcc dot gnu.org
@ 2023-02-22 16:45 ` mpolacek at gcc dot gnu.org
  2023-02-23  8:17 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-02-22 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-02-22
     Ever confirmed|0                           |1

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

* [Bug tree-optimization/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
  2023-02-22 16:45 ` [Bug c++/108888] [13 Regression] " mpolacek at gcc dot gnu.org
  2023-02-22 16:45 ` [Bug tree-optimization/108888] " mpolacek at gcc dot gnu.org
@ 2023-02-23  8:17 ` rguenth at gcc dot gnu.org
  2023-02-23 10:17 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-23  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|ams at gcc dot gnu.org             |rguenth at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 54513
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54513&action=edit
patch

The issue is that need_to_predicate is not set and thus we do

              /* Insert the predicate of the BB at the end of the BB
                 as this would reduce the register pressure: the only
                 use of this predicate will be in successor BBs.  */

we only get to rewrite the call because need_to_rewrite_undefined.  So
maybe we don't need to predicate this call at all?

Using GF_PLF_2 to mark predicated calls would be appropriate for example.

I'm testing the attached.

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

* [Bug tree-optimization/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-02-23  8:17 ` rguenth at gcc dot gnu.org
@ 2023-02-23 10:17 ` cvs-commit at gcc dot gnu.org
  2023-02-23 10:18 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-23 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:31cc5821223a096ef61743bff520f4a0dbba5872

commit r13-6296-g31cc5821223a096ef61743bff520f4a0dbba5872
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Feb 23 11:03:03 2023 +0100

    tree-optimization/108888 - call if-conversion

    The following makes sure to only predicate calls necessary.

            PR tree-optimization/108888
            * tree-if-conv.cc (if_convertible_stmt_p): Set PLF_2 on
            calls to predicate.
            (predicate_statements): Only predicate calls with PLF_2.

            * g++.dg/torture/pr108888.C: New testcase.

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

* [Bug tree-optimization/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2023-02-23 10:17 ` cvs-commit at gcc dot gnu.org
@ 2023-02-23 10:18 ` rguenth at gcc dot gnu.org
  2023-02-23 21:41 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-23 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug tree-optimization/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2023-02-23 10:18 ` rguenth at gcc dot gnu.org
@ 2023-02-23 21:41 ` pinskia at gcc dot gnu.org
  2023-04-03 13:01 ` avieira at gcc dot gnu.org
  2023-04-11  9:08 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-23 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |seurer at gcc dot gnu.org

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 108908 has been marked as a duplicate of this bug. ***

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

* [Bug tree-optimization/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2023-02-23 21:41 ` pinskia at gcc dot gnu.org
@ 2023-04-03 13:01 ` avieira at gcc dot gnu.org
  2023-04-11  9:08 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: avieira at gcc dot gnu.org @ 2023-04-03 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

avieira at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |avieira at gcc dot gnu.org

--- Comment #6 from avieira at gcc dot gnu.org ---
After this patch Andrew Stubbs patch
(https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3da77f217c8b2089ecba3eb201e727c3fcdcd19d)
to use in-branch simd-clones for cases like in
gcc/testsuite/gcc.dg/vect/vect-simd-clone-16.c no longer work.

I believe this is because this patch changes the 'if (gimple_call ..)' into a
else 'if (...is_gimple_call (stmt))' which doesn't work because stmt will be 0
(it's a dyn_cast of gassign).

I'm testing a patch locally to fix this.

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

* [Bug tree-optimization/108888] [13 Regression] error: definition in block 26 follows the use
  2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2023-04-03 13:01 ` avieira at gcc dot gnu.org
@ 2023-04-11  9:08 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-11  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andre Simoes Dias Vieira
<avieira@gcc.gnu.org>:

https://gcc.gnu.org/g:58c8c1b383bc3c286d6527fc6e8fb62463f9a877

commit r13-7135-g58c8c1b383bc3c286d6527fc6e8fb62463f9a877
Author: Andre Vieira <andre.simoesdiasvieira@arm.com>
Date:   Tue Apr 11 10:07:43 2023 +0100

    if-conv: Restore MASK_CALL conversion [PR108888]

    The original patch to fix this PR broke the if-conversion of calls into
    IFN_MASK_CALL.  This patch restores that original behaviour and makes sure
the
    tests added earlier specifically test inbranch SIMD clones.

    gcc/ChangeLog:

            PR tree-optimization/108888
            * tree-if-conv.cc (predicate_statements): Fix gimple call check.

    gcc/testsuite/ChangeLog:

            * gcc.dg/vect/vect-simd-clone-16.c: Make simd clone inbranch only.
            * gcc.dg/vect/vect-simd-clone-17.c: Likewise.
            * gcc.dg/vect/vect-simd-clone-18.c: Likewise.

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

end of thread, other threads:[~2023-04-11  9:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 16:39 [Bug c++/108888] New: error: definition in block 26 follows the use dcb314 at hotmail dot com
2023-02-22 16:45 ` [Bug c++/108888] [13 Regression] " mpolacek at gcc dot gnu.org
2023-02-22 16:45 ` [Bug tree-optimization/108888] " mpolacek at gcc dot gnu.org
2023-02-23  8:17 ` rguenth at gcc dot gnu.org
2023-02-23 10:17 ` cvs-commit at gcc dot gnu.org
2023-02-23 10:18 ` rguenth at gcc dot gnu.org
2023-02-23 21:41 ` pinskia at gcc dot gnu.org
2023-04-03 13:01 ` avieira at gcc dot gnu.org
2023-04-11  9:08 ` cvs-commit 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).