[PATCH][RTL-ree] PR rtl-optimization/68194: Restrict copy instruction in presence of conditional moves

Bernd Schmidt bschmidt@redhat.com
Tue Nov 17 23:11:00 GMT 2015

On 11/17/2015 02:03 PM, Kyrill Tkachov wrote:
> +	  || !reg_overlap_mentioned_p (tmp_reg, SET_SRC (PATTERN (cand->insn))))
>  	return false;

> Well, I think the statement we want to make is
> "return false from this function if the two expressions contain the same
> register number".

I looked at it again and I think I'll need more time to really figure 
out what's going on in this pass.

However, about the above... either I'm very confused, or the actual 
statement here is "return false _unless_ the two expressions contain the 
same register number". In the testcase, the regs in question are ax and 
bx, which is then rejected if the patch has been applied.

(gdb) p tmp_reg
(reg:SI 0 ax)
(gdb) p cand->insn
(insn 59 117 60 7 (set (reg:SI 4 si [orig:107 D.1813 ] [107])
         (sign_extend:SI (reg:HI 3 bx [orig:99 D.1813 ] [99])))

And I think it would be better to strengthen that to "return false 
unless registers are identical". (From the above it's clear however that 
a plain rtx_equal_p wouldn't work since there's an extension in the 

Also, I had another look at the testcase. It uses __builtin_printf and 
dg-output, which is at least unusual. Try to use the normal "if (cond) 
abort ()".


More information about the Gcc-patches mailing list