[llvm-commits] [PATCH] Update peephole optimization for ARM: modified OptimizeCompare

Jim Grosbach grosbach at apple.com
Wed May 9 15:28:49 PDT 2012


On May 9, 2012, at 3:13 PM, Evan Cheng <evan.cheng at apple.com> wrote:

> 
> On May 9, 2012, at 2:57 PM, Manman Ren wrote:
> 
>> 
>> Hi Steve,
>> 
>> Thanks for reviewing this.
>> Yes, we are removing cmp instruction and replacing sub with subs.
>> I will put more details in the commit log.
>> 
>> I don't have access to rdar:://problem/11081762 at this point and should have it soon.
>>> From my discussion with Jim, it may not be a problem but I should add more testing cases related to rdar://problem/11081762.
> 
> It's not really the same issue as rdar://11081762 (it's confusing!). The transformation you are proposing is correct.

Excellent! I just wanted to raise the question to make sure. It's subtle enough we got it wrong once, so being extra careful seemed best. Thanks, all.

-Jim

> 
> Evan
> 
>> 
>> Thanks,
>> Manman
>> 
>> On May 9, 2012, at 2:41 PM, Stephen Canon wrote:
>> 
>>> Assuming that I understand what is really happening here[1], this does not suffer from the problem that caused <rdar://problem/11081762> and is safe.  That said, a little more clarity about exactly what you're optimizing would be helpful for those playing along at home, Manman.
>>> 
>>> - Steve
>>> 
>>> 1) based on a conversation with Evan, my understanding is that we're looking at a peephole transformation to replace something like:
>>> 
>>> 	sub  r0,  r1,  r3
>>> 	cmp r1,  r3
>>> 
>>> with
>>> 
>>> 	subs r0, r1, r3
>>> 
>>> -- is that correct, manman?
>>> 
>>> On May 9, 2012, at 2:04 PM, Jim Grosbach <grosbach at apple.com> wrote:
>>> 
>>>> Hi Manman,
>>>> 
>>>> There are subtleties here. See <rdar://problem/11081762>.
>>>> 
>>>> -Jim
>>>> 
>>>> On May 8, 2012, at 6:05 PM, Manman Ren wrote:
>>>> 
>>>>> 
>>>>> The purpose is to optimize the following cases:
>>>>> //       sub r1, r3
>>>>> //       cmp r3, r1 or cmp r1, r3
>>>>> //       bge L1
>>>>> 
>>>>> //      sub r1, imm
>>>>> //      cmp r1, imm
>>>>> //      bge L1
>>>>> 
>>>>> //     If the branch instruction can use flag from "sub", then we can eliminate
>>>>> //     the "cmp" instruction.
>>>>> 
>>>>> 
>>>>> Comments are welcome.
>>>>> 
>>>>> Thanks,
>>>>> Manman
>>>>> <peephole_sub_cmp.patch>_______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>> 
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list