[ConstraintElimination] Use stable_sort to sort worklist.

If there are multiple constraints in the same block, at the moment the
order they are processed may be different depending on the sort
implementation.

Use stable_sort to ensure consistent ordering.
This commit is contained in:
Florian Hahn 2022-06-23 18:46:15 +02:00
parent 6e6889288c
commit d9526e8a52
No known key found for this signature in database
GPG Key ID: CF59919C6547A668
1 changed files with 1 additions and 1 deletions

View File

@ -679,7 +679,7 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT) {
// come before blocks and conditions dominated by them. If a block and a
// condition have the same numbers, the condition comes before the block, as
// it holds on entry to the block.
sort(S.WorkList, [](const ConstraintOrBlock &A, const ConstraintOrBlock &B) {
stable_sort(S.WorkList, [](const ConstraintOrBlock &A, const ConstraintOrBlock &B) {
return std::tie(A.NumIn, A.IsBlock) < std::tie(B.NumIn, B.IsBlock);
});