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

Frits van Bommel fvbommel at gmail.com
Sat Mar 26 01:20:34 PDT 2011


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.

> 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 :).




More information about the llvm-commits mailing list