[llvm-commits] [llvm] r95628 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Support/StandardPasses.h include/llvm/Transforms/Scalar.h lib/Transforms/Scalar/ObjectSizeLowering.cpp test/Transforms/InstCombine/objsize.ll test/Transforms/ObjSizeLower/ test/Transforms/ObjSizeLower/objsize.ll

Eric Christopher echristo at apple.com
Mon Feb 8 17:10:06 PST 2010


On Feb 8, 2010, at 4:58 PM, Chris Lattner wrote:

> 
> On Feb 8, 2010, at 4:35 PM, Eric Christopher wrote:
> 
>> Author: echristo
>> Date: Mon Feb  8 18:35:38 2010
>> New Revision: 95628
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=95628&view=rev
>> Log:
>> Add a new pass to do llvm.objsize lowering using SCEV.
>> Initial skeleton and SCEVUnknown lowering implemented,
>> the rest should come relatively quickly.  Move testcase
>> to new directory.
>> 
>> Move pass to right before SimplifyLibCalls - which is
>> moved down a bit so we can take advantage of a few opts.
> 
> Why is this using SCEV?  Isn't this massive overkill?  How smart does this really need to be?

Right now, yes, it's a big hammer. However, for various different permutations of geps etc I found I was duplicating (iteratively) a lot of SCEV's internal code to determine offsets into objects etc.

Ideally we'd also like to use that along with loop information to be able to tell something like this:

char buffer[128];

for (int i = 0; i < 128; i++)
   strcpy(buffer[i], "f")

or assorted and tell that we're not going to overrun the buffer and lower to an explicit strcpy instead of the checking version.

-eric



More information about the llvm-commits mailing list