Bug 34140 - [4.3 Regression] ICE in is_hidden_global_store, at tree-ssa-sink.c:207
Summary: [4.3 Regression] ICE in is_hidden_global_store, at tree-ssa-sink.c:207
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P1 normal
Target Milestone: 4.3.0
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2007-11-18 11:18 UTC by Martin Michlmayr
Modified: 2007-11-28 19:49 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.2
Known to fail:
Last reconfirmed: 2007-11-28 13:06:05


Attachments
preprocessed source (151.95 KB, application/octet-stream)
2007-11-18 11:20 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2007-11-18 11:18:50 UTC
With current trunk.  This was introduced between 20070916 and 20071020.

(sid)1687:tbm@em64t: ~] /usr/lib/gcc-snapshot/bin/gcc -c -O3 -Wall gnubg-rollout.c
gnubg-rollout.c: In function 'RolloutGeneral':
gnubg-rollout.c:15: internal compiler error: in is_hidden_global_store, at tree-ssa-sink.c:207
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Martin Michlmayr 2007-11-18 11:20:05 UTC
Created attachment 14575 [details]
preprocessed source
Comment 2 Martin Michlmayr 2007-11-18 11:20:22 UTC
/* Testcase by Martin Michlmayr <tbm@cyrius.com> */

typedef struct
{
  unsigned int fCubeful;
}
evalcontext;
typedef struct
{
  evalcontext aec[2];
  unsigned int fCubeful:1;
}
rolloutcontext;
void RolloutGeneral (int alternatives, int fCubeRollout, int et)
{
  int i;
  rolloutcontext rc;

  rc.fCubeful = rc.fCubeful;
  for (i = 0; i < alternatives; i++)
    if (et != 1)
      rc.aec[i].fCubeful = fCubeRollout || rc.fCubeful;
}
Comment 3 Richard Biener 2007-11-18 14:44:14 UTC
Confirmed.  Called from tree_ssa_dce_loop ().

# VUSE <rc_47, rc_47> { rc }
# rc_45 = VDEF <rc_45> { rc }
rc_45 = D.1197_49 != 0 ? rc_47 : rc_47

WTF?  tree if-conversion generates this crap.
Comment 4 Andrew Pinski 2007-11-20 09:08:44 UTC
(In reply to comment #3)
> WTF?  tree if-conversion generates this crap.

It split up the store to rc.aec[i].fCubeful .
Comment 5 Andrew Pinski 2007-11-20 09:13:14 UTC
Well I don't think ifcvt is fully to be blamed here:

  if (D.1542_49 != 0)
    goto <bb 13>;
  else
    goto <bb 12>;

<bb 12>:
  # prephitmp.14_44 = PHI <1(13), 0(11)>
  # rc_45 = PHI <rc_47(13), rc_47(11)>

Why do we have that last PHI anyways?  Unswitch creates it.
Comment 6 rakdver@kam.mff.cuni.cz 2007-11-20 13:56:48 UTC
Subject: Re:  [4.3 Regression] ICE in is_hidden_global_store, at tree-ssa-sink.c:207

> 
> 
> ------- Comment #5 from pinskia at gcc dot gnu dot org  2007-11-20 09:13 -------
> Well I don't think ifcvt is fully to be blamed here:
> 
>   if (D.1542_49 != 0)
>     goto <bb 13>;
>   else
>     goto <bb 12>;
> 
> <bb 12>:
>   # prephitmp.14_44 = PHI <1(13), 0(11)>
>   # rc_45 = PHI <rc_47(13), rc_47(11)>
> 
> Why do we have that last PHI anyways?  Unswitch creates it.

I think more important question is why we do not optimize it out (many
other optimizations, e.g. copy propagation, may create such phi nodes).
Comment 7 Jakub Jelinek 2007-11-28 19:48:33 UTC
Subject: Bug 34140

Author: jakub
Date: Wed Nov 28 19:48:19 2007
New Revision: 130494

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130494
Log:
	PR tree-optimization/34140
	* tree-if-conv.c (if_convertible_phi_p): Fail if BB other than
	loop->header has virtual phi nodes.

	* gcc.c-torture/compile/20071128-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/20071128-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-if-conv.c

Comment 8 Jakub Jelinek 2007-11-28 19:49:06 UTC
Fixed.