https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92264

--- Comment #34 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48081
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48081&action=edit
gcc10-pr92264-wip.patch

Further updated patch, this one passes bootstrap on both x86_64-linux and
i686-linux and according to the gathered statistics results in significantly
fewer cases of visited_vals.length () > 100 in find_base_term, together with
the var-tracking.c small change posted to gcc-patches from 5530878 to 1253101
cases.
But, so far it causes a few regressions:
gcc.dg/guality/pr36728-{1,3}.c and gcc.dg/guality/pr68860-{1,2}.c at various
optimization levels and ICEs on gcc.target/i386/pr88416.c and
gcc.target/i386/sse-{13,23,24,25,26}.c.  So far I've looked at pr88416.c and
the problem is that DSE now on:
(insn 10 9 11 2 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0  S8 A8])
        (reg:DI 17 flags)) "include/ia32intrin.h":262:10 56 {*pushfldi2}
     (expr_list:REG_DEAD (reg:DI 17 flags)
        (nil)))
(insn 11 10 29 2 (set (reg:DI 85)
        (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0  S8 A8]))
"include/ia32intrin.h":262:10 52 {*popdi1}
     (nil))
"optimizes" it into:
(insn 31 9 10 2 (set (reg:DI 89)
        (reg:DI 17 flags)) "include/ia32intrin.h":262:10 -1
     (nil))
(insn 10 31 11 2 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0  S8 A8])
        (reg:DI 17 flags)) "include/ia32intrin.h":262:10 56 {*pushfldi2}
     (expr_list:REG_DEAD (reg:DI 17 flags)
        (nil)))
(insn 11 10 29 2 (set (reg:DI 85)
        (reg:DI 89)) "include/ia32intrin.h":262:10 66 {*movdi_internal}
     (nil))
This is wrong for 2 reasons.  The newly added insn 31 isn't recognized and DSE
doesn't bother trying to recognize it, and when the pop is optimized away into
just reg to reg assignment, the side-effect (post-increment of sp) is lost.
Wonder if DSE shouldn't punt for autoinc (don't remove stores that have them)
or say try to replace the autoinc with register update, and whether it
shouldn't try to recog new insns it creates.

As for the guality failures, I've so far briefly looked only at the first one,
where we end up with an extra
+(note 84 53 54 2 (var_location arg7 (nil)) NOTE_INSN_VAR_LOCATION)
that wasn't there before.  Will try to understand this one.

Reply via email to