[PATCH] D44875: [XCore] Change std::sort to llvm::sort in response to r327219

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 24 11:46:32 PDT 2018


mgrang created this revision.
mgrang added reviewers: dblaikie, RKSimon, robertlytton.

r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in https://reviews.llvm.org/D44363 for a list of all the required patches.


Repository:
  rL LLVM

https://reviews.llvm.org/D44875

Files:
  lib/Target/XCore/XCoreFrameLowering.cpp
  lib/Target/XCore/XCoreLowerThreadLocal.cpp


Index: lib/Target/XCore/XCoreLowerThreadLocal.cpp
===================================================================
--- lib/Target/XCore/XCoreLowerThreadLocal.cpp
+++ lib/Target/XCore/XCoreLowerThreadLocal.cpp
@@ -129,7 +129,7 @@
 static bool replaceConstantExprOp(ConstantExpr *CE, Pass *P) {
   do {
     SmallVector<WeakTrackingVH, 8> WUsers(CE->user_begin(), CE->user_end());
-    std::sort(WUsers.begin(), WUsers.end());
+    llvm::sort(WUsers.begin(), WUsers.end());
     WUsers.erase(std::unique(WUsers.begin(), WUsers.end()), WUsers.end());
     while (!WUsers.empty())
       if (WeakTrackingVH WU = WUsers.pop_back_val()) {
Index: lib/Target/XCore/XCoreFrameLowering.cpp
===================================================================
--- lib/Target/XCore/XCoreFrameLowering.cpp
+++ lib/Target/XCore/XCoreFrameLowering.cpp
@@ -151,7 +151,7 @@
                                       Offset,
                                       FramePtr));
   }
-  std::sort(SpillList.begin(), SpillList.end(), CompareSSIOffset);
+  llvm::sort(SpillList.begin(), SpillList.end(), CompareSSIOffset);
 }
 
 /// Creates an ordered list of EH info register 'spills'.
@@ -170,7 +170,7 @@
   SpillList.push_back(
       StackSlotInfo(EHSlot[0], MFI.getObjectOffset(EHSlot[1]),
                     TL->getExceptionSelectorRegister(PersonalityFn)));
-  std::sort(SpillList.begin(), SpillList.end(), CompareSSIOffset);
+  llvm::sort(SpillList.begin(), SpillList.end(), CompareSSIOffset);
 }
 
 static MachineMemOperand *getFrameIndexMMO(MachineBasicBlock &MBB,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44875.139726.patch
Type: text/x-patch
Size: 1553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180324/8bc6f403/attachment.bin>


More information about the llvm-commits mailing list