This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: another version of patch to solve the PR37535


Vladimir Makarov wrote:
Lin Weiliang reported a big degradation (about 20%) for SPEC2006 omnetpp after submitting previous version of the patch to solve PR37535. The patch was ok with safety point of view but it introduced
additional conflicts in some cases. The conflicts
were not necessary. Please, look at one example


(insn:HI 11 10 12 2 libs/sim/cenum.cc:157 (parallel [
          (set (reg:SI 72)
              (div:SI (reg:SI 69)
                  (reg:SI 64 [ D.26312 ])))
          (set (reg:SI 71)
              (mod:SI (reg:SI 69)
                  (reg:SI 64 [ D.26312 ])))
          (clobber (reg:CC 17 flags))
      ]) 354 {*divmodsi4_nocltd} (expr_list:REG_DEAD (reg:SI 69)
      (expr_list:REG_UNUSED (reg:SI 72)
          (expr_list:REG_UNUSED (reg:CC 17 flags)
              (nil)))))

and the insn description

(define_insn "*divmodsi4_nocltd"
[(set (match_operand:SI 0 "register_operand" "=&a,?a")
  (div:SI (match_operand:SI 2 "register_operand" "1,0")
      (match_operand:SI 3 "nonimmediate_operand" "rm,rm")))
 (set (match_operand:SI 1 "register_operand" "=&d,&d")
  (mod:SI (match_dup 2) (match_dup 3)))
 (clobber (reg:CC FLAGS_REG))]
"optimize_function_for_speed_p (cfun) && !TARGET_USE_CLTD"
"#"
[(set_attr "type" "multi")])

IRA after the patch makes 71 and 72 conflicting with 69 because 71
and 72 are early clobbers.  That results in degradation.  The old RA
checks conflicts more accurately.  It checks classes of inputs and
early clobbers.  For the first alternative and zero and 2nd operand or
the 2nd alternative and 1st and 2nd operands, they are DREG and AREG
and therefore can not conflict.  For 1st alternative and 1st and 2nd
operands, they are the same operands and therefore can not conflict
again.

The following patch solves omnetpp performance degradation by checking conflicts for early clobber as accurate as possible. It checks register classes in insn constraints to avoid unnecessary conflicts. The old register allocator checks analogously (see ra-conflicts.c) although I found the old RA does it wrong processing operand matches (0-9).

The patch was thorougly tested as the previous version (x86, x86_64, ppc64, ppc64 in 32-bit mode, itanium, x86 under darwin) and no additional failures are introduced.

Ok to commit?

2008-10-14 Vladimir Makarov <vmakarov@redhat.com>

    PR middle-end/37535
    * ira-lives.c (mark_early_clobbers): Remove.
    (make_pseudo_conflict, check_and_make_def_use_conflicts,
    check_and_make_def_conflicts,
    make_early_clobber_and_input_conflicts,
    mark_hard_reg_early_clobbers): New functions.
    (process_bb_node_lives): Call
    make_early_clobber_and_input_conflicts and
    mark_hard_reg_early_clobbers.  Make hard register inputs live
    again.

* doc/rtl.texi (clobber): Change descriotion of RA behaviour for
early clobbers of pseudo-registers.



OK. Please install.

I'll note this kind of situation may be the counter-example to the general idea that we want aggregated cover classes rather than component cover classes, though my spot-checking of a few ports seems to indicate usually the register classes for the inputs usually overlap with the register classes for the earlyclobbers.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]