On Mon, Feb 16, 2015 at 11:26 AM, Thomas Preud'homme wrote: > /* Subroutine of cprop_insn that tries to propagate constants into > @@ -1044,40 +1042,41 @@ cprop_insn (rtx_insn *insn)
> - /* Constant propagation. */ > - if (cprop_constant_p (src)) > - { > - if (constprop_register (reg_used, src, insn)) > + /* Constant propagation. */ > + if (src_cst && cprop_constant_p (src_cst) > + && constprop_register (reg_used, src_cst, insn)) > { > changed_this_round = changed = 1; > global_const_prop_count++; The cprop_constant_p test is redundant, you only have non-NULL src_cst if it is a cprop_constant_p (as you test for it in find_avail_set()). > @@ -1087,18 +1086,16 @@ retry: > "GLOBAL CONST-PROP: Replacing reg %d in ", regno); > fprintf (dump_file, "insn %d with constant ", > INSN_UID (insn)); > - print_rtl (dump_file, src); > + print_rtl (dump_file, src_cst); > fprintf (dump_file, "\n"); > } > if (insn->deleted ()) > return 1; > } > - } > - else if (REG_P (src) > - && REGNO (src) >= FIRST_PSEUDO_REGISTER > - && REGNO (src) != regno) > - { > - if (try_replace_reg (reg_used, src, insn)) > + else if (src_reg && REG_P (src_reg) > + && REGNO (src_reg) >= FIRST_PSEUDO_REGISTER > + && REGNO (src_reg) != regno > + && try_replace_reg (reg_used, src_reg, insn)) Likewise for the REG_P and ">= FIRST_PSEUDO_REGISTER" tests here (with the equivalent and IMHO preferable HARD_REGISTER_P test in find_avail_set()). Looks good to me otherwise. Ciao! Steven