[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

Evan Cheng evan.cheng at apple.com
Wed Oct 28 11:18:37 PDT 2009


On Oct 28, 2009, at 10:58 AM, Bob Wilson wrote:

> 
> On Oct 28, 2009, at 10:41 AM, Dale Johannesen wrote:
> 
>> 
>> On Oct 28, 2009, at 10:38 AMPDT, Chris Lattner wrote:
>> 
>>> 
>>> On Oct 28, 2009, at 10:21 AM, Dale Johannesen wrote:
>>> 
>>>>> If so, yes, I think that would work.  In fact, I think it would  
>>>>> be a
>>>>> good idea.  At -O2, that would mean that we would be optimizing for
>>>>> performance at a small cost in code size.  That's a more aggressive
>>>>> change than mine, but I think it would be a good idea.
>>>>> 
>>>>> Shall I go ahead with that?
>>>> 
>>>> Branch folding is a size optimization.  It would not surprise me if
>>>> turning it off completely at
>>>> -O3 was the right thing for performance.  My only strong belief is
>>>> that any change should be based on measurements, not arguments.
>>> 
>>> Doesn't it also do some code layout to encourage better fall- 
>>> throughs etc?
>> 
>> Yes; I meant tail merging, not all of branch folding, sorry.
>> 
> 
> We could do a combination of these:
> 
> -Os: Tail merge even for 1 instruction tails.
> -O2: Tail merge for > 1 instruction tails.
> -O3: No tail merging.
> 
> The more conservative change I made yesterday was indeed based on  
> measurements.  I agree that is important.


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.

Evan

> 
> _______________________________________________
> 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