Summary:
Because the sort order was not strongly stable on the RHS, whether the
chain could merge would depend on the order of the blocks in the Phi.
EXPENSIVE_CHECKS would shuffle the blocks before sorting, resulting in
non-deterministic merging.
Reviewers: gchatelet
Subscribers: hiraditya, llvm-commits, RKSimon
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62193
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361281
91177308-0d34-0410-b5e6-
96231b3b80d8
// semantics because we are only accessing dereferencable memory.
llvm::sort(Comparisons_,
[](const BCECmpBlock &LhsBlock, const BCECmpBlock &RhsBlock) {
- return LhsBlock.Lhs() < RhsBlock.Lhs();
+ return std::tie(LhsBlock.Lhs(), LhsBlock.Rhs()) <
+ std::tie(RhsBlock.Lhs(), RhsBlock.Rhs());
});
#ifdef MERGEICMPS_DOT_ON
errs() << "AFTER REORDERING:\n\n";