public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/37997] PHI translation does not simplify to non-constants
       [not found] <bug-37997-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-19  6:21 ` pinskia at gcc dot gnu.org
  2012-01-19  9:44 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-19  6:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-19
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-19 06:01:51 UTC ---
Confirmed.


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

* [Bug tree-optimization/37997] PHI translation does not simplify to non-constants
       [not found] <bug-37997-4@http.gcc.gnu.org/bugzilla/>
  2012-01-19  6:21 ` [Bug tree-optimization/37997] PHI translation does not simplify to non-constants pinskia at gcc dot gnu.org
@ 2012-01-19  9:44 ` rguenth at gcc dot gnu.org
  2012-01-19 10:04 ` rguenth at gcc dot gnu.org
  2012-01-19 10:06 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-19  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 09:35:38 UTC ---
int foo (int i, int b)
{
  int mask;
  int result;
  if (b)
    mask = -1;
  else
    mask = 0;
  result = result & mask;
  return result;
}

actually works if you do not have result used uninitialized on the
path that sets mask to -1:

int foo (int i, int b, int result)
{
  int mask;
  if (b)
    mask = -1;
  else
    mask = 0;
  result = result & mask;
  return result;
}

is optimized to

<bb 2>:
  if (b_2(D) != 0)
    goto <bb 5>;
  else
    goto <bb 3>;

<bb 5>:
  pretmp.3_9 = result_5(D);
  goto <bb 4>;

<bb 3>:

<bb 4>:
  # mask_1 = PHI <-1(5), 0(3)>
  # prephitmp.4_10 = PHI <pretmp.3_9(5), 0(3)>
  result_6 = prephitmp.4_10;
  return result_6;

Likewise it works for

int foo (int i, int b)
{
  int mask;
  int result;
  if (b)
    mask = -1;
  else
    mask = 0;
  result = i + 1;
  result = result & mask;
  return result;
}

if you avoid the same error.  I don't think we want to consider
the uninitialized state of a variable to be available - we'd
insert "obvious" uninitialized uses and thus might expose them
to warnings.


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

* [Bug tree-optimization/37997] PHI translation does not simplify to non-constants
       [not found] <bug-37997-4@http.gcc.gnu.org/bugzilla/>
  2012-01-19  6:21 ` [Bug tree-optimization/37997] PHI translation does not simplify to non-constants pinskia at gcc dot gnu.org
  2012-01-19  9:44 ` rguenth at gcc dot gnu.org
@ 2012-01-19 10:04 ` rguenth at gcc dot gnu.org
  2012-01-19 10:06 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-19 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 09:38:04 UTC ---
Author: rguenth
Date: Thu Jan 19 09:37:58 2012
New Revision: 183297

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183297
Log:
2012-01-19  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/37997
    * gcc.dg/tree-ssa/ssa-pre-28.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-28.c
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug tree-optimization/37997] PHI translation does not simplify to non-constants
       [not found] <bug-37997-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-01-19 10:04 ` rguenth at gcc dot gnu.org
@ 2012-01-19 10:06 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-19 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 09:38:25 UTC ---
Fixed.


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

end of thread, other threads:[~2012-01-19  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-37997-4@http.gcc.gnu.org/bugzilla/>
2012-01-19  6:21 ` [Bug tree-optimization/37997] PHI translation does not simplify to non-constants pinskia at gcc dot gnu.org
2012-01-19  9:44 ` rguenth at gcc dot gnu.org
2012-01-19 10:04 ` rguenth at gcc dot gnu.org
2012-01-19 10:06 ` 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).