[LLVMdev] Optimization of array access
Michael Smith
Michael.Smith at synopsys.com
Mon Nov 21 08:58:18 PST 2011
I've attached a 2 examples of patterns for updating an array. They're simplified examples of some code generation I'm doing where I need to pass a large, unknown number of arguments (ints, doubles, pointers to other information) to a function.
The two patterns are:
Stack[0] = 0;
Stack[1] = 1;
Stack[2] = 42;
And
Int I = 0;
Stack[i++] = 0;
Stack[i++] = 1;
Stack[i++] = 42;
I've found that the optimizer is much faster at handling the 2nd pattern than the 1st. With 3000 assignments - as in the examples attached - "opt -std-compile-opts -S func1.ll -o func1.opt" takes 10 seconds, while func2.ll takes 0.2s. Anyone have any ideas why?
I've tested with LLVM 2.9, and LLVM 3.0 RC1.
Regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111121/8bd28fe3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt.zip
Type: application/x-zip-compressed
Size: 196440 bytes
Desc: opt.zip
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111121/8bd28fe3/attachment.bin>
More information about the llvm-dev
mailing list