[llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td
Bill Wendling
isanbard at gmail.com
Fri Dec 7 16:34:58 PST 2007
On Dec 7, 2007 2:24 PM, Chris Lattner <clattner at apple.com> wrote:
>
> I know you're kidding, but have you benchmarked this on the G5? In
> this specific case, "foo" is probably MUCH faster because the loop is
> one dispatch group instead of two (I think). :)
>
It made this program slower:
$ cat t.c
#include <stdio.h>
#define SIZE 100000
int arr[SIZE];
__attribute__((noinline)) void foo(int *arr, unsigned size) {
unsigned i = 0;
do {
arr[i++] = 0;
} while (i < size);
}
int main() {
int i;
for (i = 0; i < SIZE; ++i)
foo(arr, SIZE);
return 0;
}
$ time ./t.old
real 0m15.107s
user 0m15.095s
sys 0m0.012s
$ time ./t.new
real 0m20.088s
user 0m20.075s
sys 0m0.013s
But when I set the alignment of the loop in main to 8, it got slightly faster:
$ time ./t.new
real 0m15.090s
user 0m15.079s
sys 0m0.010s
So there's some type of alignment thing that's getting in the way, but
it's encouraging for an initial pass that moved 3 instructions total.
:-)
-bw
More information about the llvm-commits
mailing list