[Bug c++/90178] [9 Regression] Missed optimization: duplicated terminal basic block with -mavx

2019-04-21 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90178

--- Comment #7 from Paolo Carlini  ---
The Component field is wrong, right?

[Bug c++/90178] [9 Regression] Missed optimization: duplicated terminal basic block with -mavx

2019-04-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90178

--- Comment #6 from H.J. Lu  ---
(In reply to H.J. Lu from comment #3)
> It is caused by r266358.

The nop INSN can be removed by split_all_insns later:

 if (INSN_P (insn))
{
  rtx set = single_set (insn);

  /* Don't split no-op move insns.  These should silently
 disappear later in final.  Splitting such insns would
 break the code that handles LIBCALL blocks.  */
  if (set && set_noop_p (set))
{
  /* Nops get in the way while scheduling, so delete them
 now if register allocation has already been done.  It
 is too risky to try to do this before register
 allocation, and there are unlikely to be very many
 nops then anyways.  */
  if (reload_completed)
  delete_insn_and_edges (insn);

[Bug c++/90178] [9 Regression] Missed optimization: duplicated terminal basic block with -mavx

2019-04-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90178

--- Comment #5 from H.J. Lu  ---
zveroupper pass drops:

(insn 36 37 51 8 (use (reg/i:DI 0 ax)) "x.i":8:1 -1
 (nil))

[Bug c++/90178] [9 Regression] Missed optimization: duplicated terminal basic block with -mavx

2019-04-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90178

--- Comment #4 from H.J. Lu  ---
The removed insn is insn 35 in:

;; basic block 8, loop depth 0, count 114863532 (estimated locally), maybe hot
;;  prev block 7, next block 1, flags: (REACHABLE, HOT_PARTITION, RTL)
;;  pred:   7 [always]  count:6317494 (estimated locally) (FALLTHRU)
;;  4 [5.5% (guessed)]  count:55807731 (estimated locally)
(LOOP_EXIT)
;;  6 [always]  count:52738306 (estimated locally)
;; bb 8 artificial_defs: { }
;; bb 8 artificial_uses: { u44(6){ }u45(7){ }u46(16){ }u47(19){ }}
;; lr  in6 [bp] 7 [sp] 16 [argp] 19 [frame] 90
;; lr  use   6 [bp] 7 [sp] 16 [argp] 19 [frame] 90
;; lr  def   0 [ax]
(code_label 34 6 37 8 1 (nil) [2 uses])
(note 37 34 35 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
(insn 35 37 36 8 (set (reg/i:DI 0 ax)
(reg/f:DI 90 [  ])) "x.i":8:1 66 {*movdi_internal}
 (expr_list:REG_DEAD (reg/f:DI 90 [  ])
(nil)))
(insn 36 35 0 8 (use (reg/i:DI 0 ax)) "x.i":8:1 -1
 (nil))
;;  succ:   EXIT [always]  count:114863532 (estimated locally) (FALLTHRU)
;; lr  out   0 [ax] 6 [bp] 7 [sp] 16 [argp] 19 [frame]

With -mvzeroupper, it becomes:

;; basic block 8, loop depth 0, count 114863532 (estimated locally), maybe hot 
;;  prev block 7, next block 1, flags: (HOT_PARTITION, RTL)
;;  pred:   7 [always]  count:6317494 (estimated locally) (FALLTHRU)
;;  4 [5.5% (guessed)]  count:55807731 (estimated locally)
(LOOP_EXIT)
;;  6 [always]  count:52738306 (estimated locally)
;; bb 8 artificial_defs: { }
;; bb 8 artificial_uses: { u-1(7){ }}
;; lr  in0 [ax] 7 [sp] 
;; lr  use   7 [sp]   [ax] is missing.
;; lr  def
;; live  in  0 [ax] 7 [sp]
;; live  gen 
;; live  kill   
(code_label 54 36 53 8 6 (nil) [2 uses])
(note 53 54 51 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
;;  succ:   EXIT [always]  count:114863532 (estimated locally) (FALLTHRU)
;; lr  out   0 [ax] 7 [sp]
;; live  out 0 [ax] 7 [sp]

[Bug c++/90178] [9 Regression] Missed optimization: duplicated terminal basic block with -mavx

2019-04-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90178

--- Comment #3 from H.J. Lu  ---
It is caused by r266358.

[Bug c++/90178] [9 Regression] Missed optimization: duplicated terminal basic block with -mavx

2019-04-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90178

H.J. Lu  changed:

   What|Removed |Added

   Host||ubizjak at gmail dot com

--- Comment #2 from H.J. Lu  ---
Add -mno-vzeroupper fixes it.

[Bug c++/90178] [9 Regression] Missed optimization: duplicated terminal basic block with -mavx

2019-04-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90178

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-04-19
Summary|Missed optimization:|[9 Regression] Missed
   |duplicated terminal basic   |optimization: duplicated
   |block with -mavx|terminal basic block with
   ||-mavx
 Ever confirmed|0   |1