search for: b01_sum

Displaying 2 results from an estimated 2 matches for "b01_sum".

Did you mean: b01_sums
2016 May 04
2
GVN pass: does global value numbering remove duplicate computations in loops?
...t global value numbering, and from what I understand, there are polynomial time algorithms for removing duplicate computations from loops[1]. I have an example program[2] which computes the sum of an array twice, in two separate accumulators. Here, sum0 and sum1 are both sums of the array A. void b01_sums(int size, int* A) { int sum0 = 0; int sum1 = 0; for (int i = 0; i != size; ++i) { sum0 = sum0 + A[i]; sum1 = sum1 + A[i]; printf("sum0: %d\nsum1: %d\n", sum0, sum1); } } I would have expected global value numbering to see that sum0 and sum1 are initialised and upda...
2016 May 04
2
GVN pass: does global value numbering remove duplicate computations in loops?
...uplicate computations from loops[1]. > > Yes > The current GVN will not do it. > > I have an example program[2] which computes the sum of an array > > twice, in two separate accumulators. > > > Here, sum0 and sum1 are both sums of the array A. > > > void b01_sums(int size, int* A) > > > { > > > int sum0 = 0; > > > int sum1 = 0; > > > for (int i = 0; i != size; ++i) > > > { > > > sum0 = sum0 + A[i]; > > > sum1 = sum1 + A[i]; > > > printf("sum0: %d\nsum1: %d\n", sum0,...