<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Can you check that the `SubInstr->setDesc(get(*));` calls all get factored out of the switch into a single call? I have seen cases where similar constructs do not get factored out and it causes code bloat. If they aren't, replacing the cases with something like</span><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br><div>case X86::SUB64rr:   NewOpcode = X86::CMP64rr;   break;</div><div><br></div><div>and then doing `SubInstr->setDesc(get(NewOpcode));` at the bottom should help reduce code size.</div><div><br></div><div>--Sean Silva</div>
</div><br><div class="gmail_quote">On Wed, May 30, 2012 at 1:55 PM, Manman Ren <span dir="ltr"><<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
SUB with memory operand should not be optimized.<br>
Updated patch is attached.<br>
<span class="HOEnZb"><font color="#888888"><br>
Manman<br>
</font></span><br><br>
On May 30, 2012, at 11:44 AM, Manman Ren wrote:<br>
<br>
><br>
> Hi All,<br>
><br>
> This patch is to optimize generated code from<br>
>       movq    %rdi, %rax<br>
>       subq    %rsi, %rax<br>
>       cmovsq  %rsi, %rdi<br>
>       movq    %rdi, %rax<br>
><br>
> to<br>
>       cmpq    %rsi, %rdi<br>
>       cmovsq  %rsi, %rdi<br>
>       movq    %rdi, %rax<br>
><br>
> The only criterion to perform this optimization is that the actual result of SUB is not used.<br>
><br>
> Thanks,<br>
> Manman<br>
><br>
> <convert_sub_to_cmp.patch><br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br>