[LLVMdev] instruction combiner patch
Nick Lewycky
nicholas at mxc.ca
Wed Jun 7 00:17:17 PDT 2006
I once wrote:
> I've patched the instruction combiner to return UndefValue when the
> index is constant and known to be out of range for either an ArrayType
> or PackedType.
That patch had to be removed as it broke SPEC. I've since updated the
patch, and am ready to break spec again. ;-) This patch adds constant
folding of multidimensional arrays even when the index to those arrays
is a single value, ala:
int x[2][2] = { {40, 41}, {42, 43} };
int *y = x;
return y[2];
becomes:
return 42;
Similarly, it also generates undef on out of range arrays, but only if
it's out of the range of the whole multi-dimensional array this time.
Patch attached.
Nick Lewycky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multidimensionalindex.patch
Type: text/x-patch
Size: 8076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060607/823e45fe/attachment.bin>
More information about the llvm-dev
mailing list