[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2016-01-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

Richard Biener  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #21 from Richard Biener  ---
Thus fixed.

[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2016-01-17 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

Arseny Solokha  changed:

   What|Removed |Added

 CC||asolokha at gmx dot com

--- Comment #20 from Arseny Solokha  ---
As it was fixed on trunk in 2012, it's actually fixed for every supported
release branch in 2016. Indeed, it's not reproducible from gcc 4.8 on anymore.

[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-11-28 Thread aldyh at gcc dot gnu.org


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



Aldy Hernandez aldyh at gcc dot gnu.org changed:



   What|Removed |Added



 Status|NEW |RESOLVED

 Resolution||FIXED



--- Comment #18 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-11-28 
20:56:44 UTC ---

fixed on trunk


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-11-28 Thread aldyh at gcc dot gnu.org


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



Aldy Hernandez aldyh at gcc dot gnu.org changed:



   What|Removed |Added



 Status|RESOLVED|REOPENED

 Resolution|FIXED   |



--- Comment #19 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-11-28 
20:58:06 UTC ---

My bad.  Didn't notice this was for 4.7.  Reopening.


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-24 Thread rguenth at gcc dot gnu.org


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



--- Comment #16 from Richard Guenther rguenth at gcc dot gnu.org 2012-09-24 
08:57:12 UTC ---

Author: rguenth

Date: Mon Sep 24 08:57:08 2012

New Revision: 191658



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=191658

Log:

2012-09-24  Richard Guenther  rguent...@suse.de



PR middle-end/52173

* gimple.c (gimple_copy): Properly mark the copy modified

if SSA operands are present.



* gcc.dg/tm/pr52173-1.c: New.

* gcc.dg/tm/pr52173-2.c: New.



Added:

trunk/gcc/testsuite/gcc.dg/tm/pr52173-1.c

trunk/gcc/testsuite/gcc.dg/tm/pr52173-2.c

Modified:

trunk/gcc/ChangeLog

trunk/gcc/gimple.c

trunk/gcc/testsuite/ChangeLog


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-24 Thread rguenth at gcc dot gnu.org


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



Richard Guenther rguenth at gcc dot gnu.org changed:



   What|Removed |Added



 Status|ASSIGNED|NEW

  Known to work||4.8.0

 AssignedTo|rguenth at gcc dot gnu.org  |unassigned at gcc dot

   ||gnu.org

  Known to fail||4.7.2



--- Comment #17 from Richard Guenther rguenth at gcc dot gnu.org 2012-09-24 
08:58:20 UTC ---

Fixed on trunk.


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-21 Thread rguenth at gcc dot gnu.org


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



Richard Guenther rguenth at gcc dot gnu.org changed:



   What|Removed |Added



 CC||srdjan.stipic at gmail dot

   ||com



--- Comment #12 from Richard Guenther rguenth at gcc dot gnu.org 2012-09-21 
08:55:25 UTC ---

*** Bug 54646 has been marked as a duplicate of this bug. ***


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-21 Thread rguenth at gcc dot gnu.org


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



--- Comment #13 from Richard Guenther rguenth at gcc dot gnu.org 2012-09-21 
12:39:19 UTC ---

Simpler testcase from PR54646, fails at -O2:



int a;



int main()

{

  int i;

  for (i = 0; i  1; ++i)

__transaction_atomic { ++a; }

  return 0;

}


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-21 Thread rguenth at gcc dot gnu.org


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



--- Comment #14 from Richard Guenther rguenth at gcc dot gnu.org 2012-09-21 
13:27:30 UTC ---

We have broken immediate uses of .MEM_2 (for example).  Before update-ssa:



main ()

{

  int a.1;

  int a.0;

  int i;



  bb 2:



  bb 8:

  # i_10 = PHI 0(2)

  # .MEM_11 = PHI .MEM_3(D)(2)



  bb 9:

  # .MEM_4 = VDEF .MEM_2

  __transaction_atomic  // SUBCODE=[ GTMA_HAVE_LOAD GTMA_HAVE_STORE ]

...

  bb 3:

  # .MEM_12 = VDEF .MEM_2

  __transaction_atomic  // SUBCODE=[ GTMA_HAVE_LOAD GTMA_HAVE_STORE ]

...

  bb 7:

  # VUSE .MEM_2

  return 0;



but debug_immediate_uses shows:



.MEM_2 : --2 uses.

# VUSE .MEM_2

return 0;

# .MEM_12 = VDEF .MEM_2

__transaction_atomic  // SUBCODE=[ GTMA_HAVE_LOAD GTMA_HAVE_STORE ]



that means that update_stmt didn't do its job or it wasn't called.



Aa.  Because in gimple_copy:



  /* Make copy of operands.  */

  if (num_ops  0)

{

...

  /* SSA operands need to be updated.  */

  gimple_set_modified (copy, true);

}



there are zero (real) operands but we _do_ have virtual ops.


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-21 Thread rguenth at gcc dot gnu.org


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



Richard Guenther rguenth at gcc dot gnu.org changed:



   What|Removed |Added



 Status|NEW |ASSIGNED

 AssignedTo|aldyh at gcc dot gnu.org|rguenth at gcc dot gnu.org



--- Comment #15 from Richard Guenther rguenth at gcc dot gnu.org 2012-09-21 
13:30:06 UTC ---

I have a patch:



Index: gcc/gimple.c

===

*** gcc/gimple.c(revision 191613)

--- gcc/gimple.c(working copy)

*** gimple_copy (gimple stmt)

*** 2333,2355 

  }



/* Make copy of operands.  */

!   if (num_ops  0)

! {

!   for (i = 0; i  num_ops; i++)

!   gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));



!   /* Clear out SSA operand vectors on COPY.  */

!   if (gimple_has_ops (stmt))

!   {

! gimple_set_def_ops (copy, NULL);

! gimple_set_use_ops (copy, NULL);

!   }



!   if (gimple_has_mem_ops (stmt))

!   {

! gimple_set_vdef (copy, gimple_vdef (stmt));

! gimple_set_vuse (copy, gimple_vuse (stmt));

!   }



/* SSA operands need to be updated.  */

gimple_set_modified (copy, true);

--- 2333,2352 

  }



/* Make copy of operands.  */

!   for (i = 0; i  num_ops; i++)

! gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));



!   if (gimple_has_mem_ops (stmt))

! {

!   gimple_set_vdef (copy, gimple_vdef (stmt));

!   gimple_set_vuse (copy, gimple_vuse (stmt));

! }



!   /* Clear out SSA operand vectors on COPY.  */

!   if (gimple_has_ops (stmt))

! {

!   gimple_set_def_ops (copy, NULL);

!   gimple_set_use_ops (copy, NULL);



/* SSA operands need to be updated.  */

gimple_set_modified (copy, true);


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-20 Thread rguenther at suse dot de


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



--- Comment #10 from rguenther at suse dot de rguenther at suse dot de 
2012-09-20 07:43:56 UTC ---

On Wed, 19 Sep 2012, aldyh at gcc dot gnu.org wrote:



 

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

 

 Aldy Hernandez aldyh at gcc dot gnu.org changed:

 

What|Removed |Added

 

  CC||amacleod at redhat dot com,

||dnovillo at gcc dot

||gnu.org, rguenth at gcc dot

||gnu.org

 

 --- Comment #9 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-09-19 
 19:44:14 UTC ---

 Richi, Diego.  Perhaps you can shed light on this.

 

 Here we have a loop unroll that triggers a virtual def operand missing... 
 for

 a GIMPLE_TRANSACTION:

 

 int vec[500];

 

 void func()

 {

 __transaction_relaxed

 {

   vec[123] = 456;

 }

 }

 

 main()

 {

   int i;

   for(i = 0; i  10; ++i)

 func();

 }

 

 The unroller wants to unroll into something like:

 

   bb 2:

   # .MEM_6 = VDEF .MEM_13

   __transaction_relaxed-- PROBLEMATIC INSN (VDEF's)

 

   bb 3:

   # .MEM_9 = VDEF .MEM_59

   vec[123] = 456;

   # .MEM_2 = VDEF .MEM_9

   __builtin__ITM_commitTransaction ();

 

   bb 4:

   ivtmp_14 = 9;

   # .MEM_11 = VDEF .MEM_13

   __transaction_relaxed

 

   bb 5:

   # .MEM_18 = VDEF .MEM_59

   vec[123] = 456;

   # .MEM_19 = VDEF .MEM_18

   __builtin__ITM_commitTransaction ();

 

 etc etc etc.

 

 Putting aside how incredibly inefficient this is... (We should be duplicating

 the vector store, not the entire transaction)...

 

 The problem here is that, after unrolling, the VDEF of the problematic insn is

 .MEM_6, but the DEF_OP of the insn is .MEM_59.  So gimple_vdef() !=

 gimple_vdef_op() and we trigger a virtual def operand missing for stmt.

 

 The problem is that the unroller's call to gimple_duplicate_bb() will make a

 copy of the problematic instruction, maintaining its gimple_vdef, but changing

 all its def_ops from under us, thus making gimple_vdef() != gimple_vdef_op().



Setting a DEF will change the vdef.  If it does not, the stmt was

not updated properly.



 Before loop unrolling we have this snippet that is about to be unrolled:

 

   bb 3:

   # .MEM_13 = PHI .MEM_8(6), .MEM_3(D)(2)

   # ivtmp_1 = PHI ivtmp_10(6), 10(2)

   # .MEM_6 = VDEF .MEM_13

   __transaction_relaxed

 

 After loop unrolling the above remains unchanged, but the following is 
 inserted

 *before* bb 3.  [Note, the following is after update_ssa(TODO_update_ssa), but

 before cleanup_tree_cfg() for clarity.]

 

  bb 8:

   # .MEM_12 = PHI .MEM_3(D)(2)

   # ivtmp_5 = PHI 10(2)

   # .MEM_6 = VDEF .MEM_13 -- *** --

     -- shouldn't this be .MEM_12 ?

 -- *** --



Yes.



   __transaction_relaxed

 ...

 ...more unrolling

 ...

  bb 40:

   # .MEM_57 = PHI .MEM_8(39)

   # ivtmp_58 = PHI ivtmp_10(39)

   # .MEM_53 = VDEF .MEM_13-- ** --

 -- shouldn't this be .MEM_57 

 -- ** --



Yes.



   __transaction_relaxed

 ...

 ...

  bb 3

  ..

 

 Notice that both BB8 and BB40 invalidate MEM_13 in its virtual definition. 

 Shouldn't the VDEF.MEM_13 be rewritten as I have indicated above?  
 Especially

 since now .MEM_13 is defined much further down in bb 3:

 

 bb 8

 # invalidates VDEF.MEM_13

 ...

 bb 40

 # invalidates VDEF.MEM_13

 ..

 bb 3

 # define .MEM_13  = 

 

 It seems gimple_duplicate_bb() renames all the phis and the operands, but does

 not update the VDEF's for the transaction. Gimple_duplicate_bb() says it

 doesn't maintain SSA form, so I assume this in on purpose (?).  So how is this

 supposed to be cleaned up?  Or is this even the problem?



The problem must be in the IL before unrolling I believe.



Richard.


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-20 Thread rguenth at gcc dot gnu.org


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



--- Comment #11 from Richard Guenther rguenth at gcc dot gnu.org 2012-09-20 
15:08:55 UTC ---

(In reply to comment #10)

 On Wed, 19 Sep 2012, aldyh at gcc dot gnu.org wrote:

 



  After loop unrolling the above remains unchanged, but the following is 
  inserted

  *before* bb 3.  [Note, the following is after update_ssa(TODO_update_ssa), 
  but

  before cleanup_tree_cfg() for clarity.]

  

   bb 8:

# .MEM_12 = PHI .MEM_3(D)(2)

# ivtmp_5 = PHI 10(2)

# .MEM_6 = VDEF .MEM_13 -- *** --

  -- shouldn't this be .MEM_12 ?

  -- *** --

 

 Yes.



Btw, is_new_name says yes to .MEM_12, false for .MEM_6 and 13.  update_ssa

should have adjusted the use .MEM_13 to .MEM_12, but it didn't for some

reason.



I see that the DEF stmt for .MEM_6 is



# .MEM_59 = VDEF .MEM_13

__transaction_relaxed  // SUBCODE=[ GTMA_HAVE_STORE ]



though before update_ssa.  That looks bogus to me.



Now I have to leave ... maybe the above is some hints to you (or I will

try to look further tomorrow).


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-19 Thread aldyh at gcc dot gnu.org


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



Aldy Hernandez aldyh at gcc dot gnu.org changed:



   What|Removed |Added



 CC||amacleod at redhat dot com,

   ||dnovillo at gcc dot

   ||gnu.org, rguenth at gcc dot

   ||gnu.org



--- Comment #9 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-09-19 
19:44:14 UTC ---

Richi, Diego.  Perhaps you can shed light on this.



Here we have a loop unroll that triggers a virtual def operand missing... for

a GIMPLE_TRANSACTION:



int vec[500];



void func()

{

__transaction_relaxed

{

  vec[123] = 456;

}

}



main()

{

  int i;

  for(i = 0; i  10; ++i)

func();

}



The unroller wants to unroll into something like:



  bb 2:

  # .MEM_6 = VDEF .MEM_13

  __transaction_relaxed-- PROBLEMATIC INSN (VDEF's)



  bb 3:

  # .MEM_9 = VDEF .MEM_59

  vec[123] = 456;

  # .MEM_2 = VDEF .MEM_9

  __builtin__ITM_commitTransaction ();



  bb 4:

  ivtmp_14 = 9;

  # .MEM_11 = VDEF .MEM_13

  __transaction_relaxed



  bb 5:

  # .MEM_18 = VDEF .MEM_59

  vec[123] = 456;

  # .MEM_19 = VDEF .MEM_18

  __builtin__ITM_commitTransaction ();



etc etc etc.



Putting aside how incredibly inefficient this is... (We should be duplicating

the vector store, not the entire transaction)...



The problem here is that, after unrolling, the VDEF of the problematic insn is

.MEM_6, but the DEF_OP of the insn is .MEM_59.  So gimple_vdef() !=

gimple_vdef_op() and we trigger a virtual def operand missing for stmt.



The problem is that the unroller's call to gimple_duplicate_bb() will make a

copy of the problematic instruction, maintaining its gimple_vdef, but changing

all its def_ops from under us, thus making gimple_vdef() != gimple_vdef_op().



Before loop unrolling we have this snippet that is about to be unrolled:



  bb 3:

  # .MEM_13 = PHI .MEM_8(6), .MEM_3(D)(2)

  # ivtmp_1 = PHI ivtmp_10(6), 10(2)

  # .MEM_6 = VDEF .MEM_13

  __transaction_relaxed



After loop unrolling the above remains unchanged, but the following is inserted

*before* bb 3.  [Note, the following is after update_ssa(TODO_update_ssa), but

before cleanup_tree_cfg() for clarity.]



 bb 8:

  # .MEM_12 = PHI .MEM_3(D)(2)

  # ivtmp_5 = PHI 10(2)

  # .MEM_6 = VDEF .MEM_13 -- *** --

    -- shouldn't this be .MEM_12 ?

-- *** --

  __transaction_relaxed

...

...more unrolling

...

 bb 40:

  # .MEM_57 = PHI .MEM_8(39)

  # ivtmp_58 = PHI ivtmp_10(39)

  # .MEM_53 = VDEF .MEM_13-- ** --

-- shouldn't this be .MEM_57 

-- ** --

  __transaction_relaxed

...

...

 bb 3

 ..



Notice that both BB8 and BB40 invalidate MEM_13 in its virtual definition. 

Shouldn't the VDEF.MEM_13 be rewritten as I have indicated above?  Especially

since now .MEM_13 is defined much further down in bb 3:



bb 8

# invalidates VDEF.MEM_13

...

bb 40

# invalidates VDEF.MEM_13

..

bb 3

# define .MEM_13  = 



It seems gimple_duplicate_bb() renames all the phis and the operands, but does

not update the VDEF's for the transaction. Gimple_duplicate_bb() says it

doesn't maintain SSA form, so I assume this in on purpose (?).  So how is this

supposed to be cleaned up?  Or is this even the problem?


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-14 Thread aldyh at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

--- Comment #8 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-09-14 
21:20:23 UTC ---
Created attachment 28195
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28195
reduced testcase

Further reduced testcase that triggers on either C/C++.


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-12 Thread aldyh at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

--- Comment #6 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-09-12 
19:52:55 UTC ---
I'll take a look.


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-09-12 Thread aldyh at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

--- Comment #6 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-09-12 
19:52:55 UTC ---
I'll take a look.

--- Comment #7 from Aldy Hernandez aldyh at gcc dot gnu.org 2012-09-12 
19:53:30 UTC ---
I'll take a look.


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-08-13 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2012-08-13
 CC||aldyh at gcc dot gnu.org,
   ||jakub at gcc dot gnu.org
 Ever Confirmed|0   |1


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-02-14 Thread regehr at cs dot utah.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

John Regehr regehr at cs dot utah.edu changed:

   What|Removed |Added

 CC||regehr at cs dot utah.edu

--- Comment #3 from John Regehr regehr at cs dot utah.edu 2012-02-15 03:50:18 
UTC ---
Smaller testcase in pure C for apparently the same problem.

[regehr@gamow 1]$ current-gcc -Ofast small.c
small.c: In function 'f':
small.c:3:6: error: definition in block 8 does not dominate use in block 9
for SSA_NAME: .MEM_22 in statement:
# .MEM_29 = VDEF .MEM_22
c[0] = c_I_lsm.9_32;
small.c:3:6: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.
[regehr@gamow 1]$ cat small.c
int a, b, c[10], d[10] = { 0, 0 };

void f (void) {
  for (a = 1; a = 4; a += 1)
d[a] = d[1];
  for (; b; ++b)
c[0] |= 1;
}
[regehr@gamow 1]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r184237-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r184237-install
--program-prefix=r184237- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20120214 (experimental) (GCC)


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-02-14 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

--- Comment #4 from Andrew Pinski pinskia at gcc dot gnu.org 2012-02-15 
03:53:52 UTC ---
(In reply to comment #3)
 Smaller testcase in pure C for apparently the same problem.

This is a different issue, Can you file a bug report about this one?


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-02-14 Thread regehr at cs dot utah.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

--- Comment #5 from John Regehr regehr at cs dot utah.edu 2012-02-15 03:58:22 
UTC ---
Sorry, see PR52255


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-02-08 Thread lloyd at randombit dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

--- Comment #1 from Jack Lloyd lloyd at randombit dot net 2012-02-08 15:52:19 
UTC ---
Created attachment 26615
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26615
Testcase


[Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm

2012-02-08 Thread lloyd at randombit dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173

Jack Lloyd lloyd at randombit dot net changed:

   What|Removed |Added

  Attachment #26615|0   |1
is obsolete||

--- Comment #2 from Jack Lloyd lloyd at randombit dot net 2012-02-08 15:54:25 
UTC ---
Created attachment 26616
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26616
Testcase

Elide the thread stuff from the testcase, doesn't affect the error