public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104322] New: Dead code in gcc/tree-vect-loop.cc
@ 2022-02-01 10:03 marxin at gcc dot gnu.org
  2022-02-01 10:31 ` [Bug tree-optimization/104322] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-02-01 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104322
           Summary: Dead code in gcc/tree-vect-loop.cc
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

I noticed the following dead code:
gcc/tree-vect-loop.cc:6643


  if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
    stmt_info = vect_stmt_to_vectorize (STMT_VINFO_REDUC_DEF (stmt_info));
  else
    {
      gcc_assert (STMT_VINFO_DEF_TYPE (stmt_info)
                  == vect_double_reduction_def);
      use_operand_p use_p;
      gimple *use_stmt;
      bool res = single_imm_use (gimple_phi_result (stmt_info->stmt),
                                 &use_p, &use_stmt);
      gcc_assert (res);
      phi_info = loop_vinfo->lookup_stmt (use_stmt);
      stmt_info = vect_stmt_to_vectorize (STMT_VINFO_REDUC_DEF (phi_info));
    }

  /* PHIs should not participate in patterns.  */
  gcc_assert (!STMT_VINFO_RELATED_STMT (phi_info));
  gphi *reduc_def_phi = as_a <gphi *> (phi_info->stmt);

  /* Verify following REDUC_IDX from the latch def leads us back to the PHI
     and compute the reduction chain length.  Discover the real
     reduction operation stmt on the way (stmt_info and slp_for_stmt_info).  */
  tree reduc_def
    = PHI_ARG_DEF_FROM_EDGE (reduc_def_phi,
                             loop_latch_edge
                               (gimple_bb (reduc_def_phi)->loop_father));
  unsigned reduc_chain_length = 0;
  bool only_slp_reduc_chain = true;
  stmt_info = NULL;

As seen the 2 assignments to stmt_info are dead.

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

* [Bug tree-optimization/104322] Dead code in gcc/tree-vect-loop.cc
  2022-02-01 10:03 [Bug tree-optimization/104322] New: Dead code in gcc/tree-vect-loop.cc marxin at gcc dot gnu.org
@ 2022-02-01 10:31 ` rguenth at gcc dot gnu.org
  2022-04-29  8:16 ` cvs-commit at gcc dot gnu.org
  2022-04-29  8:17 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-01 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2022-02-01
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Probably a left-over from some of the refactorings - the solution is to simply
remove the dead assignments and turn the if() into one for
vect_double_reduction_def.

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

* [Bug tree-optimization/104322] Dead code in gcc/tree-vect-loop.cc
  2022-02-01 10:03 [Bug tree-optimization/104322] New: Dead code in gcc/tree-vect-loop.cc marxin at gcc dot gnu.org
  2022-02-01 10:31 ` [Bug tree-optimization/104322] " rguenth at gcc dot gnu.org
@ 2022-04-29  8:16 ` cvs-commit at gcc dot gnu.org
  2022-04-29  8:17 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-29  8:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:7259481f0ece6283a6e2943448e8d28ffffc40f9

commit r13-29-g7259481f0ece6283a6e2943448e8d28ffffc40f9
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Feb 1 11:32:11 2022 +0100

    tree-optimization/104322 - remove dead code in vectorizable_reduction

    The PR points out dead code after previous refactoring.

    2022-02-01  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/104322
            * tree-vect-loop.cc (vectorizable_reduction): Remove dead code.

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

* [Bug tree-optimization/104322] Dead code in gcc/tree-vect-loop.cc
  2022-02-01 10:03 [Bug tree-optimization/104322] New: Dead code in gcc/tree-vect-loop.cc marxin at gcc dot gnu.org
  2022-02-01 10:31 ` [Bug tree-optimization/104322] " rguenth at gcc dot gnu.org
  2022-04-29  8:16 ` cvs-commit at gcc dot gnu.org
@ 2022-04-29  8:17 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-29  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2022-04-29  8:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 10:03 [Bug tree-optimization/104322] New: Dead code in gcc/tree-vect-loop.cc marxin at gcc dot gnu.org
2022-02-01 10:31 ` [Bug tree-optimization/104322] " rguenth at gcc dot gnu.org
2022-04-29  8:16 ` cvs-commit at gcc dot gnu.org
2022-04-29  8:17 ` 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).