[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-06-08 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

Martin Jambor  changed:

   What|Removed |Added

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

--- Comment #8 from Martin Jambor  ---
...and marking it as such.

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-06-08 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

--- Comment #7 from Martin Jambor  ---
Fixed.  Thanks for reporting.

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-06-08 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

--- Comment #6 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Martin Jambor
:

https://gcc.gnu.org/g:127bf4228d0cb21f28fd5ed4dd820fa4760fc771

commit r10-8264-g127bf4228d0cb21f28fd5ed4dd820fa4760fc771
Author: Martin Jambor 
Date:   Mon Jun 8 20:15:22 2020 +0200

ipa-sra: Do not remove statements necessary because of non-call EH (PR
95113)

PR 95113 revealed that when reasoning about which parameters are dead,
IPA-SRA does not perform the same check related to non-call exceptions
as tree DCE.  It most certainly should and so this patch moves the
condition used in tree-ssa-dce.c into a separate predicate (in
tree-eh.c) and uses it from both places.

gcc/ChangeLog:

2020-05-27  Martin Jambor  

PR ipa/95113
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Move non-call
exceptions check to...
* tree-eh.c (stmt_unremovable_because_of_non_call_eh_p): ...this
new function.
* tree-eh.h (stmt_unremovable_because_of_non_call_eh_p): Declare
it.
* ipa-sra.c (isra_track_scalar_value_uses): Use it.  New parameter
fun.

gcc/testsuite/ChangeLog:

2020-05-27  Martin Jambor  

PR ipa/95113
* gcc.dg/ipa/pr95113.c: New test.

(cherry picked from commit 1980ffec48c6fa41396bea66366f2e591798e1e1)

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-06-04 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Martin Jambor :

https://gcc.gnu.org/g:1980ffec48c6fa41396bea66366f2e591798e1e1

commit r11-935-g1980ffec48c6fa41396bea66366f2e591798e1e1
Author: Martin Jambor 
Date:   Thu Jun 4 17:03:27 2020 +0200

ipa-sra: Do not remove statements necessary because of non-call EH (PR
95113)

PR 95113 revealed that when reasoning about which parameters are dead,
IPA-SRA does not perform the same check related to non-call exceptions
as tree DCE.  It most certainly should and so this patch moves the
condition used in tree-ssa-dce.c into a separate predicate (in
tree-eh.c) and uses it from both places.

gcc/ChangeLog:

2020-05-27  Martin Jambor  

PR ipa/95113
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Move non-call
exceptions check to...
* tree-eh.c (stmt_unremovable_because_of_non_call_eh_p): ...this
new function.
* tree-eh.h (stmt_unremovable_because_of_non_call_eh_p): Declare
it.
* ipa-sra.c (isra_track_scalar_value_uses): Use it.  New parameter
fun.

gcc/testsuite/ChangeLog:

2020-05-27  Martin Jambor  

PR ipa/95113
* gcc.dg/ipa/pr95113.c: New test.

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-05-28 Thread jamborm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

--- Comment #4 from Martin Jambor  ---
(In reply to Arseny Solokha from comment #3)
> 
> Indeed, -fno-ipa-sra fixes it. So, a duplicate of PR93385?

Similar, but not quite the same.  I have proposed a fix on the mailing
list: https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546703.html

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-05-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

Richard Biener  changed:

   What|Removed |Added

 Blocks||93385
   Priority|P3  |P2


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385
[Bug 93385] [10/11 Regression] wrong code with u128 modulo at -O2 -fno-dce
-fno-ipa-cp -fno-tree-dce

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-05-13 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

--- Comment #3 from Arseny Solokha  ---
(In reply to Jakub Jelinek from comment #2)
> Guess dup of the other PR where the IPA opts assume DCE which doesn't really
> happen (the *p load result is never used).

Indeed, -fno-ipa-sra fixes it. So, a duplicate of PR93385?

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-05-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

Jakub Jelinek  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org,
   ||jamborm at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
int a, b;

static inline long int
foo (long int x, int y)
{
  if (y == 0)
return 0;

  if (x == -1 && y == -1)
return 0;

  return x / y;
}

static inline int
bar (int *p)
{
  int c = foo (a, 1) + *p;
  return b;
}

int
main ()
{
  int d = 0;
  b = foo (1, 1);
  bar ();
  return 0;
}

Guess dup of the other PR where the IPA opts assume DCE which doesn't really
happen (the *p load result is never used).

[Bug tree-optimization/95113] [10/11 Regression] Wrong code w/ -O2 -fexceptions -fnon-call-exceptions

2020-05-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95113

Jakub Jelinek  changed:

   What|Removed |Added

   Last reconfirmed||2020-05-13
 CC||jakub at gcc dot gnu.org
 Ever confirmed|0   |1
   Target Milestone|--- |10.2
 Status|UNCONFIRMED |NEW

--- Comment #1 from Jakub Jelinek  ---
Started with r10-3542-g0b92cf305dcf34387a8e2564e55ca8948df3b47a