summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/GVNHoist.cpp
diff options
context:
space:
mode:
authorMandeep Singh Grang <mgrang@codeaurora.org>2017-10-30 19:42:41 +0000
committerMandeep Singh Grang <mgrang@codeaurora.org>2017-10-30 19:42:41 +0000
commitf83268bd9e2fd087d4396d3b63c87b2bd2641b68 (patch)
treedfc272cdc6d12d1b6f4f72d753da08fa6b9efd8d /llvm/lib/Transforms/Scalar/GVNHoist.cpp
parent3c128cb1e65b6419ab21a8cf9a948d84ce406e42 (diff)
downloadbcm5719-llvm-f83268bd9e2fd087d4396d3b63c87b2bd2641b68.tar.gz
bcm5719-llvm-f83268bd9e2fd087d4396d3b63c87b2bd2641b68.zip
[GVNHoist] Fix non-deterministic sort order of PHIs for identical instructions
Summary: This fixes failure in Transforms/GVNHoist/hoist.ll uncovered by D39245. Reviewers: hiraditya, spop, dberlin Reviewed By: dberlin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39410 llvm-svn: 316949
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVNHoist.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/GVNHoist.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
index c13768d38f6..d77ebdcd975 100644
--- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
@@ -703,7 +703,7 @@ private:
// 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.
OpenPOWER on IntegriCloud