search for: nsum1

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

Did you mean: sum1
2016 May 04
2
GVN pass: does global value numbering remove duplicate computations in loops?
...hich 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 updated with the same value, and so merge them into a single accumulator. However, the assembly output still contains both accumulators: $ gcc sums.c -c -O3 -save-temps . . ....
2016 May 04
2
GVN pass: does global value numbering remove duplicate computations in loops?
...> > 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 updated with the same value, and so merge > > them into a single accumulator. > > The current GVN uses a v...