On 05/20/2011 05:39 AM, Kirill Batuzov wrote: > + case INDEX_op_or_i32: > + case INDEX_op_and_i32: > +#if TCG_TARGET_REG_BITS == 64 > + case INDEX_op_and_i64: > + case INDEX_op_or_i64: > +#endif > + if (args[1] == args[2]) { > + if (args[1] == args[0]) { > + args += 3; > + gen_opc_buf[op_index] = INDEX_op_nop; > + } else {
I do wonder if it would be better to split this sort of optimization out into a different function. You're applying identity sorts of functions here, where you're not doing it for other operations, such as x + 0. Indeed, I'll argue that 0+x is more likely to happen than x|x, given that the 0 value could have been relocation filled in by the linker. Consider @hi16 and @lo16 relocation pairs when the symbol happens to be linked into the low 64k of the address space. r~