[PATCH] D24593: Standford/Bubble sort code restructure
Evgeny Stupachenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 17:11:07 PDT 2016
evstupac added inline comments.
================
Comment at: SingleSource/Benchmarks/Stanford/Bubblesort.c:134
@@ -133,1 +133,3 @@
+ biggest = sortlist[1]; littlest = sortlist[1];
+ for ( i = 2; i <= srtelements; i++ ) {
temp = Rand();
----------------
mehdi_amini wrote:
> I don't understand why this change? (i.e. it should be at least documented).
Ok. We can skip this. Yes this one is just peeling and set MAX (biggest) and MIN (littlest) to sortlist element. Otherwise it could happen that MAX (biggest) and/or MIN (littlest) will stay 0 after the Init loop.
That is just potential bug if we change array length or rand algorithm. In the test we have sortlist elements that are bigger and less than 0.
================
Comment at: SingleSource/Benchmarks/Stanford/Bubblesort.c:160
@@ -156,1 +159,3 @@
+ sortlist[i] = sli;
+ sortlist[i + 1] = sli1;
i=i+1;
----------------
The flakiness is here. And the change allows to avoid the flakiness.
https://reviews.llvm.org/D24593
More information about the llvm-commits
mailing list