[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-10-04 Thread pinskia at gcc dot gnu dot org


--- Comment #33 from pinskia at gcc dot gnu dot org  2005-10-04 12:54 
---
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-10-03 Thread cvs-commit at gcc dot gnu dot org


--- Comment #32 from cvs-commit at gcc dot gnu dot org  2005-10-04 05:57 
---
Subject: Bug 23049

CVSROOT:/cvs/gcc
Module name:gcc
Changes by: [EMAIL PROTECTED]  2005-10-04 05:57:38

Modified files:
gcc: ChangeLog tree-ssa-dom.c 
gcc/doc: tree-ssa.texi 
gcc/testsuite  : ChangeLog 
gcc/testsuite/gcc.dg: ucnid-4.c 
Added files:
gcc/testsuite/gcc.dg: pr23049.c 

Log message:
2005-10-05  Steven Bosscher  <[EMAIL PROTECTED]>
gcc/
PR tree-optimization/23049
* tree-ssa-dom.c (thread_across_edge): Make sure that the condition
of a COND_EXPR is folded before calling fold on the whole rhs of a
conditional assignment.
* doc/tree-ssa.texi: Update the GIMPLE grammar for a valid rhs to
document that a COND_EXPR may appear there.

testsuite/
* gcc.dg/pr23049.c: New test.

* gcc.dg/ucnid-4.c: Fix test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10073&r2=2.10074
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-dom.c.diff?cvsroot=gcc&r1=2.128&r2=2.129
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/tree-ssa.texi.diff?cvsroot=gcc&r1=1.31&r2=1.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6130&r2=1.6131
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr23049.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/ucnid-4.c.diff?cvsroot=gcc&r1=1.3&r2=1.4


-- 


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



[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-26 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-26 
13:20 ---
This is also testsuite/gcc.c-torture/execute/builtin-bitops-1.c  failure with 
"-ftree-vectorize -maltivec" 
on powerpc-darwin, see 
http://gcc.gnu.org/ml/gcc-testresults/2005-09/msg01199.html
http://gcc.gnu.org/ml/gcc-testresults/2005-09/msg01201.html

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-20 Thread law at redhat dot com

--- Additional Comments From law at redhat dot com  2005-09-20 15:11 ---
Subject: Re:  [4.1 Regression] ICE with -O3
-ftree-vectorize on 4.1.x

On Sun, 2005-09-18 at 15:59 +, steven at gcc dot gnu dot org wrote:
> --- Additional Comments From steven at gcc dot gnu dot org  2005-09-18 
> 15:59 ---
> Actually fold_stmt has nothing to do with it.  It is fold (cached_lhs) in 
> trhead_across_edge that is the problem here.  Jeff, what do you think about 
> this patch? 
Presumably COND_EXPR on the RHS of a statement is the only special case
that we need to worry about.  I can't immediately think of others.

Seems pretty reasonable, in the case were the COND_EXPR_COND does not
fold, you could safely set pre_fold_lhs to TREE_OPERAND (stmt, 1) which
would allow us to catch cases where the THEN/ELSE clauses of the 
COND_EXPR are equivalent due to substitutions.  But I doubt it's
terribly important.

You might use pre_fold_expr rather than pre_fold_lhs which is a little
confusing since we're looking at the RHS of a statement :-)

jeff





-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-18 Thread steven at gcc dot gnu dot org

--- Additional Comments From steven at gcc dot gnu dot org  2005-09-18 
15:59 ---
Actually fold_stmt has nothing to do with it.  It is fold (cached_lhs) in 
trhead_across_edge that is the problem here.  Jeff, what do you think about 
this patch? 
 
Index: tree-ssa-dom.c 
=== 
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v 
retrieving revision 2.127 
diff -u -3 -p -r2.127 tree-ssa-dom.c 
--- tree-ssa-dom.c  2 Aug 2005 00:12:39 -   2.127 
+++ tree-ssa-dom.c  18 Sep 2005 15:57:22 - 
@@ -701,7 +701,7 @@ thread_across_edge (struct dom_walk_data 
   else 
{ 
  /* Copy the operands.  */ 
- tree *copy; 
+ tree *copy, prefold_lhs; 
  ssa_op_iter iter; 
  use_operand_p use_p; 
  unsigned int num, i = 0; 
@@ -725,12 +725,33 @@ thread_across_edge (struct dom_walk_data 
 
  /* Try to fold/lookup the new expression.  Inserting the 
 expression into the hash table is unlikely to help 
-simplify anything later, so just query the hashtable.  */ 
- cached_lhs = fold (TREE_OPERAND (stmt, 1)); 
- if (TREE_CODE (cached_lhs) != SSA_NAME 
- && !is_gimple_min_invariant (cached_lhs)) 
-   cached_lhs = lookup_avail_expr (stmt, false); 
+simplify anything later, so just query the hashtable. 
 
+Sadly, we have to handle conditional assignments specially 
+here, because fold expects all the operands of an expression 
+to be folded before the expression itself is folded, but we 
+can't just substitute the folded condition here.  */ 
+ if (TREE_CODE (TREE_OPERAND (stmt, 1)) == COND_EXPR) 
+   { 
+ tree cond = COND_EXPR_COND (TREE_OPERAND (stmt, 1)); 
+ cond = fold (cond); 
+ if (cond == boolean_true_node) 
+   prefold_lhs = COND_EXPR_THEN (TREE_OPERAND (stmt, 1)); 
+ else if (cond == boolean_false_node) 
+   prefold_lhs = COND_EXPR_ELSE (TREE_OPERAND (stmt, 1)); 
+ else 
+   prefold_lhs = NULL; 
+   } 
+ else 
+   prefold_lhs = TREE_OPERAND (stmt, 1); 
+ 
+ if (prefold_lhs) 
+   { 
+ cached_lhs = fold (prefold_lhs); 
+ if (TREE_CODE (cached_lhs) != SSA_NAME 
+ && !is_gimple_min_invariant (cached_lhs)) 
+   cached_lhs = lookup_avail_expr (stmt, false); 
+   } 
 
  /* Restore the statement's original uses/defs.  */ 
  i = 0; 
 

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-18 Thread steven at gcc dot gnu dot org

--- Additional Comments From steven at gcc dot gnu dot org  2005-09-18 
15:11 ---
Smaller test case: 
 
static unsigned short int crc_table[256]; 
void AC3_encode_init(void) 
{ 
  unsigned int c, n; 
  for (n = 0; n < 256; n++) 
  { 
c = n << 8; 
if (c & 16384) 
  c = c ^ 49155; 
crc_table[n] = c; 
  } 
} 
 

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-18 Thread steven at gcc dot gnu dot org

--- Additional Comments From steven at gcc dot gnu dot org  2005-09-18 
10:41 ---
Re. comment #24 -- I guess Devang didn't update fold_stmt and similar 
functions for the (still undocumented) modification to GIMPLE to make 
   >> valid. 
 

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread law at redhat dot com

--- Additional Comments From law at redhat dot com  2005-09-18 00:37 ---
Subject: Re:  [4.1 Regression] ICE with -O3
-ftree-vectorize on 4.1.x

On Sat, 2005-09-17 at 19:38 +, pinskia at physics dot uc dot edu
wrote:
> > --- Additional Comments From rguenth at tat dot physik dot 
> > uni-tuebingen dot de  2005-09-17 19:31 ---
> > Please fix the caller who is not folding the condition in the first place 
> > instead.
> 
>  we have "a = b == 0 ? 1 : 2;" before in DOM and then we replace b with
>  the value that DOM thinks is correct and then we have "0 == 0 ? 1 : 2;" 
> which is then
>  passed to fold
Is there some reason fold_stmt (which should have been called after the
replacement by DOM) didn't fold the conditional?

jeff




-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread steven at gcc dot gnu dot org

--- Additional Comments From steven at gcc dot gnu dot org  2005-09-17 
23:53 ---
It is hardly a DOM bug.  More an oversight.  Probably easily fixed. 
 
 

-- 
   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2005-07-24 15:37:30 |2005-09-17 23:53:02
   date||


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread pinskia at gcc dot gnu dot org


-- 
   What|Removed |Added

  BugsThisDependsOn||23936


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-17 
23:09 ---
I am not going to fix a DOM bug.

See http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01084.html for more discussion 
about this bug.

Though I wonder if I would not hit this bug in my tree combiner but I will 
handle that when I get there.

-- 
   What|Removed |Added

 AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
   |org |dot org
 Status|ASSIGNED|NEW


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread pinskia at physics dot uc dot edu

--- Additional Comments From pinskia at physics dot uc dot edu  2005-09-17 
19:38 ---
Subject: Re:  [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

> 
> 
> --- Additional Comments From rguenth at tat dot physik dot uni-tuebingen 
> dot de  2005-09-17 19:31 ---
> Please fix the caller who is not folding the condition in the first place 
> instead.

we have "a = b == 0 ? 1 : 2;" before in DOM and then we replace b with the 
value that DOM thinks is correct and then we have "0 == 0 ? 1 : 2;" which is 
then passed to fold



-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread rguenth at tat dot physik dot uni-tuebingen dot de

--- Additional Comments From rguenth at tat dot physik dot uni-tuebingen 
dot de  2005-09-17 19:31 ---
Please fix the caller who is not folding the condition in the first place 
instead.

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-17 
14:54 ---
I should note I need to test it still which is why I had not posted it yet.

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-17 
14:53 ---
Here is the patch:
Index: fold-const.c
===

RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.625
diff -u -p -r1.625 fold-const.c
--- fold-const.c9 Sep 2005 09:00:33 -   1.625
+++ fold-const.c17 Sep 2005 14:53:00 -
@@ -9953,6 +9953,8 @@ fold_ternary (enum tree_code code, tree 
   return NULL_TREE;
 
 case COND_EXPR:
+  /* Fold the condition operand, just in case it needs to be foldded.  */
+  arg0 = fold (arg0);
   /* Pedantic ANSI C says that a conditional expression is never an lvalue,
 so all simple results must be passed through pedantic_non_lvalue.  */
   if (TREE_CODE (arg0) == INTEGER_CST)

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-17 Thread drab at kepler dot fjfi dot cvut dot cz

--- Additional Comments From drab at kepler dot fjfi dot cvut dot cz  
2005-09-17 14:24 ---
(In reply to comment #16)
> I have a patch.

Excellent! Where is it?


-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-16 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-16 
23:34 ---
I have a patch.

-- 
   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-13 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-13 
14:05 ---
*** Bug 23858 has been marked as a duplicate of this bug. ***

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-09 Thread janis at gcc dot gnu dot org

--- Additional Comments From janis at gcc dot gnu dot org  2005-09-09 16:52 
---
The reduced testcase in comment #5 starts failing with this patch from rakdver:

  http://gcc.gnu.org/ml/gcc-cvs/2005-05/msg00814.html

-- 
   What|Removed |Added

 CC||rakdver at gcc dot gnu dot
   ||org


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-09-08 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-08 
20:14 ---
(In reply to comment #12)
> in fold but we don't try to fold 0 == 0 first.

And to confirm this, this is either a DOM or fold bug, fold is not considered 
recursive, maybe it should 
be in this case.

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-08-02 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-03 
00:49 ---
(In reply to comment #10)
> This is triggered by tree-ifcvt (which is enabled by -ftree-vectorize)

But it looks like not a vectorize or tree-ifcvt bug at all but a fold bug.

We get:
0 == 0 ? 0 : 3988292384

in fold but we don't try to fold 0 == 0 first.

-- 
   What|Removed |Added

 CC||law at gcc dot gnu dot org


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-08-01 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-01 
14:01 ---
*** Bug 23179 has been marked as a duplicate of this bug. ***

-- 
   What|Removed |Added

 CC||micis at gmx dot de


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-07-27 Thread dorit at il dot ibm dot com

--- Additional Comments From dorit at il dot ibm dot com  2005-07-27 10:38 
---
This is triggered by tree-ifcvt (which is enabled by -ftree-vectorize)


-- 
   What|Removed |Added

 CC||dpatel at apple dot com


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-07-24 Thread belyshev at depni dot sinp dot msu dot ru

--- Additional Comments From belyshev at depni dot sinp dot msu dot ru  
2005-07-24 16:13 ---
(In reply to comment #8)
> The reduced testcase for the second one:
to make it fail on amd64 one needs to change long -> int. and this testcase
started to fail at the same time as testcase in comment #5 .

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-07-24 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-24 
15:56 ---
The reduced testcase for the second one:
unsigned long CRCTab[256];
void InitCRC(void) {
  int I, J;
  unsigned long C;
  for (I=0; I<256; I++)
  {
for (C=I,J=0;J<8;J++)
  C=(C & 1) ? (C>>1)^0xEDB88320L : (C>>1);
CRCTab[I]=C;
  }
}


They do look like the same bug.

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-07-24 Thread belyshev at depni dot sinp dot msu dot ru

--- Additional Comments From belyshev at depni dot sinp dot msu dot ru  
2005-07-24 15:43 ---
(In reply to comment #5)
> Reduced testcase for the first one:

introduced between "2005-05-17 00:20 UTC" and "2005-05-18 00:20 UTC"

-- 


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-07-24 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-24 
15:40 ---
Note the backtrace is:
#5211 0x003f58d0 in fold_ternary (code=COND_EXPR, type=0x1e0e5b0, 
op0=0x1ee9d50, 
op1=0x1e18200, op2=0x1ee2080) at ../../gcc/fold-const.c:9905
#5212 0x003f8368 in fold_build3 (code=COND_EXPR, type=0x1e0e5b0, op0=0x1ee9d50, 
op1=0x1e18200, op2=0x1ee2080) at ../../gcc/fold-const.c:10375
#5213 0x003bb030 in fold_cond_expr_with_comparison (type=0x1e0e5b0, 
arg0=0x1ee9d50, 
arg1=0x1e18200, arg2=0x1ee2080) at ../../gcc/fold-const.c:4

-- 
   What|Removed |Added

   Target Milestone|--- |4.1.0


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-07-24 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-24 
15:37 ---
Reduced testcase for the first one:
static unsigned short int crc_table[256];
void AC3_encode_init(void)
{
  unsigned int c, n, k;
  for(n=0;  n<256; n++)
  {
c = n << 8;
for (k = 0; k < 8; k++)
{
  if (c & (1 << 15))
   c = ((c << 1) & 0x) ^ (((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16)) 
& 0x);
}
crc_table[n] = c;
  }
}


-- 
   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed||1
   Last reconfirmed|-00-00 00:00:00 |2005-07-24 15:37:30
   date||


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


[Bug tree-optimization/23049] [4.1 Regression] ICE with -O3 -ftree-vectorize on 4.1.x

2005-07-24 Thread pinskia at gcc dot gnu dot org


-- 
   What|Removed |Added

  Known to fail||4.1.0
  Known to work||4.0.0
Summary|ICE with -O3 -ftree-|[4.1 Regression] ICE with -
   |vectorize on 4.1.x  |O3 -ftree-vectorize on 4.1.x


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