[llvm-commits] [llvm] r85346 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/BranchFolding.cpp lib/CodeGen/BranchFolding.h lib/CodeGen/IfConversion.cpp lib/CodeGen/LLVMTargetMachine.cpp lib/Target/ARM/ARMTargetMachine.cpp

Chris Lattner clattner at apple.com
Wed Oct 28 20:55:00 PDT 2009


On Oct 28, 2009, at 7:56 PM, Sandeep Patel wrote:

> On Wed, Oct 28, 2009 at 8:24 PM, Chris Lattner <clattner at apple.com>  
> wrote:
>> On Oct 28, 2009, at 11:18 AM, Evan Cheng wrote:
>>>
>>> This is tricky. I don't think there is a *right* answer. On x86, I
>>> don't believe the extra branch matters. To me, tail merge for 1
>>> instruction tails is not saving much code size and it's potentially
>>> bad for performance. We should disable it except for -Os.
>>>
>>> I don't know if we want to differentiate between -O2 and -O3 here.
>>> We either do tail merging or we disable tail merging. Unless we can
>>> show it does hurt performance I'd prefer to leave it along.
>>
>> I agree with Evan: the only case that should change is tail merge  
>> of 1
>> instruction, which should be enabled at -Os only, and only when it
>> actually reduces # instructions.  O2 and O3 should have the same
>> policy IMO.
>
> On ARM, a simple BX_RET can be folded into any conditional branch that
> points at it, so tail merging even 1 instruction may help.
>
> PPC also has conditional returns, right?

Yes on both counts.  To be perfectly clear, I only meant when there  
would also have to be unconditional branch after the single  
instruction.  If it is the last branch (e.g. a no return call, return,  
etc) then go for it :)

-Chris



More information about the llvm-commits mailing list