[llvm-commits] [llvm] r69631 - /llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp

Evan Cheng evan.cheng at apple.com
Mon Apr 20 15:32:50 PDT 2009


On Apr 20, 2009, at 3:25 PM, Evan Cheng wrote:

>
> On Apr 20, 2009, at 3:19 PM, Dale Johannesen wrote:
>
>> Author: johannes
>> Date: Mon Apr 20 17:19:33 2009
>> New Revision: 69631
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=69631&view=rev
>> Log:
>> Adjust loop size estimate for full unrolling;
>> GEP's don't usually become instructions.
>
> Well... That's not entirely true. Each GEP can also become a several
> instructions. Is there a test case to demonstrate the merit of this
> change?
>

How about changing it to what InlineCost.cpp does?

       } else if (const GetElementPtrInst *GEPI =
                  dyn_cast<GetElementPtrInst>(II)) {
         // If a GEP has all constant indices, it will probably be  
folded with
         // a load/store.
         bool AllConstant = true;
         for (unsigned i = 1, e = GEPI->getNumOperands(); i != e; ++i)
           if (!isa<ConstantInt>(GEPI->getOperand(i))) {
             AllConstant = false;
             break;
           }
         if (AllConstant) continue;


Evan

> Evan
>
>>
>>
>>
>> Modified:
>>   llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp?rev=69631&r1=69630&r2=69631&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> = 
>> =====================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Mon Apr 20
>> 17:19:33 2009
>> @@ -89,6 +89,8 @@
>>        // Ignore instructions only used by the loop terminator.
>>      } else if (isa<DbgInfoIntrinsic>(I)) {
>>        // Ignore debug instructions
>> +      } else if (isa<GetElementPtrInst>(I) && I->hasOneUse()) {
>> +        // Ignore GEP as they generally are subsumed into a load or
>> store.
>>      } else if (isa<CallInst>(I)) {
>>        // Estimate size overhead introduced by call instructions
>> which
>>        // is higher than other instructions. Here 3 and 10 are magic
>>
>>
>> _______________________________________________
>> 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