public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/53640] New: Missed cmove with stores
@ 2012-06-11 23:08 pinskia at gcc dot gnu.org
  2012-06-11 23:09 ` [Bug tree-optimization/53640] " pinskia at gcc dot gnu.org
  2012-06-12  9:29 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-06-11 23:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53640

             Bug #: 53640
           Summary: Missed cmove with stores
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


Take:
int f(int a, int *b)
{
  if (a >= 2)
    *b = 1;
  else
    *b = 0;

  return *b;
}

int f1(int a, int *b)
{
  int t;
  if (a >= 2)
    t = 1;
  else
    t = 0;
  *b = t;

  return *b;
}

---- CUT ----
Both of these are the same.  f1 will produce better code.


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

* [Bug tree-optimization/53640] Missed cmove with stores
  2012-06-11 23:08 [Bug tree-optimization/53640] New: Missed cmove with stores pinskia at gcc dot gnu.org
@ 2012-06-11 23:09 ` pinskia at gcc dot gnu.org
  2012-06-12  9:29 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-06-11 23:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53640

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Blocks|                            |26163

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-06-11 23:08:50 UTC ---
Shows up in gobmk in spec 2006:
      else if (distance[pos] == -1)
 under_control[pos] = 0;
      else
 under_control[pos] = 1;


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

* [Bug tree-optimization/53640] Missed cmove with stores
  2012-06-11 23:08 [Bug tree-optimization/53640] New: Missed cmove with stores pinskia at gcc dot gnu.org
  2012-06-11 23:09 ` [Bug tree-optimization/53640] " pinskia at gcc dot gnu.org
@ 2012-06-12  9:29 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-12  9:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53640

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-12 09:29:10 UTC ---
cond_if_else_store_replacement should do this, thus cselim.  But you need
-O3 as otherwise --param max-stores-to-sink is zero:

  /* Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion
     is disabled.  */
  if (!opts->x_flag_tree_vectorize || !opts->x_flag_tree_loop_if_convert)
    maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0,
                           opts->x_param_values, opts_set->x_param_values);


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

end of thread, other threads:[~2012-06-12  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 23:08 [Bug tree-optimization/53640] New: Missed cmove with stores pinskia at gcc dot gnu.org
2012-06-11 23:09 ` [Bug tree-optimization/53640] " pinskia at gcc dot gnu.org
2012-06-12  9:29 ` 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).