[llvm-commits] [llvm] r48909 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Chris Lattner
clattner at apple.com
Fri Mar 28 08:51:17 PDT 2008
On Mar 28, 2008, at 2:19 AM, Duncan Sands wrote:
> Hi Chris,
>
>> + // If we found less than 4 stores to merge, ignore the
>> subrange: it isn't
>> + // worth losing type information in llvm IR to do the
>> transformation.
>> + if (Range.TheStores.size() < 4)
>> + continue;
>
> is this counting bytes stored, or store instructions?
This is checking # stores. I'm open to suggestions, this is certainly
work in progress. The idea is that merging just a few stores could be
done by the code generator, turning them into a larger scalar store.
What I want the optimizer to get is to turn huge sequences of stores
into memset. For example, the testcase I'm working from looks like:
typedef struct {
short mvx;
short mvy;
} MV;
extern void foo(MV *, MV *, char *);
int t()
{
MV up_mvd[8], left_mvd[8], mv_zero = {0,0};
char ref_idx[8];
ref_idx[0] = ref_idx[1] = ref_idx[2] = ref_idx[3] = ref_idx[4] =
ref_idx[5] = ref_idx[6] = ref_idx[7] = -1;
up_mvd[0] = up_mvd[1] = up_mvd[2] = up_mvd[3] = up_mvd[4] =
up_mvd[5] = up_mvd[6] = up_mvd[7] = mv_zero;
left_mvd[0] = left_mvd[1] = left_mvd[2] = left_mvd[3] = left_mvd[4]
= left_mvd[5] = left_mvd[6] = left_mvd[7] = mv_zero;
foo(up_mvd, left_mvd, ref_idx);
}
The assignments into up_mvd/left_mvd should be memsets. The ref_idx
should be one 8-byte store or 2 32-bit ones.
Suggestions for heuristics are welcome!
> PS: Feel free to ignore my previous email: I thought you were trying
> to
> maintain one range rather than a bunch of them.
Ok :)
-Chris
More information about the llvm-commits
mailing list