[llvm-commits] [llvm] r122567 - /llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Chris Lattner clattner at apple.com
Tue Dec 28 10:51:14 PST 2010

On Dec 28, 2010, at 1:25 AM, Duncan Sands wrote:

> Hi Chris,
>>>> +  // Check to see if the store updates all bits in memory.  We don't want to
>>>> +  // process things like a store of i3.  We also require that the store be a
>>>> +  // multiple of a byte.
>>>> +  uint64_t SizeInBits = TD->getTypeSizeInBits(StoredVal->getType());
>>>> +  if ((SizeInBits&   7) || (SizeInBits>>   32) != 0 ||
>>>> +      SizeInBits != TD->getTypeStoreSizeInBits(StoredVal->getType()))
>>>> +    return false;
>>> will this catch the case of storing a first class struct or array?
>> I'm not sure what you mean.  My intent is to start simple and just handle strided stores that satisfy isBytewiseValue.  There are many interesting forms of loops that aren't like this, they will be added over time.
> suppose that the store is of a first class value.  The above test is not
> sufficient to check that the store updates all bits in memory in this case.
> It is true that isBytewiseValue will return false for a first class struct,
> so it doesn't matter much.  However if you are going to test that a store
> updates all bits it seems wiser to me to catch all cases.  On the other hand
> you could just drop that part of the test and rely on isBytewiseValue.  After
> all it returns false for i3 too.

Fair point, I'll rely on isBytewiseValue, thanks.


More information about the llvm-commits mailing list