[GVNSink] Remove dependency on SmallPtrSet iteration order.

Found by LLVM_ENABLE_REVERSE_ITERATION.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312156 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2017-08-30 18:46:37 +00:00
parent 62c7c252f8
commit 065862a117

View File

@ -229,12 +229,14 @@ public:
ModelledPHI(const VArray &V, const BArray &B) { ModelledPHI(const VArray &V, const BArray &B) {
std::copy(V.begin(), V.end(), std::back_inserter(Values)); std::copy(V.begin(), V.end(), std::back_inserter(Values));
std::copy(B.begin(), B.end(), std::back_inserter(Blocks)); std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
std::sort(Blocks.begin(), Blocks.end());
} }
/// Create a PHI from [I[OpNum] for I in Insts]. /// Create a PHI from [I[OpNum] for I in Insts].
template <typename BArray> template <typename BArray>
ModelledPHI(ArrayRef<Instruction *> Insts, unsigned OpNum, const BArray &B) { ModelledPHI(ArrayRef<Instruction *> Insts, unsigned OpNum, const BArray &B) {
std::copy(B.begin(), B.end(), std::back_inserter(Blocks)); std::copy(B.begin(), B.end(), std::back_inserter(Blocks));
std::sort(Blocks.begin(), Blocks.end());
for (auto *I : Insts) for (auto *I : Insts)
Values.push_back(I->getOperand(OpNum)); Values.push_back(I->getOperand(OpNum));
} }