[PATCH] D24593: Standford/Bubble sort code restructure

Evgeny Stupachenko via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 17:29:51 PDT 2016


evstupac added inline comments.

================
Comment at: SingleSource/Benchmarks/Stanford/Bubblesort.c:135
@@ -134,3 +134,3 @@
 	    /* converted constants to long in next stmt, typecast back to int WR*/
 	    sortlist[i] = (int)(temp - (temp/100000L)*100000L - 50000L);
 	    if ( sortlist[i] > biggest ) biggest = sortlist[i];
----------------
No, while array is defined as

```
int sortlist[sortelements+1]
```
And this will fail as well as further in the code:

```
if ( (sortlist[1] != littlest) || (sortlist[srtelements] != biggest) )
```
But I agree let's do not focus on this. I remove these changes.

================
Comment at: SingleSource/Benchmarks/Stanford/Bubblesort.c:159
@@ -156,1 +158,3 @@
+			sortlist[i] = sli;
+			sortlist[i + 1] = sli1;
 			i=i+1;
----------------
The flakiness caused by unpredictable memory accesses to array and code on short distance:

Loop:

```
if (a[i] > a[i + 1) {// load a[i], a[i+1];
//store to a[i], a[i+1];
}
```

Making stores unconditional will simplify memory accesses and potentially CFG.
This will open the test for compiler optimizations (like unroll, scalar replacement, if conversion...).
Generally the idea to convert the test from memory test to compiler test.


https://reviews.llvm.org/D24593





More information about the llvm-commits mailing list