[PATCH] D39410: [GVNHoist] Fix non-deterministic sort order of PHIs for identical instructions

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 12:43:21 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316949: [GVNHoist] Fix non-deterministic sort order of PHIs for identical instructions (authored by mgrang).

Changed prior to commit:
  https://reviews.llvm.org/D39410?vs=120764&id=120874#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39410

Files:
  llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp


Index: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
@@ -703,7 +703,7 @@
       // Vector of PHIs contains PHIs for different instructions.
       // Sort the args according to their VNs, such that identical
       // instructions are together.
-      std::sort(CHIs.begin(), CHIs.end(), cmpVN);
+      std::stable_sort(CHIs.begin(), CHIs.end(), cmpVN);
       auto TI = BB->getTerminator();
       auto B = CHIs.begin();
       // [PreIt, PHIIt) form a range of CHIs which have identical VNs.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39410.120874.patch
Type: text/x-patch
Size: 662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171030/7666bdb3/attachment.bin>


More information about the llvm-commits mailing list