[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple

2016-05-17 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

--- Comment #8 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Wed May 18 00:58:45 2016
New Revision: 236356

URL: https://gcc.gnu.org/viewcvs?rev=236356&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-05-17  Kugan Vivekanandarajah  

PR middle-end/63586
* gcc.dg/tree-ssa/pr63586-2.c: New test.
* gcc.dg/tree-ssa/pr63586.c: New test.
* gcc.dg/tree-ssa/reassoc-14.c: Adjust multiplication count.

gcc/ChangeLog:

2016-05-17  Kugan Vivekanandarajah  

PR middle-end/63586
* tree-ssa-reassoc.c (transform_add_to_multiply): New.
(reassociate_bb): Call transform_add_to_multiply.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-14.c
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple

2016-05-18 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

--- Comment #9 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Wed May 18 07:50:05 2016
New Revision: 236359

URL: https://gcc.gnu.org/viewcvs?rev=236359&root=gcc&view=rev
Log:
Adding the testcase which was not addaed as part of r236356.
gcc/testsuite/ChangeLog:

2016-05-17  Kugan Vivekanandarajah  

PR middle-end/63586
* gcc.dg/tree-ssa/pr63586-2.c: New test.
* gcc.dg/tree-ssa/pr63586.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr63586-2.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr63586.c

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-05-18 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

--- Comment #7 from kugan at gcc dot gnu.org ---
Created attachment 38519
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38519&action=edit
Another way to fix

Thanks Martin Liška for looking into this. I am attaching another way to fox
this. Testing ongoing and will update once the results are available.

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-05-18 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

--- Comment #8 from kugan at gcc dot gnu.org ---
My patch is not going to work.
At tree-ssa-reassoc.c:3897, we have:

stmt: 
_15 = _4 + c_7(D);

oe->op def_stmt:
_17 = c_7(D) * 3;


:
a1_6 = s_5(D) * 2;
_1 = (long int) a1_6;
x1_8 = _1 + c_7(D);
a2_9 = s_5(D) * 4;
_2 = (long int) a2_9;
a3_11 = s_5(D) * 6;
_3 = (long int) a3_11;
_16 = x1_8 + c_7(D);
_18 = _1 + _2;
_4 = _16 + _2;
_15 = _4 + c_7(D);
_17 = c_7(D) * 3;
x_13 = _15 + _3;
return x_13;


The root cause of this the place in which we are adding (_17 = c_7(D) * 3).
Finding the right place is not always straightforward as this case shows.

We could try  Martin Liška's approach.

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-05-18 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

--- Comment #9 from kugan at gcc dot gnu.org ---
We could also move _17 = c_7(D) * 3; at tree-ssa-reassoc.c:3897 satisfy the
gcc_assert. We could do this based on the use count of _17? any suggestions?

[Bug tree-optimization/71179] [7 Regression] ice fold_convert_loc, at fold-const.c:2360

2016-05-19 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71179

--- Comment #3 from kugan at gcc dot gnu.org ---
Created attachment 38521
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38521&action=edit
untested patch

[Bug tree-optimization/71179] [7 Regression] ice fold_convert_loc, at fold-const.c:2360

2016-05-21 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71179

--- Comment #4 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Sat May 21 07:09:16 2016
New Revision: 236554

URL: https://gcc.gnu.org/viewcvs?rev=236554&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-05-21  Kugan Vivekanandarajah  

PR middle-end/71179
* gcc.dg/tree-ssa/pr71179.c: New test.

gcc/ChangeLog:

2016-05-21  Kugan Vivekanandarajah  

PR middle-end/71179
* tree-ssa-reassoc.c (transform_add_to_multiply): Disallow float
VECTOR type.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71179.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/40921] missed optimization: x + (-y * z * z) => x - y * z * z

2016-05-22 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40921

--- Comment #5 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Sun May 22 08:13:13 2016
New Revision: 236564

URL: https://gcc.gnu.org/viewcvs?rev=236564&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-05-22  Kugan Vivekanandarajah  

PR middle-end/40921
* gcc.dg/tree-ssa/pr40921.c: New test.

gcc/ChangeLog:

2016-05-22  Kugan Vivekanandarajah  

PR middle-end/40921
* tree-ssa-reassoc.c (try_special_add_to_ops): New.
(linearize_expr_tree): Call try_special_add_to_ops.
(reassociate_bb): Convert MULT_EXPR by (-1) to NEGATE_EXPR.



Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr40921.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-05-23 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

--- Comment #10 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Tue May 24 00:14:13 2016
New Revision: 236619

URL: https://gcc.gnu.org/viewcvs?rev=236619&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-05-24  Kugan Vivekanandarajah  

PR middle-end/71170
* tree-ssa-reassoc.c (struct operand_entry): Add field stmt_to_insert.
(add_to_ops_vec): Add stmt_to_insert.
(add_repeat_to_ops_vec): Init stmt_to_insert.
(insert_stmt_before_use): New.
(transform_add_to_multiply): Remove mult_stmt insertion and add it to
ops vector.
(get_ops): Init stmt_to_insert.
(maybe_optimize_range_tests): Likewise.
(rewrite_expr_tree): Insert stmt_to_insert before use stmt.
(rewrite_expr_tree_parallel): Likewise.
(reassociate_bb): Likewise.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug middle-end/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-23 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #1 from kugan at gcc dot gnu.org ---
This looks like an issue with my reassociation commit. I will have a look.

[Bug middle-end/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-24 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #2 from kugan at gcc dot gnu.org ---
Created attachment 38549
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38549&action=edit
untested patch

testing this patch which fixes this.

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-24 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #4 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Tue May 24 10:50:01 2016
New Revision: 236634

URL: https://gcc.gnu.org/viewcvs?rev=236634&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-05-24  Kugan Vivekanandarajah  

PR middle-end/71252
* gfortran.dg/pr71252.f90: New test.

gcc/ChangeLog:

2016-05-24  Kugan Vivekanandarajah  

PR middle-end/71252
* tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Add stmt_to_insert
after
build_and_add_sum creates new use stmt.


Added:
trunk/gcc/testsuite/gfortran.dg/pr71252.f90
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71230] [7 Regression] ICE : in zero_one_operation, at tree-ssa-reassoc.c:1230

2016-05-24 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71230

--- Comment #15 from kugan at gcc dot gnu.org ---

> internal compiler error: Segmentation fault
> 0x1090f973 crash_signal
>   /home/seurer/gcc/gcc-test/gcc/toplev.c:333
> 0x10b12ca0 sort_by_operand_rank
>   /home/seurer/gcc/gcc-test/gcc/tree-ssa-reassoc.c:530
> 0x10b21863 vec::qsort(int (*)(void
> const*, void const*))
>   /home/seurer/gcc/gcc-test/gcc/vec.h:951
> 0x10b21863 vec::qsort(int (*)(void const*,
> void const*))
>   /home/seurer/gcc/gcc-test/gcc/vec.h:1698
> 0x10b21863 reassociate_bb
>   /home/seurer/gcc/gcc-test/gcc/tree-ssa-reassoc.c:5268
> 0x10b21037 reassociate_bb
>   /home/seurer/gcc/gcc-test/gcc/tree-ssa-reassoc.c:5389
> 0x10b21037 reassociate_bb
>   /home/seurer/gcc/gcc-test/gcc/tree-ssa-reassoc.c:5389
> 0x10b23eff do_reassoc
>   /home/seurer/gcc/gcc-test/gcc/tree-ssa-reassoc.c:5503
> 0x10b23eff execute_reassoc
>   /home/seurer/gcc/gcc-test/gcc/tree-ssa-reassoc.c:5590
> 0x10b23eff execute
>   /home/seurer/gcc/gcc-test/gcc/tree-ssa-reassoc.c:5629
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
This looks like what is fixed in r236673. Can you please give it a try with
this commit.

Thanks,
Kugan

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-25 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #8 from kugan at gcc dot gnu.org ---
Sorry for the breakage. I can reproduce this. I am looking into it.

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-25 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #9 from kugan at gcc dot gnu.org ---
What application is this testcase from? I have a patch which I want to try.

[Bug middle-end/71269] [7 Regression] segfault while compiling sqlite

2016-05-25 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71269

--- Comment #3 from kugan at gcc dot gnu.org ---
(In reply to Markus Trippelsdorf from comment #2)
> Started with r236634.

Hi Markus,

This looks like dup of PR71252. I have a patch for which I am testing now. Do
you have a preprocessed file I can test this.

Thanks,
Kugan

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-25 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #12 from kugan at gcc dot gnu.org ---
Posted patch at:
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02061.html

[Bug middle-end/71269] [7 Regression] segfault while compiling sqlite

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71269

--- Comment #8 from kugan at gcc dot gnu.org ---
(In reply to Roger Orr from comment #7)
> I've got a very similar problem, building valgrind with trunk revision
> 236644:
> 
> m_mallocfree.c: In function 'sanity_check_malloc_arena':
> m_mallocfree.c:1055:13: internal compiler error: Segmentation fault
>  static void sanity_check_malloc_arena ( ArenaId aid )
>  ^
> 0xbac3df crash_signal
> ../../gcc/toplev.c:333
> 0xd46249 sort_by_operand_rank
> ../../gcc/tree-ssa-reassoc.c:530
> 0xd52d83 reassociate_bb
> ../../gcc/tree-ssa-reassoc.c:5268
> 0xd51027 reassociate_bb
> ../../gcc/tree-ssa-reassoc.c:5389
> 0xd53f7a do_reassoc
> ../../gcc/tree-ssa-reassoc.c:5503
> 0xd53f7a execute_reassoc
> ../../gcc/tree-ssa-reassoc.c:5590
> 0xd53f7a execute
> ../../gcc/tree-ssa-reassoc.c:5629
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> 
> I've uploaded the preprocessed input and compiler output.

This Looks like what is fixed in r236673. Can you attach a per-processed src
please.

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #14 from kugan at gcc dot gnu.org ---
(In reply to Roger Orr from comment #13)
> The patch sadly does not appear to fix the (very similar looking) valgrind
> compilation failure I posted in pr71269.
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71269#c7

That looks like what is fixed in r236673. If you still have the issue, could
you attach a preprocessed src to reproduce please.

[Bug middle-end/71269] [7 Regression] segfault while compiling sqlite

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71269

--- Comment #10 from kugan at gcc dot gnu.org ---
(In reply to Markus Trippelsdorf from comment #9)
> (In reply to kugan from comment #8)
> > (In reply to Roger Orr from comment #7)
> > > I've got a very similar problem, building valgrind with trunk revision
> > > 236644:
> > > 
> > > m_mallocfree.c: In function 'sanity_check_malloc_arena':
> > > m_mallocfree.c:1055:13: internal compiler error: Segmentation fault
> > >  static void sanity_check_malloc_arena ( ArenaId aid )
> > >  ^
> > > 0xbac3df crash_signal
> > > ../../gcc/toplev.c:333
> > > 0xd46249 sort_by_operand_rank
> > > ../../gcc/tree-ssa-reassoc.c:530
> > > 0xd52d83 reassociate_bb
> > > ../../gcc/tree-ssa-reassoc.c:5268
> > > 0xd51027 reassociate_bb
> > > ../../gcc/tree-ssa-reassoc.c:5389
> > > 0xd53f7a do_reassoc
> > > ../../gcc/tree-ssa-reassoc.c:5503
> > > 0xd53f7a execute_reassoc
> > > ../../gcc/tree-ssa-reassoc.c:5590
> > > 0xd53f7a execute
> > > ../../gcc/tree-ssa-reassoc.c:5629
> > > Please submit a full bug report,
> > > with preprocessed source if appropriate.
> > > Please include the complete backtrace with any bug report.
> > > See <http://gcc.gnu.org/bugs.html> for instructions.
> > > 
> > > I've uploaded the preprocessed input and compiler output.
> > 
> > This Looks like what is fixed in r236673. Can you attach a per-processed src
> > please.
> 
> It is already attached.

Sorry, I missed that.

on x86-64-linux-gnu, with the current trunk:
./build/gcc/cc1 -O2 m_mallocfree.i 
./build/gcc/cc1 -O3 m_mallocfree.i
are working. What command line did you use to ICE ?

[Bug middle-end/71269] [7 Regression] segfault while compiling sqlite

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71269

--- Comment #12 from kugan at gcc dot gnu.org ---
(In reply to Markus Trippelsdorf from comment #11)
>  > Sorry, I missed that.
> > 
> > on x86-64-linux-gnu, with the current trunk:
> > ./build/gcc/cc1 -O2 m_mallocfree.i 
> > ./build/gcc/cc1 -O3 m_mallocfree.i
> > are working. What command line did you use to ICE ?
> 
> See the other attachment ;)
> I cannot reproduce the issue on current trunk.

Thanks for checking. I need some sleep now :)

[Bug bootstrap/71292] Bootstrap failure with segfault in tree-reassoc.c

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71292

--- Comment #1 from kugan at gcc dot gnu.org ---
(In reply to ktkachov from comment #0)
> An aarch64-none-linux-gnu bootstrap with an in-tree mpfr fails with an ICE:
> exp_2.i: In function ‘fn1’:
> exp_2.i:4:6: internal compiler error: Segmentation fault
>  void fn1() {
>   ^~~
> 0xb1f8cf crash_signal
> $SRC/gcc/toplev.c:333
> 0x89bcb9 bb_seq_addr
> $SRC/gcc/gimple.h:1655
> 0x89bcb9 gsi_start_bb
> $SRC/gcc/gimple-iterator.h:129
> 0x89bcb9 gsi_for_stmt(gimple*)
> $SRC/gcc/gimple-iterator.c:617
> 0xcbbeba insert_stmt_after
> $SRC/gcc/tree-ssa-reassoc.c:1323
> 0xcbd67a build_and_add_sum
> $SRC/gcc/tree-ssa-reassoc.c:1392
> 0xcbf34f rewrite_expr_tree_parallel
> $SRC/gcc/tree-ssa-reassoc.c:4128
> 0xcc8b95 reassociate_bb
> $SRC/gcc/tree-ssa-reassoc.c:5339
> 0xcc8ad7 reassociate_bb
> $SRC/gcc/tree-ssa-reassoc.c:5391
> 0xccb523 do_reassoc
> $SRC/gcc/tree-ssa-reassoc.c:5505
> 0xccb523 execute_reassoc
> $SRC/gcc/tree-ssa-reassoc.c:5592
> 0xccb523 execute
> $SRC/gcc/tree-ssa-reassoc.c:5631
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> 
> The reduced testcase for that reproducible with trunk at:
> gcc version 7.0.0 20160526 
> is:
> 
> unsigned long a;
> long b, d;
> int c;
> void fn1() {
>   unsigned long e = a + c;
>   b = d + e + a + 8;
> }
> 
> compile with -O2.
> Compiling with -fno-tree-reassoc doesn't ICE

It looks like dup of PR71252.

does the patch at help? 
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02076.html

[Bug bootstrap/71292] Bootstrap failure with segfault in tree-reassoc.c

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71292

--- Comment #2 from kugan at gcc dot gnu.org ---
(In reply to kugan from comment #1)
> (In reply to ktkachov from comment #0)
> > An aarch64-none-linux-gnu bootstrap with an in-tree mpfr fails with an ICE:
> > exp_2.i: In function ‘fn1’:
> > exp_2.i:4:6: internal compiler error: Segmentation fault
> >  void fn1() {
> >   ^~~
> > 0xb1f8cf crash_signal
> > $SRC/gcc/toplev.c:333
> > 0x89bcb9 bb_seq_addr
> > $SRC/gcc/gimple.h:1655
> > 0x89bcb9 gsi_start_bb
> > $SRC/gcc/gimple-iterator.h:129
> > 0x89bcb9 gsi_for_stmt(gimple*)
> > $SRC/gcc/gimple-iterator.c:617
> > 0xcbbeba insert_stmt_after
> > $SRC/gcc/tree-ssa-reassoc.c:1323
> > 0xcbd67a build_and_add_sum
> > $SRC/gcc/tree-ssa-reassoc.c:1392
> > 0xcbf34f rewrite_expr_tree_parallel
> > $SRC/gcc/tree-ssa-reassoc.c:4128
> > 0xcc8b95 reassociate_bb
> > $SRC/gcc/tree-ssa-reassoc.c:5339
> > 0xcc8ad7 reassociate_bb
> > $SRC/gcc/tree-ssa-reassoc.c:5391
> > 0xccb523 do_reassoc
> > $SRC/gcc/tree-ssa-reassoc.c:5505
> > 0xccb523 execute_reassoc
> > $SRC/gcc/tree-ssa-reassoc.c:5592
> > 0xccb523 execute
> > $SRC/gcc/tree-ssa-reassoc.c:5631
> > Please submit a full bug report,
> > with preprocessed source if appropriate.
> > Please include the complete backtrace with any bug report.
> > See <http://gcc.gnu.org/bugs.html> for instructions.
> > 
> > The reduced testcase for that reproducible with trunk at:
> > gcc version 7.0.0 20160526 
> > is:
> > 
> > unsigned long a;
> > long b, d;
> > int c;
> > void fn1() {
> >   unsigned long e = a + c;
> >   b = d + e + a + 8;
> > }
> > 
> > compile with -O2.
> > Compiling with -fno-tree-reassoc doesn't ICE
> 
> It looks like dup of PR71252.
> 
> does the patch at help? 
> https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02076.html

I can reproduce the error. With the patch from
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02076.html, I can bootstrap.
Please let me know if you still have any problem with the patch.

[Bug bootstrap/71292] Bootstrap failure with segfault in tree-reassoc.c

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71292

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #3 from kugan at gcc dot gnu.org ---
Dup of PR71252

*** This bug has been marked as a duplicate of bug 71252 ***

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ktkachov at gcc dot gnu.org

--- Comment #16 from kugan at gcc dot gnu.org ---
*** Bug 71292 has been marked as a duplicate of this bug. ***

[Bug middle-end/71269] [7 Regression] segfault while compiling sqlite

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71269

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #15 from kugan at gcc dot gnu.org ---
Duplicate of 71252

*** This bug has been marked as a duplicate of bug 71252 ***

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #17 from kugan at gcc dot gnu.org ---
*** Bug 71269 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #18 from kugan at gcc dot gnu.org ---
*** Bug 71284 has been marked as a duplicate of this bug. ***

[Bug middle-end/71284] [7 Regression] internal compiler error: Segmentation fault

2016-05-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71284

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||kugan at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #2 from kugan at gcc dot gnu.org ---
Duplicate of PR71252

*** This bug has been marked as a duplicate of bug 71252 ***

[Bug tree-optimization/71323] [7 Regression] ice in verify_ssa failed

2016-05-30 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71323

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #2 from kugan at gcc dot gnu.org ---
Duplicate of PR71252. Patch posted in
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg02298.html fixes this.

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-30 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #21 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Mon May 30 10:45:19 2016
New Revision: 236875

URL: https://gcc.gnu.org/viewcvs?rev=236875&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71252
* tree-ssa-reassoc.c (swap_ops_for_binary_stmt): Fix swap such that
all fields including stmt_to_insert are swapped.


gcc/testsuite/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71252
* gcc.dg/tree-ssa/pr71252-2.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71252-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71252] [7 Regression] ICE: verify_ssa failed : definition in block 7 does not dominate use in block 6

2016-05-30 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71252

--- Comment #22 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Mon May 30 10:47:57 2016
New Revision: 236876

URL: https://gcc.gnu.org/viewcvs?rev=236876&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71269
PR middle-end/71292
* gcc.dg/tree-ssa/pr71269.c: New test.
* gcc.dg/tree-ssa/pr71292.c: New test.

gcc/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71269
PR middle-end/71252
* tree-ssa-reassoc.c (insert_stmt_before_use): Use find_insert_point so
that inserted stmt will not dominate stmts that defines its operand.
(rewrite_expr_tree): Add stmt_to_insert before adding the use stmt.
(rewrite_expr_tree_parallel): Likewise.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71269.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71292.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug middle-end/71269] [7 Regression] segfault while compiling sqlite

2016-05-30 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71269

--- Comment #16 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Mon May 30 10:47:57 2016
New Revision: 236876

URL: https://gcc.gnu.org/viewcvs?rev=236876&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71269
PR middle-end/71292
* gcc.dg/tree-ssa/pr71269.c: New test.
* gcc.dg/tree-ssa/pr71292.c: New test.

gcc/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71269
PR middle-end/71252
* tree-ssa-reassoc.c (insert_stmt_before_use): Use find_insert_point so
that inserted stmt will not dominate stmts that defines its operand.
(rewrite_expr_tree): Add stmt_to_insert before adding the use stmt.
(rewrite_expr_tree_parallel): Likewise.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71269.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71292.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug bootstrap/71292] Bootstrap failure with segfault in tree-reassoc.c

2016-05-30 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71292

--- Comment #5 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Mon May 30 10:47:57 2016
New Revision: 236876

URL: https://gcc.gnu.org/viewcvs?rev=236876&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71269
PR middle-end/71292
* gcc.dg/tree-ssa/pr71269.c: New test.
* gcc.dg/tree-ssa/pr71292.c: New test.

gcc/ChangeLog:

2016-05-30  Kugan Vivekanandarajah  

PR middle-end/71269
PR middle-end/71252
* tree-ssa-reassoc.c (insert_stmt_before_use): Use find_insert_point so
that inserted stmt will not dominate stmts that defines its operand.
(rewrite_expr_tree): Add stmt_to_insert before adding the use stmt.
(rewrite_expr_tree_parallel): Likewise.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71269.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71292.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug target/71281] [7 Regression] ICE on gcc trunk on knl, wsm, ivb and bdw targets (tree-ssa-reassoc)

2016-06-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71281

--- Comment #4 from kugan at gcc dot gnu.org ---
Sorry about the breakage. Looking into it.

[Bug target/71281] [7 Regression] ICE on gcc trunk on knl, wsm, ivb and bdw targets (tree-ssa-reassoc)

2016-06-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71281

--- Comment #5 from kugan at gcc dot gnu.org ---
Created attachment 38640
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38640&action=edit
proposed patch

testing this patch.

[Bug target/71281] [7 Regression] ICE on gcc trunk on knl, wsm, ivb and bdw targets (tree-ssa-reassoc)

2016-06-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71281

--- Comment #6 from kugan at gcc dot gnu.org ---
Patch posted for review at
https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00316.html

[Bug tree-optimization/71408] [7 Regression] wrong code at -Os and above on x86_64-linux-gnu

2016-06-04 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71408

--- Comment #3 from kugan at gcc dot gnu.org ---
Looking into it. Looks like zero_one_operation is still broken.

[Bug tree-optimization/71408] [7 Regression] wrong code at -Os and above on x86_64-linux-gnu

2016-06-05 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71408

--- Comment #4 from kugan at gcc dot gnu.org ---
Patch posted for review at
https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00330.html

[Bug target/71281] [7 Regression] ICE on gcc trunk on knl, wsm, ivb and bdw targets (tree-ssa-reassoc)

2016-06-06 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71281

--- Comment #7 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Mon Jun  6 23:41:26 2016
New Revision: 237157

URL: https://gcc.gnu.org/viewcvs?rev=237157&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-06-07  Kugan Vivekanandarajah  

PR middle-end/71281
* tree-ssa-reassoc.c (reassociate_bb): Set uid for negate stmt.


gcc/testsuite/ChangeLog:

2016-06-07  Kugan Vivekanandarajah  

PR middle-end/71281
* g++.dg/torture/pr71281.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/torture/pr71281.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71408] [7 Regression] wrong code at -Os and above on x86_64-linux-gnu

2016-06-06 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71408

--- Comment #5 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Mon Jun  6 23:46:11 2016
New Revision: 237158

URL: https://gcc.gnu.org/viewcvs?rev=237158&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-06-07  Kugan Vivekanandarajah  

PR middle-end/71408
* tree-ssa-reassoc.c (zero_one_operation): Fix NEGATE_EXPR operand for
propagate_op_to_single_use.


gcc/testsuite/ChangeLog:

2016-06-07  Kugan Vivekanandarajah  

PR middle-end/71408
* gcc.dg/tree-ssa/pr71408.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr71408.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71478] [7 Regression] ICE in tree-ssa-reassoc.c after r236564

2016-06-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71478

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #2 from kugan at gcc dot gnu.org ---
Sorry for the breakage. Patch that fixes this is posted for review at:
https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00768.html

[Bug target/71281] [7 Regression] ICE on gcc trunk on knl, wsm, ivb and bdw targets (tree-ssa-reassoc)

2016-06-10 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71281

--- Comment #9 from kugan at gcc dot gnu.org ---
(In reply to Anton Mitrokhin from comment #8)
> Is this fixed?

Yes. Is this still not working for you?

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-06-10 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

--- Comment #15 from kugan at gcc dot gnu.org ---
(In reply to David Binderman from comment #14)
> (In reply to Jakub Jelinek from comment #12)
> > Is it still broken?
> 
> I think so. Attachment seems to break svn 237286, dated today.

The issue with tree-reassoc is fixed now. Attached code ICE with
-fno-tree-reassoc also. Here is reduced testcase that shows the current ICE. I
think we should close this PR and create a new one for this.

cat b.c
struct {
  int error;
} *a;

extern int fz_push_try ();
int pdf_page_render() { return fz_push_try() && (a->error = __sigsetjmp()); }

./gcc/cc1 -O2 b.c -fno-tree-reassoc
 pdf_page_render
b.c: In function ‘pdf_page_render’:
b.c:6:61: warning: implicit declaration of function ‘__sigsetjmp’
[-Wimplicit-function-declaration]
 int pdf_page_render() { return fz_push_try() && (a->error = __sigsetjmp()); }
 ^~~

Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data>  b.c:6:1: error: definition in
block 4 does not dominate use in block 5
 int pdf_page_render() { return fz_push_try() && (a->error = __sigsetjmp()); }
 ^~~
for SSA_NAME: a.1_2 in statement:
# .MEM_14 = VDEF <.MEM_13>
a.1_2->error = _3;
b.c:6:1: internal compiler error: verify_ssa failed
0xdacfab verify_ssa(bool, bool)
../../test/gcc/tree-ssa.c:1039
0xac3c87 execute_function_todo
../../test/gcc/passes.c:1971
0xac2ce7 do_per_function
../../test/gcc/passes.c:1648
0xac3e1c execute_todo
../../test/gcc/passes.c:2016
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug tree-optimization/71478] [7 Regression] ICE in tree-ssa-reassoc.c after r236564

2016-06-10 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71478

--- Comment #3 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Fri Jun 10 21:57:01 2016
New Revision: 237318

URL: https://gcc.gnu.org/viewcvs?rev=237318&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-06-11  Kugan Vivekanandarajah  

PR middle-end/71478
* gcc.dg/pr71478.c: New test.

gcc/ChangeLog:

2016-06-11  Kugan Vivekanandarajah  

PR middle-end/71478
* tree-ssa-reassoc.c (reassociate_bb): Remove (-1) from ops list for
vector integer type.


Added:
trunk/gcc/testsuite/gcc.dg/pr71478.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71478] [7 Regression] ICE in tree-ssa-reassoc.c after r236564

2016-06-10 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71478

--- Comment #4 from kugan at gcc dot gnu.org ---
Fixed.

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-06-11 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

--- Comment #16 from kugan at gcc dot gnu.org ---
(In reply to kugan from comment #10)
> Author: kugan
> Date: Tue May 24 00:14:13 2016
> New Revision: 236619
> 
> URL: https://gcc.gnu.org/viewcvs?rev=236619&root=gcc&view=rev
> Log:
> gcc/ChangeLog:
> 
> 2016-05-24  Kugan Vivekanandarajah  
> 
>   PR middle-end/71170
>   * tree-ssa-reassoc.c (struct operand_entry): Add field stmt_to_insert.
>   (add_to_ops_vec): Add stmt_to_insert.
>   (add_repeat_to_ops_vec): Init stmt_to_insert.
>   (insert_stmt_before_use): New.
>   (transform_add_to_multiply): Remove mult_stmt insertion and add it to 
> ops
> vector.
>   (get_ops): Init stmt_to_insert.
>   (maybe_optimize_range_tests): Likewise.
>   (rewrite_expr_tree): Insert stmt_to_insert before use stmt.
>   (rewrite_expr_tree_parallel): Likewise.
>   (reassociate_bb): Likewise.
> 
> 
> Modified:
> trunk/gcc/ChangeLog
> trunk/gcc/tree-ssa-reassoc.c

Bisecting seems to point r235817 for this.

[Bug tree-optimization/71170] [7 Regression] ICE in rewrite_expr_tree, at tree-ssa-reassoc.c:3898

2016-06-11 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71170

--- Comment #17 from kugan at gcc dot gnu.org ---
(In reply to kugan from comment #15)
> (In reply to David Binderman from comment #14)
> > (In reply to Jakub Jelinek from comment #12)
> > > Is it still broken?
> > 
> > I think so. Attachment seems to break svn 237286, dated today.
> 
> The issue with tree-reassoc is fixed now. Attached code ICE with
> -fno-tree-reassoc also. Here is reduced testcase that shows the current ICE.
> I think we should close this PR and create a new one for this.
> 
> cat b.c
> struct {
>   int error;
> } *a;
> 
> extern int fz_push_try ();
> int pdf_page_render() { return fz_push_try() && (a->error = __sigsetjmp()); }
> 
> ./gcc/cc1 -O2 b.c -fno-tree-reassoc
>  pdf_page_render
> b.c: In function ‘pdf_page_render’:
> b.c:6:61: warning: implicit declaration of function ‘__sigsetjmp’
> [-Wimplicit-function-declaration]
>  int pdf_page_render() { return fz_push_try() && (a->error = __sigsetjmp());
> }
>  ^~~
> 
> Analyzing compilation unit
> Performing interprocedural optimizations
>  <*free_lang_data>  b.c:6:1: error: definition
> in block 4 does not dominate use in block 5
>  int pdf_page_render() { return fz_push_try() && (a->error = __sigsetjmp());
> }
>  ^~~
> for SSA_NAME: a.1_2 in statement:
> # .MEM_14 = VDEF <.MEM_13>
> a.1_2->error = _3;
> b.c:6:1: internal compiler error: verify_ssa failed
> 0xdacfab verify_ssa(bool, bool)
>   ../../test/gcc/tree-ssa.c:1039
> 0xac3c87 execute_function_todo
>   ../../test/gcc/passes.c:1971
> 0xac2ce7 do_per_function
>   ../../test/gcc/passes.c:1648
> 0xac3e1c execute_todo
>   ../../test/gcc/passes.c:2016
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.

This new issue is duplicate of PR71104 and started with r235817. This PR which
is about tree-reassoc is fixed and can be closed.

[Bug tree-optimization/66726] missed optimization, factor conversion out of COND_EXPR

2016-07-24 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66726

--- Comment #19 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Sun Jul 24 12:47:29 2016
New Revision: 238695

URL: https://gcc.gnu.org/viewcvs?rev=238695&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-07-24  Kugan Vivekanandarajah  

PR middle-end/66726
* tree-ssa-reassoc.c (optimize_vec_cond_expr): Handle tcc_compare stmt
whose result is used in PHI.
(final_range_test_p): Likewise.
(maybe_optimize_range_tests): Likewise.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71994] [7 Regression] ICE: verify_gimple failed

2016-07-25 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71994

--- Comment #2 from kugan at gcc dot gnu.org ---
Patch to fix this is posted for review at
https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01680.html

[Bug tree-optimization/71994] [7 Regression] ICE: verify_gimple failed

2016-07-27 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71994

--- Comment #4 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Wed Jul 27 22:45:46 2016
New Revision: 238802

URL: https://gcc.gnu.org/viewcvs?rev=238802&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-07-28  Kugan Vivekanandarajah  

PR middle-end/71994
* gcc.dg/torture/pr71994.c: New test.

gcc/ChangeLog:

2016-07-28  Kugan Vivekanandarajah  

PR middle-end/71994
* tree-ssa-reassoc.c (maybe_optimize_range_tests): Check tcc_comparison
 before calling get_ops.



Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/71994] [7 Regression] ICE: verify_gimple failed

2016-07-27 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71994

--- Comment #5 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Wed Jul 27 23:02:44 2016
New Revision: 238803

URL: https://gcc.gnu.org/viewcvs?rev=238803&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-07-28  Kugan Vivekanandarajah  

PR middle-end/71994
* gcc.dg/torture/pr71994.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/torture/pr71994.c

[Bug rtl-optimization/68217] Wrong constant folding

2016-07-28 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

--- Comment #4 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Fri Jul 29 00:35:23 2016
New Revision: 238846

URL: https://gcc.gnu.org/viewcvs?rev=238846&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-07-29  Kugan Vivekanandarajah  

PR middle-end/68217
* tree-vrp.c (extract_range_from_binary_expr_1): In case of signed
& sign-bit-CST, generate [-INF, 0] instead of [-INF, INF].


gcc/testsuite/ChangeLog:

2016-07-29  Kugan Vivekanandarajah  

PR middle-end/68217
* gcc.dg/pr68217.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr68217.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c

[Bug tree-optimization/72835] [7 Regression] Incorrect arithmetic optimization involving bitfield arguments

2016-08-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72835

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #3 from kugan at gcc dot gnu.org ---
Looking into it. 

diff of .115t.dse2 and .116t.reassoc1 is for the c++ testcase:

+  unsigned int _16;
+  unsigned int _17;
+  unsigned int _18;

   :
   _1 = s1.m2;
   _2 = (unsigned int) _1;
   _3 = s1.m3;
   _4 = (unsigned int) _3;
-  _5 = -_4;
-  _6 = _2 * _5;
+  _5 = _4;
+  _6 = _5 * _2;
   var_32.0_7 = var_32;
   _8 = (unsigned int) var_32.0_7;
   _9 = s1.m1;
   _10 = (unsigned int) _9;
-  _11 = -_10;
-  _12 = _8 * _11;
-  c_14 = _6 + _12;
+  _11 = _10;
+  _12 = _11 * _8;
+  _16 = _12 + _6;
+  _18 = _16;
+  _17 = -_18;
+  c_14 = _17;
   if (c_14 != 4098873984)


Also works with -fno-tree-vrp

[Bug tree-optimization/72835] [7 Regression] Incorrect arithmetic optimization involving bitfield arguments

2016-08-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72835

--- Comment #4 from kugan at gcc dot gnu.org ---
Looks like it was a latent issue. In rewrite_expr_tree, when re-associate
operands, we should reset range_info for the LHS. We don’t do that now.
Following patch fixes the test case. 


diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 7fd7550..6272d98 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -3945,6 +3945,7 @@ rewrite_expr_tree (gimple *stmt, unsigned int opindex,
  gimple_assign_set_rhs1 (stmt, oe1->op);
  gimple_assign_set_rhs2 (stmt, oe2->op);
  update_stmt (stmt);
+ reset_flow_sensitive_info (lhs);
}

  if (rhs1 != oe1->op && rhs1 != oe2->op)


I think we also need to do the same in rewrite_expr_tree_parallel.

[Bug tree-optimization/66726] missed optimization, factor conversion out of COND_EXPR

2016-02-11 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66726

--- Comment #16 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Fri Feb 12 00:24:22 2016
New Revision: 233362

URL: https://gcc.gnu.org/viewcvs?rev=233362&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-02-12  Kugan Vivekanandarajah  

PR middle-end/66726
* tree-ssa-reassoc.c (optimize_range_tests): Handle tcc_compare stmt
whose result is used in PHI.
(maybe_optimize_range_tests): Likewise.
(final_range_test_p): Likweise.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug ipa/69708] ipa inline not working for function reference in static const struct

2016-02-11 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69708

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #2 from kugan at gcc dot gnu.org ---
In ipa-prop.c, function ipa_compute_jump_functions_for_edge called from
determine_locally_known_aggregate_parts doesn't compute jump functions for
aggregates when they are initialized during definition.

If I change the testcase to following, it works.

typedef struct F {
int (*call)(int);
} F;

static int g(F f, int x) {
x = f.call(x);
x = f.call(x);
x = f.call(x);
x = f.call(x);
x = f.call(x);
x = f.call(x);
x = f.call(x);
x = f.call(x);
return x;
}

static int sq(int x) {
return x * x;
}

static F f = {sq};
//static const F f = {sq};

void dosomething(int);

int h(int x) {
f.call = sq;
dosomething(g(f, x));
dosomething(g((F){sq}, x));
}

I guess, for the varpool_node corresponding to static const F f = {sq};, we
have to check hat the initialization are constant and create the jump function.

I still haven't figured out how I can get the initialization list for the
structure. Any pointers?

varpool_node *node = varpool_node::get (arg); should get me to the varpool
node.

[Bug tree-optimization/66726] missed optimization, factor conversion out of COND_EXPR

2016-02-11 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66726

--- Comment #17 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Fri Feb 12 06:40:55 2016
New Revision: 233368

URL: https://gcc.gnu.org/viewcvs?rev=233368&root=gcc&view=rev
Log:
2016-02-12  Kugan Vivekanandarajah  

revert:
2016-02-12  Kugan Vivekanandarajah  

PR middle-end/66726
* tree-ssa-reassoc.c (optimize_range_tests): Handle tcc_compare stmt
whose result is used in PHI.
(maybe_optimize_range_tests): Likewise.
(final_range_test_p): Likweise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug ipa/69708] ipa inline not working for function reference in static const struct

2016-02-13 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69708

--- Comment #3 from kugan at gcc dot gnu.org ---
Created attachment 37685
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37685&action=edit
possible fix

Attached patch fixes the testcase.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #11 from kugan at gcc dot gnu.org ---
In remove_unreachable_nodes, just before ipa-cp, this node becomes local
(address taken is false and local.local = true). After that, when
ipa_propagate_frequency is run, which updates the frequency to zero. I think we
should check the frequency at this point in time and remove such nodes.

[Bug ipa/69589] [6 Regression] ICE in initialize_node_lattices, at ipa-cp.c:971

2016-02-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69589

--- Comment #12 from kugan at gcc dot gnu.org ---
Created attachment 37688
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37688&action=edit
possible fix

This fixes the testcase.

[Bug c/69819] ICE on invalid code on x86_64-linux-gnu in tree check: expected function_type or method_type, have array_type in function_args_iter_init, at tree.h:4536

2016-02-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69819

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #1 from kugan at gcc dot gnu.org ---
It looks like a C front-end bug.It should be able to see that "foo" is already
defined and flag an error. C++ front-end does just that.

[Bug tree-optimization/66726] missed optimization, factor conversion out of COND_EXPR

2016-02-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66726

--- Comment #18 from kugan at gcc dot gnu.org ---
Reverted r233362 as it caused PR69786 and PR69781. I will test for these and
post a revised patch for next stage1.

[Bug target/70359] [6 Regression] Code size increase for ARM compared to gcc-5.3.0

2016-03-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70359

--- Comment #10 from kugan at gcc dot gnu.org ---
I am looking into it.  -mcpu=arm966e-s does not uses the
TARGET_NEW_GENERIC_COSTS. i.e, the rtx costs setup by the back-end might not be
optimal.

[Bug target/70359] [6 Regression] Code size increase for ARM compared to gcc-5.3.0

2016-03-27 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70359

--- Comment #11 from kugan at gcc dot gnu.org ---
Optimized gimple diff between 5.3 and trunk is :

-;; Function inttostr (inttostr, funcdef_no=0, decl_uid=5268, cgraph_uid=0,
symbol_order=0)
+;; Function inttostr (inttostr, funcdef_no=0, decl_uid=4222, cgraph_uid=0,
symbol_order=0)

 Removing basic block 7
 Removing basic block 8
@@ -43,7 +43,7 @@
 goto ;

   :
-  p_22 = p_2 + 4294967294;
+  p_22 = p_16 + 4294967295;
   MEM[(char *)p_16 + 4294967295B] = 45;

   :

[Bug target/70359] [6 Regression] Code size increase for ARM compared to gcc-5.3.0

2016-03-27 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70359

--- Comment #12 from kugan at gcc dot gnu.org ---
However, diff of cfgexand is significantly different:
 ;; Full RTL generated for this function:
 ;;
32: NOTE_INSN_DELETED
-   38: NOTE_INSN_BASIC_BLOCK 2
+   39: NOTE_INSN_BASIC_BLOCK 2
33: r151:SI=r0:SI
34: r152:SI=r1:SI
35: r153:SI=r2:SI
36: NOTE_INSN_FUNCTION_BEG
-   40: {r141:SI=abs(r151:SI);clobber cc:CC;}
-   41: r154:SI=r153:SI-0x1
-   42: r142:SI=r152:SI+r154:SI
-   43: r155:SI=0
-   44: r156:QI=r155:SI#0
-   45: [r142:SI]=r156:QI
-   61: L61:
-   46: NOTE_INSN_BASIC_BLOCK 4
-   47: r142:SI=r142:SI-0x1
-   48: r1:SI=0xa
-   49: r0:SI=r141:SI
-   50: r0:DI=call [`__aeabi_uidivmod'] argc:0
+   41: {r141:SI=abs(r151:SI);clobber cc:CC;}
+   42: r154:SI=r153:SI-0x1
+   43: r142:SI=r152:SI+r154:SI
+   44: r155:SI=0
+   45: r156:QI=r155:SI#0
+   46: [r142:SI]=r156:QI
+   81: pc=L62
+   82: barrier
+   84: L84:
+   83: NOTE_INSN_BASIC_BLOCK 4
+   37: r142:SI=r150:SI
+   62: L62:
+   47: NOTE_INSN_BASIC_BLOCK 5
+   48: r150:SI=r142:SI-0x1
+   49: r1:SI=0xa
+   50: r0:SI=r141:SI
+   51: r0:DI=call [`__aeabi_uidivmod'] argc:0
   REG_CALL_DECL `__aeabi_uidivmod'
   REG_EH_REGION 0x8000
-   51: r162:SI=r1:SI
+   52: r162:SI=r1:SI
   REG_EQUAL umod(r141:SI,0xa)
-   52: r163:QI=r162:SI#0
-   53: r164:SI=r163:QI#0+0x30
-   54: r165:QI=r164:SI#0
-   55: [r142:SI]=r165:QI
-   56: r1:SI=0xa
-   57: r0:SI=r141:SI
-   58: r0:SI=call [`__aeabi_uidiv'] argc:0
+   53: r163:QI=r162:SI#0
+   54: r164:SI=r163:QI#0+0x30
+   55: r165:QI=r164:SI#0
+   56: [r150:SI]=r165:QI
+   57: r1:SI=0xa
+   58: r0:SI=r141:SI
+   59: r0:SI=call [`__aeabi_uidiv'] argc:0
   REG_CALL_DECL `__aeabi_uidiv'
   REG_EH_REGION 0x8000
-   59: r169:SI=r0:SI
+   60: r169:SI=r0:SI
   REG_EQUAL udiv(r141:SI,0xa)
-   60: r141:SI=r169:SI
-   62: cc:CC=cmp(r141:SI,0)
-   63: pc={(cc:CC!=0)?L61:pc}
+   61: r141:SI=r169:SI
+   63: cc:CC=cmp(r141:SI,0)
+   64: pc={(cc:CC!=0)?L84:pc}
   REG_BR_PROB 9100
-   64: NOTE_INSN_BASIC_BLOCK 5
-   65: cc:CC=cmp(r151:SI,0)
-   66: pc={(cc:CC>=0)?L72:pc}
+   65: NOTE_INSN_BASIC_BLOCK 6
+   66: cc:CC=cmp(r151:SI,0)
+   67: pc={(cc:CC>=0)?L77:pc}
   REG_BR_PROB 6335
-   67: NOTE_INSN_BASIC_BLOCK 6
-   68: r149:SI=r142:SI-0x1
-   69: r170:SI=0x2d
-   70: r171:QI=r170:SI#0
-   71: [r142:SI-0x1]=r171:QI
-   37: r142:SI=r149:SI
-   72: L72:
-   73: NOTE_INSN_BASIC_BLOCK 7
-   74: r150:SI=r142:SI
+   68: NOTE_INSN_BASIC_BLOCK 7
+   69: r149:SI=r142:SI-0x2
+   70: r170:SI=0x2d
+   71: r171:QI=r170:SI#0
+   72: [r150:SI-0x1]=r171:QI
+   38: r150:SI=r149:SI
+   77: L77:
+   80: NOTE_INSN_BASIC_BLOCK 9
78: r0:SI=r150:SI
79: use r0:SI

[Bug target/70359] [6 Regression] Code size increase for ARM compared to gcc-5.3.0

2016-03-29 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70359

--- Comment #14 from kugan at gcc dot gnu.org ---
(In reply to Jeffrey A. Law from comment #13)
> The change to the assignment of p_22 is made by forwprop1.
> 
> It does create a situation where p_2 is live outside the loop and hides the
> CSE opportunity, which may be the cause of the more significant differences
> at expansion time.

Indeed. This is what I see: 

gcc 5 branch with  -O2 t2.c  -S -Os -marm  -mcpu=arm966e-s 96 Bytes
trunk with -O2 t2.c  -c -Os -marm  -mcpu=arm966e-s  112 Bytes
trunk with -O2 t2.c  -c -Os -marm   108 Bytes
trunk with -O2 t2.c  -c -Os -marm  -mcpu=arm966e-s  -fno-tree-forwprop 96 Bytes
trunk with -O2 t2.c  -c -Os -marm  -mcpu=arm966e-s and Jakub's changes in c# 5
- 100 Bytes

[Bug tree-optimization/61839] More optimize opportunity for VRP

2016-04-12 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61839

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org
  Known to fail|4.10.0  |5.0

--- Comment #2 from kugan at gcc dot gnu.org ---

> -  c = b != 0 ? 486097858 : 972195717;
> +  c = a + 972195718 >> (b != 0);

...

> until the very end, not transforming c_6.  Note that VRP could do the
> missing transform as it knows that _5 is [0, 1] (it has to jump through
> the shift - the value-range for the shift itself is too broad).
> 
> If written this kind of transform should be applied more generally, not
> just for shifts.  It basically wants to ask whether a conditional test
> can be carried out against another SSA name (and another constant) if
> an intermediate compute can be omitted in that case.

Do you mean something like,

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index bbdf9ce..dfce619 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -9902,6 +9902,47 @@ simplify_stmt_using_ranges (gimple_stmt_iterator *gsi)
 {
   enum tree_code rhs_code = gimple_assign_rhs_code (stmt);
   tree rhs1 = gimple_assign_rhs1 (stmt);
+  tree rhs2 = gimple_assign_rhs2 (stmt);
+  tree var;
+
+  /* Convert:
+COND_RES = X COMPARE Y
+TMP = (CAST) COND_RES
+LHS = CST BINOP TMP
+
+To:
+LHS = COND_RES ? (CST BINOP 1) : (CST BINOP 0) */
+
+  if (TREE_CODE_CLASS (rhs_code) == tcc_binary
+ && TREE_CODE (rhs1) == INTEGER_CST
+ && TREE_CODE (rhs2) == SSA_NAME
+ && is_gimple_assign (SSA_NAME_DEF_STMT (rhs2))
+ && gimple_assign_rhs_code (SSA_NAME_DEF_STMT (rhs2)) == NOP_EXPR
+ && (var = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (rhs2)))
+ && TREE_CODE (var) == SSA_NAME
+ && is_gimple_assign (SSA_NAME_DEF_STMT (var))
+ && TREE_CODE_CLASS (gimple_assign_rhs_code (SSA_NAME_DEF_STMT (var)))
+ == tcc_comparison)
+
+   {
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
+ value_range *vr = get_value_range (var);
+ if (range_int_cst_p (vr)
+ && integer_zerop (vr->min)
+ && integer_onep (vr->max))
+   {
+
+ tree lhs = gimple_assign_lhs (stmt);
+ tree new_rhs1 =  int_const_binop (rhs_code, rhs1, vr->min);
+ tree new_rhs2 =  int_const_binop (rhs_code, rhs1, vr->max);
+
+ gimple *s = gimple_build_assign (lhs, COND_EXPR, var,
+  new_rhs1,
+  new_rhs2 PASS_MEM_STAT);
+ gsi_replace (&gsi, s, false);
+ return true;
+   }
+   }

   switch (rhs_code)
{

[Bug tree-optimization/70841] reassoc fails to handle FP division

2016-05-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70841

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #2 from kugan at gcc dot gnu.org ---
Created attachment 38405
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38405&action=edit
prototype patch

Untested prototype patch.

[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple

2016-05-05 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||zboson at zboson dot net

--- Comment #7 from kugan at gcc dot gnu.org ---
*** Bug 68105 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/68105] optimizing repeated floating point addition to multiplication

2016-05-05 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68105

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||kugan at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #2 from kugan at gcc dot gnu.org ---
Looks like a duplicate of PR63586.

*** This bug has been marked as a duplicate of bug 63586 ***

[Bug tree-optimization/66726] missed optimization, factor conversion out of COND_EXPR

2015-12-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66726

--- Comment #14 from kugan at gcc dot gnu.org ---
Sorry I missed this. I posted patch which was OKed but in further testing I
found an issue. I am testing a modified patch and will post for review soon.

[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple

2015-12-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #2 from kugan at gcc dot gnu.org ---
Created attachment 36908
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36908&action=edit
proposed patch

With the patch:
unsigned f1(unsigned x){
unsigned y = x + x;
y = y + x;
y = y + x;
y = y + x;
y = y + x;
y = y + x;
y = y + x;
return y;
}
unsigned f2(unsigned x, unsigned z){
unsigned y = x + x;
y = y + x;
y = y + x;
y = y + z;
y = y + z;
y = y + z;
y = y + z;
return y;
}

unsigned f3(unsigned x, unsigned z, unsigned k){
unsigned y = x + x;
y = y + x;
y = y + x;
y = y + z;
y = y + z;
y = y + z;
y = y + k;
return y;
}
unsigned f4(unsigned x, unsigned z, unsigned k){
unsigned y = k + x;
y = y + x;
y = y + x;
y = y + z;
y = y + z;
y = y + z;
y = y + x;
return y;
}


now becomes:

at t7.c.108t.reassoc1 

;; Function f1 (f1, funcdef_no=0, decl_uid=4145, cgraph_uid=0, symbol_order=0)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }
f1 (unsigned int x)
{
  unsigned int y;
  unsigned int reassocmul_10;

  :
  reassocmul_10 = x_1(D) * 8;
  y_8 = reassocmul_10;
  return y_8;

}



;; Function f2 (f2, funcdef_no=1, decl_uid=4150, cgraph_uid=1, symbol_order=1)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }
f2 (unsigned int x, unsigned int z)
{
  unsigned int y;
  unsigned int reassocmul_11;
  unsigned int reassocmul_12;

  :
  reassocmul_11 = x_1(D) * 4;
  reassocmul_12 = z_5(D) * 4;
  y_9 = reassocmul_11 + reassocmul_12;
  return y_9;

}



;; Function f3 (f3, funcdef_no=2, decl_uid=4156, cgraph_uid=2, symbol_order=2)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }
f3 (unsigned int x, unsigned int z, unsigned int k)
{
  unsigned int y;
  unsigned int reassocmul_12;
  unsigned int reassocmul_13;
  unsigned int _14;

  :
  reassocmul_12 = x_1(D) * 4;
  reassocmul_13 = z_5(D) * 3;
  _14 = k_9(D) + reassocmul_13;
  y_10 = _14 + reassocmul_12;
  return y_10;

}



;; Function f4 (f4, funcdef_no=3, decl_uid=4162, cgraph_uid=3, symbol_order=3)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }
f4 (unsigned int x, unsigned int z, unsigned int k)
{
  unsigned int y;
  unsigned int reassocmul_12;
  unsigned int reassocmul_13;
  unsigned int _14;
  unsigned int _15;

  :
  reassocmul_12 = x_2(D) * 3;
  reassocmul_13 = z_6(D) * 3;
  _14 = x_2(D) + reassocmul_13;
  _15 = _14 + reassocmul_12;
  y_10 = _15 + k_1(D);
  return y_10;

}

[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple

2015-12-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

--- Comment #3 from kugan at gcc dot gnu.org ---
I think the intention is to have multiplication by power-of-2?

[Bug target/68390] Incorrect code due to indirect tail call of varargs function with hard float ABI

2015-12-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68390

--- Comment #3 from kugan at gcc dot gnu.org ---
Fixed in trunk. We also need to back-port this to branches.

[Bug tree-optimization/61139] missed fma/reassoc optimization

2015-12-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61139

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #3 from kugan at gcc dot gnu.org ---
Same as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

*** This bug has been marked as a duplicate of bug 63586 ***

[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple

2015-12-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||vincenzo.innocente at cern dot 
ch

--- Comment #5 from kugan at gcc dot gnu.org ---
*** Bug 61139 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/63586] x+x+x+x -> 4*x in gimple

2015-12-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63586

kugan at gcc dot gnu.org changed:

   What|Removed |Added

  Attachment #36908|0   |1
is obsolete||

--- Comment #6 from kugan at gcc dot gnu.org ---
Created attachment 36979
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36979&action=edit
proposed patch



With the updated pach now we have:

;; Function f4 (f4, funcdef_no=3, decl_uid=4162, cgraph_uid=3, symbol_order=3)

;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2
;; 2 succs { 1 }
f4 (unsigned int x, unsigned int z, unsigned int k)
{
  unsigned int y;
  unsigned int reassocmul_12;
  unsigned int reassocmul_13;
  unsigned int _14;

  :
  reassocmul_12 = x_2(D) * 4;
  reassocmul_13 = z_6(D) * 3;
  _14 = reassocmul_13 + k_1(D);
  y_10 = _14 + reassocmul_12;
  return y_10;

}


Also, bootstrap and regression testing is clean for x86_64-none-linux-gnu.

[Bug tree-optimization/61139] missed fma/reassoc optimization

2015-12-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61139

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|RESOLVED|NEW
 Resolution|DUPLICATE   |---

--- Comment #4 from kugan at gcc dot gnu.org ---
After handling float, still seeing difference in asm. diff of .199t.resx now
looks:

-;; Function void mirror(float&, float) (_Z6mirrorRff, funcdef_no=0,
decl_uid=2704, cgraph_uid=0, symbol_order=0)
+;; Function void mirror(float&, float) (_Z6mirrorRff, funcdef_no=0,
decl_uid=2472, cgraph_uid=0, symbol_order=0)

 void mirror(float&, float) (float & x, float w)
 {
   float _3;
   float _6;
-  float reassocmul_9;
+  float _8;

   :
   _3 = *x_2(D);
-  reassocmul_9 = w_4(D) * 2.0e+0;
-  _6 = reassocmul_9 - _3;
+  _8 = -_3;
+  _6 = w_4(D) * 2.0e+0 + _8;
   *x_2(D) = _6;
   return;

@@ -18,18 +18,18 @@



-;; Function void mirror2(float&, float) (_Z7mirror2Rff, funcdef_no=1,
decl_uid=2708, cgraph_uid=1, symbol_order=1)
+;; Function void mirror2(float&, float) (_Z7mirror2Rff, funcdef_no=1,
decl_uid=2476, cgraph_uid=1, symbol_order=1)

 void mirror2(float&, float) (float & x, float w)
 {
-  float _2;
   float _5;
   float _6;
+  float _8;

   :
-  _2 = w_1(D) * 2.0e+0;
   _5 = *x_4(D);
-  _6 = _2 - _5;
+  _8 = -_5;
+  _6 = w_1(D) * 2.0e+0 + _8;
   *x_4(D) = _6;
   return;

[Bug debug/69077] [6 Regression] omnetpp ICEs with -flto -g

2016-01-03 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69077

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #8 from kugan at gcc dot gnu.org ---
For  decl "mean" in t2.cc, in:
void sf::finish() {
  recordScalar(eedStats.mean());
}

Qe have: 
LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) is UNKNOWN_LOCATION;

As per the comments in tree.h, BLOCK_SOURCE_LOCATION should be set for inlined
function (function "mean" here).

debug_tree (decl for "mean") is:

 
unit size 
align 64 symtab -912663504 alias set -1 canonical type
0x7fe2c98f6498 precision 64
pointer_to_this >
SI
size 
unit size 
align 32 symtab 0 alias set -1 structural equality method basetype

arg-types 
chain >>
pointer_to_this >
addressable asm_written nothrow public static weak function-specific-target
function-specific-opt autoinline virtual DI file t.h line 4 col 22 align 32
context  initial 
(mem:DI (symbol_ref/i:DI ("_ZNK7cStdDev4meanEv") [flags 0x3] ) [0  S8 A8])>

not sure why ?

[Bug target/69194] New: internal compiler error: in extract_insn, at recog.c:2286

2016-01-08 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69194

Bug ID: 69194
   Summary: internal compiler error: in extract_insn, at
recog.c:2286
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kugan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 37271
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37271&action=edit
testcase

Attached testcase ICE with:

t.C: In function ‘crashes do_crash(Table, Points)’:
t.C:504:1: error: unrecognizable insn:
 }
 ^

(insn 27 26 28 4 (set (reg:V4SF 123)
(unspec:V4SF [
(mem/c:V4SF (reg/f:SI 104 virtual-incoming-args) [0 MEM[(const
float[4] *)&p]+0 S16 A32])
] UNSPEC_VLD1)) t.C:31 -1
 (nil))

command line options:arm-none-linux-gnueabi-g++  -O2 -mfpu=neon -S 
-Wno-deprecated-declarations t.C

gcc -v:

Using built-in specs.
COLLECT_GCC=/home/kugan/work/builds/gcc-fsf-gcc/tools/bin/arm-none-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/home/kugan/work/builds/gcc-fsf-gcc/tools/libexec/gcc/arm-none-linux-gnueabi/6.0.0/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /home/kugan/work/sources/gcc-fsf/gcc/configure
--target=arm-none-linux-gnueabi
--prefix=/home/kugan/work/builds/gcc-fsf-gcc/tools
--with-sysroot=/home/kugan/work/builds/gcc-fsf-gcc/sysroot-arm-none-linux-gnueabi
--disable-libssp --disable-libgomp --disable-libmudflap
--enable-languages=c,c++ --with-arch=armv7-a --with-fpu=vfpv3-d16
--with-float=softfp --with-thumb
Thread model: posix
gcc version 6.0.0 20151231 (experimental) (GCC)

[Bug target/69194] [5/6 Regression] internal compiler error: in extract_insn, at recog.c:2286

2016-01-11 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69194

--- Comment #2 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Tue Jan 12 00:40:54 2016
New Revision: 232251

URL: https://gcc.gnu.org/viewcvs?rev=232251&root=gcc&view=rev
Log:
gcc/ChangeLog:

2016-01-12  Kugan Vivekanandarajah  
Jim Wilson  

PR target/69194
* config/arm/arm-builtins.c (arm_expand_neon_args): Call
copy_to_mode_reg instead of force_reg.

gcc/testsuite/ChangeLog:

2016-01-12  Kugan Vivekanandarajah  
Jim Wilson  

PR target/69194
* gcc.target/arm/pr69194.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/arm/pr69194.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm-builtins.c
trunk/gcc/testsuite/ChangeLog

[Bug target/69194] [5/6 Regression] internal compiler error: in extract_insn, at recog.c:2286

2016-01-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69194

--- Comment #5 from kugan at gcc dot gnu.org ---
Thanks for the reminder. I will commit the back-port today. I wanted leave few
days in the trunk before doing.

[Bug target/69194] [5/6 Regression] internal compiler error: in extract_insn, at recog.c:2286

2016-01-16 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69194

--- Comment #6 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Sun Jan 17 02:44:26 2016
New Revision: 232481

URL: https://gcc.gnu.org/viewcvs?rev=232481&root=gcc&view=rev
Log:
2016-01-17  Kugan Vivekanandarajah  

Backport from mainline
2016-01-12  Kugan Vivekanandarajah  
Jim Wilson  

PR target/69194
* config/arm/arm-builtins.c (arm_expand_neon_args): Call
copy_to_mode_reg instead of force_reg.

2016-01-17  Kugan Vivekanandarajah  

Backport from mainline
2016-01-12  Kugan Vivekanandarajah  
Jim Wilson  

PR target/69194
* gcc.target/arm/pr69194.c: New test.


Added:
branches/gcc-5-branch/gcc/testsuite/gcc.target/arm/pr69194.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/config/arm/arm-builtins.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/69377] [6 Regression] wrong code at -O2 on x86_64-linux-gnu (in 32-bit mode)

2016-01-20 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69377

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #3 from kugan at gcc dot gnu.org ---
I am not able to reproduce it.

This is my setup:

I had to initialise variables in gcc/ccmp.c to workaround uninitiated
variables.
I did ./contrib/download_prerequisites in source tree.

x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/home/kugan/test/install3/usr/local/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/kugan/test/install3/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,c++ --enable-multilib
Thread model: posix
gcc version 6.0.0 20160119 (experimental) (GCC) 

x86_64-pc-linux-gnu-gcc -O2 -m32 t1.c; ./a.out
2
1
1

Also tried -O1/-Os/-O3

[Bug target/69442] [6 Regression] wrong code with -Og and 64bit modulo @ armv7a

2016-01-25 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69442

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #11 from kugan at gcc dot gnu.org ---
Thanks Jakub for the patch. Tried regression testing for arm variants and there
is no new regressions with the patch.

http://people.linaro.org/~christophe.lyon/cross-validation/gcc-test-patches/232798-pr69442/report-build-info.html

[Bug middle-end/82479] New: missing popcount builtin detection

2017-10-08 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82479

Bug ID: 82479
   Summary: missing popcount builtin detection
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kugan at gcc dot gnu.org
  Target Milestone: ---

gcc does not have support to detect builtin pop count. As a results, gcc
generates bad code for

int PopCount (long b) {
int c = 0;

while (b) {
b &= b - 1;
c++;
}
return c;
}

clang seems to do that and generates (for aarch64):

_Z8PopCounty:
fmov d0, x0
cnt  v0.8b, v0.8b
uaddlv  h0, v0.8b
fmov w0, s0
ret

[Bug middle-end/82479] missing popcount builtin detection

2017-10-08 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82479

--- Comment #1 from kugan at gcc dot gnu.org ---
gcc trunk generates:
PopCount:
mov w2, 0
cbz x0, .L1
.p2align 3
.L3:
sub x1, x0, #1
add w2, w2, 1
andsx0, x0, x1
bne .L3
.L1:
mov w0, w2
ret

[Bug middle-end/82479] missing popcount builtin detection

2017-10-08 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82479

--- Comment #4 from kugan at gcc dot gnu.org ---
(In reply to Andrew Pinski from comment #2)
> Confirmed. How useful this optimization is questionable.

This code is part of spec2017/deepsjeng. There is some gain if we can. 

> 
> Gcc has __builtin_popcount which can be used.

I agree.

[Bug libgomp/82555] New: SPECcpu201 Wrf_s deadlock

2017-10-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82555

Bug ID: 82555
   Summary: SPECcpu201 Wrf_s deadlock
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgomp
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kugan at gcc dot gnu.org
CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Wrf_s is hanging or deadlocks when run on 48 threads (cores). It doesnt always
happen and I have to run with --iterations=111 and it will eventually happens.
Sometimes in the 2nd iterations and some times much later.

I attached the process to gdb and the back trace is:
(gdb) bt
#0  0x01019924 in __lll_lock_wait (futex=futex@entry=0x2c3b1e0
<_gfortrani_unit_lock>, private=0) at lowlevellock.c:43
#1  0x01012cbc in __pthread_mutex_lock (mutex=0x2c3b1e0
<_gfortrani_unit_lock>) at pthread_mutex_lock.c:80
#2  0x00fd20ac in __gthread_mutex_lock (__mutex=0x2c3b1e0
<_gfortrani_unit_lock>) at ../libgcc/gthr-default.h:748
#3  _gfortrani_close_units () at ../../../gcc-exp2/libgfortran/io/unit.c:835
#4  0x0103950c in __libc_csu_fini ()
#5  0x0103f068 in __run_exit_handlers ()
#6  0x0103f0b0 in exit ()
#7  0x00fc6e60 in _gfortrani_exit_error (status=1, status@entry=3) at
../../../gcc-exp2/libgfortran/runtime/error.c:196
#8  0x00fc7314 in _gfortrani_internal_error
(cmp=cmp@entry=0xcdf23d00, 
message=message@entry=0x11548a8 "stash_internal_unit(): Stack Size
Exceeded") at ../../../gcc-exp2/libgfortran/runtime/error.c:422
#9  0x00fd1a84 in _gfortrani_stash_internal_unit (dtp=0xcdf23d00)
at ../../../gcc-exp2/libgfortran/io/unit.c:549
#10 0x00fd0f6c in _gfortran_st_write_done (dtp=0xcdf23d00) at
../../../gcc-exp2/libgfortran/io/transfer.c:4168
#11 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#12 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#13 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#14 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#15 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#16 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#17 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#18 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#19 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#20 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#21 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#22 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#23 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#24 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#25 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#26 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#27 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#28 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#29 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#30 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#31 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#32 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#33 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#34 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#35 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#36 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#37 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#38 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#39 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#40 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#41 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#42 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#43 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#44 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#45 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()
#46 0x00db933c in __module_ra_rrtm_MOD_rrtmlwrad ()

I am running this on AArch64 but I dont think this is an AArch64 specific
issue. Is anyone else seeing this?

[Bug libgomp/82555] SPECcpu201 Wrf_s deadlock

2017-10-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82555

--- Comment #1 from kugan at gcc dot gnu.org ---
My gcc is slightly old. 
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/kugan.vivekanandarajah/install/test/usr/local/bin/../libexec/gcc/aarch64-unknown-linux-gnu/8.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: ../gcc-exp2/configure : (reconfigured) ../gcc-exp2/configure
--enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion
Thread model: posix
gcc version 8.0.0 20170822 (experimental) (GCC)

I will try with the latest version.

[Bug libfortran/82555] SPECcpu201 Wrf_s deadlock

2017-10-14 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82555

--- Comment #5 from kugan at gcc dot gnu.org ---
(In reply to Andrew Pinski from comment #4)
> Actually PR 78387 seems exactly this issue.  Please test with a newer
> version of gfortran.

Thanks Andrew. Looks like this is the issue. So far, current trunk is
continuing without error.

[Bug libfortran/82555] SPECcpu201 Wrf_s deadlock

2017-10-15 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82555

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #6 from kugan at gcc dot gnu.org ---


*** This bug has been marked as a duplicate of bug 78387 ***

[Bug fortran/78387] OpenMP segfault/stack size exceeded writing to internal file

2017-10-15 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78387

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #17 from kugan at gcc dot gnu.org ---
*** Bug 82555 has been marked as a duplicate of this bug. ***

[Bug middle-end/81558] New: Loop not vectorized

2017-07-25 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81558

Bug ID: 81558
   Summary: Loop not vectorized
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kugan at gcc dot gnu.org
  Target Milestone: ---

For the testcase:

struct I
{
  int opix_x;
  int opix_y;
};

//#define R 
#define R __restrict__
extern struct I * R img;
extern unsigned short ** R imgY_org;
extern unsigned short orig_blocks[256];

void foo1 (int n)
{
  int x = 1, y = 1;
  unsigned short *orgptr=orig_blocks;
  // Vectorized
  for (y = 0; y < img->opix_y; y++)
for (x = 0; x < img->opix_x; x++)
  *orgptr++ = imgY_org [y][x];
}

void foo2 (int n)
{
  int x = 1, y = 1;
  unsigned short *orgptr=orig_blocks;
  // Not vectorized
  for (y = img->opix_y; y < img->opix_y+16; y++)
for (x = img->opix_x; x < img->opix_x+16; x++)
  *orgptr++ = imgY_org [y][x];
}

Loop in foo2 is not vectorized.

In the *.156t.vect, I see:
Creating dr for *_40
analyze_innermost: failed: evolution of base is not affine.
base_address: 
offset from base address: 
constant offset from base address: 
step: 
aligned to: 
base_object: *_40


LLVM seems to be able to vectorize this.

[Bug tree-optimization/81558] Loop not vectorized

2017-07-26 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81558

--- Comment #2 from kugan at gcc dot gnu.org ---

> Does LLVM do a runtime alias check here?  For foo1 GCC adds a runtime alias
> check
> (BB vectorization cannot version for aliasing).

Yes. LLVM does not seem to be unrolling the inner loop. As you said, when
disabling cunrolli it works. cunroll pass will unroll after loop vectorisation.
Can anything  done with the heuristics for this case? Thanks.

[Bug tree-optimization/77862] [7 Regression] ice in add_equivalence

2016-12-07 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77862

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from kugan at gcc dot gnu.org ---
Fixed in trunk.

[Bug tree-optimization/78721] [7 Regression] ICE on valid code at -O2 and -O3 on x86_64-linux-gnu: in set_value_range, at tree-vrp.c:371

2016-12-08 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78721

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #3 from kugan at gcc dot gnu.org ---
Created attachment 40280
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40280&action=edit
untested patch

[Bug tree-optimization/78721] [7 Regression] ICE on valid code at -O2 and -O3 on x86_64-linux-gnu: in set_value_range, at tree-vrp.c:371

2016-12-09 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78721

--- Comment #4 from kugan at gcc dot gnu.org ---
Author: kugan
Date: Fri Dec  9 19:47:10 2016
New Revision: 243501

URL: https://gcc.gnu.org/viewcvs?rev=243501&root=gcc&view=rev
Log:
gcc/testsuite/ChangeLog:

2016-12-09  Kugan Vivekanandarajah  

PR ipa/78721
* gcc.dg/pr78721.c: New test.

gcc/ChangeLog:

2016-12-09  Kugan Vivekanandarajah  

PR ipa/78721
* ipa-cp.c (propagate_vr_accross_jump_function): drop_tree_overflow
after fold_convert.


Added:
trunk/gcc/testsuite/gcc.dg/pr78721.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-cp.c
trunk/gcc/testsuite/ChangeLog

[Bug lto/78140] [7 Regression] libxul -flto uses 1GB more memory than gcc-6

2017-01-22 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78140

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #26 from kugan at gcc dot gnu.org ---
(In reply to Richard Biener from comment #20)
> Look at tree-ssanames.c:range_info_def for "tricks" (make them variable
> size):
> 
> /* Value range information for SSA_NAMEs representing non-pointer variables.
> */
> 
> struct GTY ((variable_size)) range_info_def {
>   /* Minimum, maximum and nonzero bits.  */
>   TRAILING_WIDE_INT_ACCESSOR (min, ints, 0)
>   TRAILING_WIDE_INT_ACCESSOR (max, ints, 1)
>   TRAILING_WIDE_INT_ACCESSOR (nonzero_bits, ints, 2)
>   trailing_wide_ints <3> ints;
> };

I am working on a patch to change ipa vrp based on the above.

  1   2   3   >