public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102570] New: missed fully redudant with internal function of add_overflow in FRE
@ 2021-10-02 22:53 pinskia at gcc dot gnu.org
  2021-10-04  7:13 ` [Bug tree-optimization/102570] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-02 22:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102570
           Summary: missed fully redudant with internal function of
                    add_overflow in FRE
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
bool f1(unsigned x, unsigned y, unsigned *res)
{
    bool t = __builtin_add_overflow(x, y, res);
    unsigned res1;
    bool t1 = __builtin_add_overflow(x, y, &res1);
    *res -= res1;
    return t==t1;
}

This should be optimized at fre1 but currently takes into DOM to optimize it to
just *res = 0; return 1;

FRE does not handle some of the internal functions.

Note this is different from PR 102569 but related.

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

* [Bug tree-optimization/102570] missed fully redudant with internal function of add_overflow in FRE
  2021-10-02 22:53 [Bug tree-optimization/102570] New: missed fully redudant with internal function of add_overflow in FRE pinskia at gcc dot gnu.org
@ 2021-10-04  7:13 ` rguenth at gcc dot gnu.org
  2021-10-04 14:52 ` cvs-commit at gcc dot gnu.org
  2021-10-04 14:54 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-04  7:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
FRE doesn't handle internal function calls at all (I think it ICEs, so
originally we just short-cut them).

Let me take a look.

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

* [Bug tree-optimization/102570] missed fully redudant with internal function of add_overflow in FRE
  2021-10-02 22:53 [Bug tree-optimization/102570] New: missed fully redudant with internal function of add_overflow in FRE pinskia at gcc dot gnu.org
  2021-10-04  7:13 ` [Bug tree-optimization/102570] " rguenth at gcc dot gnu.org
@ 2021-10-04 14:52 ` cvs-commit at gcc dot gnu.org
  2021-10-04 14:54 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-04 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:55a3be2f5255d69e740d61b2c5aaba1ccbc643b8

commit r12-4143-g55a3be2f5255d69e740d61b2c5aaba1ccbc643b8
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Oct 4 10:57:45 2021 +0200

    tree-optimization/102570 - teach VN about internal functions

    We're now using internal functions for a lot of stuff but there's
    still missing VN support out of laziness.  The following instantiates
    support and adds testcases for FRE and PRE (hoisting).

    2021-10-04  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/102570
            * tree-ssa-sccvn.h (vn_reference_op_struct): Document
            we are using clique for the internal function code.
            * tree-ssa-sccvn.c (vn_reference_op_eq): Compare the
            internal function code.
            (print_vn_reference_ops): Print the internal function code.
            (vn_reference_op_compute_hash): Hash it.
            (copy_reference_ops_from_call): Record it.
            (visit_stmt): Remove the restriction around internal function
            calls.
            (fully_constant_vn_reference_p): Use fold_const_call and handle
            internal functions.
            (vn_reference_eq): Compare call return types.
            * tree-ssa-pre.c (create_expression_by_pieces): Handle
            generating calls to internal functions.
            (compute_avail): Remove the restriction around internal function
            calls.

            * gcc.dg/tree-ssa/ssa-fre-96.c: New testcase.
            * gcc.dg/tree-ssa/ssa-pre-33.c: Likewise.

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

* [Bug tree-optimization/102570] missed fully redudant with internal function of add_overflow in FRE
  2021-10-02 22:53 [Bug tree-optimization/102570] New: missed fully redudant with internal function of add_overflow in FRE pinskia at gcc dot gnu.org
  2021-10-04  7:13 ` [Bug tree-optimization/102570] " rguenth at gcc dot gnu.org
  2021-10-04 14:52 ` cvs-commit at gcc dot gnu.org
@ 2021-10-04 14:54 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-04 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |12.0
         Resolution|---                         |FIXED

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

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

end of thread, other threads:[~2021-10-04 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 22:53 [Bug tree-optimization/102570] New: missed fully redudant with internal function of add_overflow in FRE pinskia at gcc dot gnu.org
2021-10-04  7:13 ` [Bug tree-optimization/102570] " rguenth at gcc dot gnu.org
2021-10-04 14:52 ` cvs-commit at gcc dot gnu.org
2021-10-04 14:54 ` 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).