[llvm-commits] [llvm] r128332 - /llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp

Bill Wendling isanbard at gmail.com
Sat Mar 26 02:34:12 PDT 2011


On Mar 26, 2011, at 1:20 AM, Frits van Bommel wrote:

> On Sat, Mar 26, 2011 at 9:02 AM, Bill Wendling <isanbard at gmail.com> wrote:
>> +  // The later store completely overlaps the earlier store if:
>> +  //
>> +  // 1. Both start at the same offset and the later one's size is greater than
>> +  //    or equal to the earlier one's, or
>> +  //
>> +  //      |--earlier--|
>> +  //      |--   later   --|
>> +  //
>> +  // 2. The earlier store has an offset greater than the later offset, but which
>> +  //    still lies completely within the later store.
>> +  //
>> +  //        |--earlier--|
>> +  //    |-----  later  ------|
>> +  if ((EarlierOff == LaterOff && Earlier.Size <= Later.Size) ||
>> +      (EarlierOff > LaterOff &&
>> +       EarlierOff + Earlier.Size <= LaterOff + Later.Size))
> 
> This simplifies to
> 
>    if (EarlierOff >= LaterOff && EarlierOff + Earlier.Size <=
> LaterOff + Later.Size)
> 
> since adding an equal offset on both sides of a comparison doesn't
> change its result.
> 
Sure. I knew it could be simplified, but I wanted to keep the logic simple because it was hard for me to follow in the first place. :) I can change it though.

>> There are two ways that a later store can comletely overlap a previous store:
> 
> So I guess there's really only *one* way the later store can
> completely overlap the first :).
> 
If you want to get technical about it. ;-)

-bw






More information about the llvm-commits mailing list