[llvm-commits] [llvm] r85441 - in /llvm/trunk: lib/CodeGen/BranchFolding.cpp test/CodeGen/X86/2008-02-18-TailMergingBug.ll test/CodeGen/X86/2008-05-12-tailmerge-5.ll test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll

Bob Wilson bob.wilson at apple.com
Thu Oct 29 11:37:38 PDT 2009


On Oct 28, 2009, at 5:17 PM, Chris Lattner wrote:

> On Oct 28, 2009, at 3:10 PM, Bob Wilson wrote:
>
> Hi Bob,
>
>> +      // minCommonTailLength instructions in common.  Otherwise,  
>> if we are
>> +      // optimizing for code size, 1 instruction in common is  
>> enough.  At
>> +      // worst we will be replacing a fallthrough into the common  
>> tail with a
>> +      // branch, which at worst breaks even with falling through  
>> into the
>> +      // duplicated common tail.  We will always pick a block we  
>> do not have
>> +      // to split as the common tail if there is one.  (Empty  
>> blocks will get
>> +      // forwarded and need not be considered.)
>> +      MachineFunction *MF = CurMPIter->second->getParent();
>>      if (CommonTailLen >= minCommonTailLength ||
>>          (CommonTailLen > 0 &&
>> -           (TrialBBI1==CurMPIter->second->begin() ||
>> -            TrialBBI2==I->second->begin()))) {
>> +           MF->getFunction()->hasFnAttr 
>> (Attribute::OptimizeForSize) &&
>> +           (TrialBBI1 == CurMPIter->second->begin() ||
>> +            TrialBBI2 == I->second->begin()))) {
>>        if (CommonTailLen > maxCommonTailLength) {
>>          SameTails.clear();
>>          maxCommonTailLength = CommonTailLen;
>
> I know that you're probably not the one to blame, but could you  
> factor out this insane predicate into a static helper function that  
> returns a bool?

OK.  I cleaned it up a bit.



More information about the llvm-commits mailing list