[Bug tree-optimization/110173] [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25

2023-06-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110173

--- Comment #4 from Andrew Pinski  ---
So CCP2 now removes:
Removing dead stmt:iftmp.4_9 = PHI <1(5), 0(6)>

Which allows to remove all of this:
   [local count: 1073441178]:
  if (t_4(D) != 0)
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 536720589]:

   [local count: 1073441178]:
  # iftmp.4_9 = PHI <1(5), 0(6)>

And then jump threading happens (threadfull1) but leaves behind some extra jump
threading it seems.
```
   [local count: 751619281]:
  if (g.1_6 == 0B)
goto ; [99.96%]
  else
goto ; [0.04%]

   [local count: 751318634]:
  n = 0;
  goto ; [100.00%]

   [local count: 751408828]:
  if (g.1_6 == 0B)
goto ; [30.00%]
  else
goto ; [70.00%]
```
No other block can enter `bb 5`.

So not my issue.

[Bug tree-optimization/110173] [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25

2023-06-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110173

--- Comment #3 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #2)
> Hmm
> static void i() { *h = j(); }
> static int *j(unsigned o) {
> 
> I suspect this is just might be another one of these cases where a variable
> is uninitialized gets a different value now.

Yes it is definitely related to that variable being uninitialized.

if you replace o with either 1 or 0, the call to foo is there even in GCC 13.

I think this can be marked as a non-regression.

[Bug tree-optimization/110173] [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25

2023-06-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110173

--- Comment #2 from Andrew Pinski  ---
Hmm
static void i() { *h = j(); }
static int *j(unsigned o) {

I suspect this is just might be another one of these cases where a variable is
uninitialized gets a different value now.

[Bug tree-optimization/110173] [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25

2023-06-08 Thread theodort at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110173

--- Comment #1 from Theodoros Theodoridis  ---
*The first piece of ASM is generated by gcc 13.1, the second by gcc trunk