i386: Clear REG_UNUSED and REG_DEAD notes from the IL at the end of vzeroupper pass...
commitd413df070ba5efadd2fb8b6c6aa6003b8cae617b
authorJakub Jelinek <jakub@redhat.com>
Mon, 5 Feb 2024 08:33:26 +0000 (5 09:33 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 5 Feb 2024 08:35:57 +0000 (5 09:35 +0100)
tree91752b8e1a77fd5d769fcdadc8e4f8e64c45bb62
parent5b281946c4b51132caf5e5b64c730fef92dd6123
i386: Clear REG_UNUSED and REG_DEAD notes from the IL at the end of vzeroupper pass [PR113059]

The move of the vzeroupper pass from after reload pass to after
postreload_cse helped only partially, CSE-like passes can still invalidate
those notes (especially REG_UNUSED) if they use some earlier register
holding some value later on in the IL.

So, either we could try to move it one pass further after gcse2 and hope
no later pass invalidates the notes, or the following patch attempts to
restore the REG_DEAD/REG_UNUSED state from GCC 13 and earlier, where
the LRA or reload passes remove all REG_DEAD/REG_UNUSED notes and the notes
reappear only at the start of dse2 pass when it calls
  df_note_add_problem ();
  df_analyze ();
So, effectively
          NEXT_PASS (pass_postreload_cse);
          NEXT_PASS (pass_gcse2);
          NEXT_PASS (pass_split_after_reload);
          NEXT_PASS (pass_ree);
          NEXT_PASS (pass_compare_elim_after_reload);
          NEXT_PASS (pass_thread_prologue_and_epilogue);
passes operate without those notes in the IL.
While in GCC 14 mode switching computes the notes problem at the start of
vzeroupper, the patch below removes them at the end of the pass again, so
that the above passes continue to operate without them.

2024-02-05  Jakub Jelinek  <jakub@redhat.com>

PR target/113059
* config/i386/i386-features.cc (rest_of_handle_insert_vzeroupper):
Remove REG_DEAD/REG_UNUSED notes at the end of the pass before
df_analyze call.
gcc/config/i386/i386-features.cc