[Bug tree-optimization/102446] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu

2021-09-22 Thread hubicka at ucw dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102446

--- Comment #4 from Jan Hubicka  ---
> Started with r5-6477-g3620b606822f80863488ca4883542d848d41f9f9
This only affects early inlining decisions, so it may be useful to
bisect this with --param early-inlining-insns=14

Honza

Re: [Bug tree-optimization/102446] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu

2021-09-22 Thread Jan Hubicka
> Started with r5-6477-g3620b606822f80863488ca4883542d848d41f9f9
This only affects early inlining decisions, so it may be useful to
bisect this with --param early-inlining-insns=14

Honza


[Bug tree-optimization/102446] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu

2021-09-22 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102446

--- Comment #3 from Richard Biener  ---
void m() {
  int aa = 0, i = 0;
  for (; i < 3; i++)
if (k < 0)
  aa |= *j;

Dump of assembler code for function m:
   0x00400540 <+0>: mov0x200b16(%rip),%edi# 0x60105c

   0x00400546 <+6>: mov0x200b13(%rip),%rax# 0x601060

   0x0040054d <+13>:sar$0x1f,%edi
=> 0x00400550 <+16>:and(%rax),%edi
   0x00400552 <+18>:cmpw   $0x0,0x200af6(%rip)# 0x601050


so we're loading *j before checking k < 0.  On GIMPLE that's OK:

   [local count: 268435456]:
  k.5_1 = k;
  j.6_2 = j;
  if (k.5_1 < 0)
goto ; [41.00%]
  else
goto ; [59.00%]

   [local count: 110058537]:
  j.6__lsm0.31_28 = *j.6_2;

   [local count: 268435456]:
  # aa_9 = PHI 

but RTL if-conversion makes the load unconditional.

(insn 13 12 35 3 (set (reg/v:SI 89 [ j.6__lsm0.31 ])
(mem:SI (reg/f:DI 83 [ j.6_2 ]) [1 *j.6_2+0 S4 A32])) 77
{*movsi_internal}
 (expr_list:REG_DEAD (reg/f:DI 83 [ j.6_2 ])
(nil)))

I don't see any flags marking it as not trapping?

[Bug tree-optimization/102446] [9/10/11/12 Regression] wrong code at -O3 on x86_64-linux-gnu

2021-09-22 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102446

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org
Summary|wrong code at -O3 on|[9/10/11/12 Regression]
   |x86_64-linux-gnu|wrong code at -O3 on
   ||x86_64-linux-gnu
   Target Milestone|--- |9.5

--- Comment #2 from Jakub Jelinek  ---
Started with r5-6477-g3620b606822f80863488ca4883542d848d41f9f9