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

Duncan Sands baldrick at free.fr
Tue Dec 28 01:25:25 PST 2010

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.

Ciao, Duncan.

More information about the llvm-commits mailing list