[PATCH] D39947: [OpenMP] Stable sort Privates to remove non-deterministic ordering
Mandeep Singh Grang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 28 12:41:46 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL319222: [OpenMP] Stable sort Privates to remove non-deterministic ordering (authored by mgrang).
Changed prior to commit:
https://reviews.llvm.org/D39947?vs=122751&id=124622#toc
Repository:
rL LLVM
https://reviews.llvm.org/D39947
Files:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
Index: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4056,9 +4056,9 @@
return TaskPrivatesMap;
}
-static int array_pod_sort_comparator(const PrivateDataTy *P1,
- const PrivateDataTy *P2) {
- return P1->first < P2->first ? 1 : (P2->first < P1->first ? -1 : 0);
+static bool stable_sort_comparator(const PrivateDataTy P1,
+ const PrivateDataTy P2) {
+ return P1.first > P2.first;
}
/// Emit initialization for private variables in task-based directives.
@@ -4286,8 +4286,7 @@
/*PrivateElemInit=*/nullptr)));
++I;
}
- llvm::array_pod_sort(Privates.begin(), Privates.end(),
- array_pod_sort_comparator);
+ std::stable_sort(Privates.begin(), Privates.end(), stable_sort_comparator);
auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
// Build type kmp_routine_entry_t (if not built yet).
emitKmpRoutineEntryT(KmpInt32Ty);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39947.124622.patch
Type: text/x-patch
Size: 1150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171128/7b2afd89/attachment.bin>
More information about the cfe-commits
mailing list