1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[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
This commit is contained in:
Mandeep Singh Grang 2017-10-30 19:42:41 +00:00
parent c48c10f794
commit 67b94b1157

View File

@ -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.