[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2022-04-21 Thread jiawei at iscas dot ac.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

jiawei  changed:

   What|Removed |Added

 CC||jiawei at iscas dot ac.cn

--- Comment #11 from jiawei  ---
(In reply to Eric Botcazou from comment #8)
I use the RISC-V target test and get the same result, and link fail with
'undefined reference to `foo`'.

> The test fails (to link) on SPARC though, here's the .optimized dump at -O3:
> 
> ;; Function main (main, funcdef_no=0, decl_uid=1488, cgraph_uid=1,
> symbol_order=1) (executed once)
> 
> Removing basic block 8
> Removing basic block 9
> Removing basic block 10
> Removing basic block 11
> int main ()
> {
>   unsigned int ivtmp.8;
>   long int a;
>   long int _1;
>   void * _2;
>   unsigned int _17;
> 
>[local count: 44232128]:
>   if (a_9(D) != 1)
> goto ; [89.00%]
>   else
> goto ; [11.00%]
> 
>[local count: 715863673]:
>   # ivtmp.8_23 = PHI 
>   bar ();
>   _2 = (void *) ivtmp.8_23;
>   _1 = MEM[(long int *)_2];
>   if (_1 == 1)
> goto ; [20.24%]
>   else
> goto ; [79.76%]
> 
>[local count: 144890806]:
>   foo ();
> 
>[local count: 715863674]:
>   ivtmp.8_24 = ivtmp.8_23 + 4;
>   if (_17 != ivtmp.8_24)
> goto ; [66.67%]
>   else
> goto ; [33.33%]
> 
>[local count: 238597362]:
>   ivtmp.8_7 = (unsigned int) 
>   _17 = ivtmp.8_7 + 8;
>   goto ; [100.00%]
> 
>[local count: 44232131]:
>   return 0;
> }

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2022-03-28 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek  ---
Guess an important question is if the #c0 testcase has been reduced from
something larger and if yes, whether it was always encountering UB at runtime
in the unreduced test as well or not.

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2022-03-28 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

--- Comment #9 from Aldy Hernandez  ---
This is an invalid test.  The variable "a" is being used before being set.  I
think we should actually remove the test from the testsuite.

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2022-03-28 Thread ebotcazou at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

Eric Botcazou  changed:

   What|Removed |Added

 CC||ebotcazou at gcc dot gnu.org
 Resolution|FIXED   |---
 Status|RESOLVED|REOPENED

--- Comment #8 from Eric Botcazou  ---
The test fails (to link) on SPARC though, here's the .optimized dump at -O3:

;; Function main (main, funcdef_no=0, decl_uid=1488, cgraph_uid=1,
symbol_order=1) (executed once)

Removing basic block 8
Removing basic block 9
Removing basic block 10
Removing basic block 11
int main ()
{
  unsigned int ivtmp.8;
  long int a;
  long int _1;
  void * _2;
  unsigned int _17;

   [local count: 44232128]:
  if (a_9(D) != 1)
goto ; [89.00%]
  else
goto ; [11.00%]

   [local count: 715863673]:
  # ivtmp.8_23 = PHI 
  bar ();
  _2 = (void *) ivtmp.8_23;
  _1 = MEM[(long int *)_2];
  if (_1 == 1)
goto ; [20.24%]
  else
goto ; [79.76%]

   [local count: 144890806]:
  foo ();

   [local count: 715863674]:
  ivtmp.8_24 = ivtmp.8_23 + 4;
  if (_17 != ivtmp.8_24)
goto ; [66.67%]
  else
goto ; [33.33%]

   [local count: 238597362]:
  ivtmp.8_7 = (unsigned int) 
  _17 = ivtmp.8_7 + 8;
  goto ; [100.00%]

   [local count: 44232131]:
  return 0;
}

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-11-10 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

--- Comment #7 from CVS Commits  ---
The master branch has been updated by H.J. Lu :

https://gcc.gnu.org/g:b83705b477858ba683b99fa61ff9ff83bc5be265

commit r12-5135-gb83705b477858ba683b99fa61ff9ff83bc5be265
Author: H.J. Lu 
Date:   Wed Nov 10 11:24:44 2021 -0800

Add a testcase for PR tree-optimization/102892

PR tree-optimization/102892 is fixed by

commit 4b3a325f07acebf47e82de227ce1d5ba62f5bcae
Author: Aldy Hernandez 
Date:   Thu Oct 28 15:35:21 2021 +0200

Remove VRP threader passes in exchange for better threading pre-VRP.

PR tree-optimization/102892
* gcc.dg/pr102892-1.c: New file.
* gcc.dg/pr102892-2.c: Likewise.

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-11-10 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

--- Comment #6 from Aldy Hernandez  ---
(In reply to Martin Liška from comment #5)
> Fixed on master with r12-4790-g4b3a325f07acebf4.

Wadayaknow...I fixed it and didn't even know it :)

Thanks.

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-11-10 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection |

--- Comment #5 from Martin Liška  ---
Fixed on master with r12-4790-g4b3a325f07acebf4.

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-11-10 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

Aldy Hernandez  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Aldy Hernandez  ---
There's no call to foo in current trunk.

It seems to be gone in the .ccp4 dump which runs after vrp2.  This probably
went away with VRP2's switch to ranger.

Ideally we should add a testcase to the suite.  Could someone take care of
this?

Anywhoo, fixed.

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-11-10 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org
 Status|NEW |WAITING

--- Comment #3 from Martin Liška  ---
Well, even GCC 4.8.0 ends with:

/usr/bin/ld.bfd: /tmp/cch530u7.o: in function `main':
pr102892.c:(.text.startup+0x5): undefined reference to `bar'
/usr/bin/ld.bfd: pr102892.c:(.text.startup+0xa): undefined reference to `bar'
collect2: error: ld returned 1 exit status

What exactly should I bisect?

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-10-23 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

Aldy Hernandez  changed:

   What|Removed |Added

   Last reconfirmed||2021-10-23
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

--- Comment #2 from Aldy Hernandez  ---
(In reply to Aldy Hernandez from comment #1)
> Maybe a duplicate of PR102879?

Hmmm, maybe not.

It doesn't look like a threading thing after a quick glance.  We only thread 1
path, in both 11.2 and trunk:

a.c.193t.dom3:  [4] Registering jump thread: (11, 3) incoming edge;  (3, 5)
joiner (5, 12) normal; 

And it's actually in DOM which has been largely untouched in this release.

Could someone bisect this?

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-10-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Target Milestone|--- |12.0

[Bug tree-optimization/102892] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

2021-10-22 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102892

--- Comment #1 from Aldy Hernandez  ---
Maybe a duplicate of PR102879?