static unsigned int
rest_of_handle_insert_vzeroupper (void)
{
- /* vzeroupper instructions are inserted immediately after reload to
- account for possible spills from 256bit or 512bit registers. The pass
- reuses mode switching infrastructure by re-running mode insertion
- pass, so disable entities that have already been processed. */
+ /* vzeroupper instructions are inserted immediately after reload and
+ postreload_cse to clean up after it a little bit to account for possible
+ spills from 256bit or 512bit registers. The pass reuses mode switching
+ infrastructure by re-running mode insertion pass, so disable entities
+ that have already been processed. */
for (int i = 0; i < MAX_386_ENTITIES; i++)
ix86_optimize_mode_switching[i] = 0;
REPLACE_PASS (PASS, INSTANCE, TGT_PASS)
*/
- INSERT_PASS_AFTER (pass_reload, 1, pass_insert_vzeroupper);
+ INSERT_PASS_AFTER (pass_postreload_cse, 1, pass_insert_vzeroupper);
INSERT_PASS_AFTER (pass_combine, 1, pass_stv, false /* timode_p */);
/* Run the 64-bit STV pass before the CSE pass so that CONST0_RTX and
CONSTM1_RTX generated by the STV pass can be CSEed. */
--- /dev/null
+/* PR rtl-optimization/112760 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-dce -fno-guess-branch-probability --param=max-cse-insns=0" } */
+/* { dg-additional-options "-m8bit-idiv -mavx" { target i?86-*-* x86_64-*-* } } */
+
+unsigned g;
+
+__attribute__((__noipa__)) unsigned short
+foo (unsigned short a, unsigned short b)
+{
+ unsigned short x = __builtin_add_overflow_p (a, g, (unsigned short) 0);
+ g -= g / b;
+ return x;
+}
+
+int
+main ()
+{
+ unsigned short x = foo (40, 6);
+ if (x != 0)
+ __builtin_abort ();
+}