> Here is an untested patch (only tried the cmpelim_mult_uses_1.c testcase in > aarch64 cross) that does that. I don't have aarch64 boxes around for easy > trunk testing, can bootstrap/regtest it on x86_64-linux/i686-linux and > maybe powerpc64le-linux though. > > If the memset (last_setter, 0, sizeof (last_setter)); for each bb is a > problem (maybe for ia64/mmix/mips which have huge numbers of hard > registers), one possibility would be to put the array into > find_comparison_dom_walker class, clear it only in the constructor and have > next to it an auto_vec into which we'd push the REGNOs we've set > last_setter to non-NULL where previously they were NULL, then instead of > clearing the whole vector we'd just pop all the REGNOs from the vector and > clear just those. > One extra advantage would be that we could also cheaply clear the > last_setter entries when seeing some following flags setter, user, > call/jump/asm_input (stuff that can_merge_compare_into_arith verifies). > > 2017-10-31 Jakub Jelinek <ja...@redhat.com> > > PR rtl-optimization/82778 > PR rtl-optimization/82597 > * compare-elim.c (struct comparison): Add in_a_setter field. > (find_comparison_dom_walker::before_dom_children): Remove killed > bitmap and df_simulate_find_defs call, instead walk the defs. > Compute last_setter and initialize in_a_setter. Merge definitions > with first initialization for a few variables. > (try_validate_parallel): Use insn_invalid_p instead of > recog_memoized. Return insn rather than just the pattern. > (try_merge_compare): Fix up comment. Don't uselessly test if > in_a is a REG_P. Use cmp->in_a_setter instead of walking UD > chains. > > * g++.dg/opt/pr82778.C: New test. > > 2017-10-31 Michael Collison <michael.colli...@arm.com> > > PR rtl-optimization/82597 > * gcc.dg/pr82597.c: New test.
That's a clear progress, but the patch doesn't fully get rid of use-def and def-use chains, does it? -- Eric Botcazou