[all-commits] [llvm/llvm-project] 5d2b3d: [SLP] Avoid std::stable_sort(properlyDominates()).
Harald van Dijk via All-commits
all-commits at lists.llvm.org
Thu Jun 3 09:52:23 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5d2b3de284f46e4c1e60fc5f266b085f54391566
https://github.com/llvm/llvm-project/commit/5d2b3de284f46e4c1e60fc5f266b085f54391566
Author: Harald van Dijk <harald at gigawatt.nl>
Date: 2021-06-03 (Thu, 03 Jun 2021)
Changed paths:
M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
A llvm/test/Transforms/SLPVectorizer/X86/ordering-bug.ll
Log Message:
-----------
[SLP] Avoid std::stable_sort(properlyDominates()).
As noticed by NAKAMURA Takumi back in 2017, we cannot use
properlyDominates for std::stable_sort as properlyDominates only
partially orders blocks. That is, for blocks A, B, C, D, where A
dominates B and C dominates D, we have A == C, B == C, but A < B. This
is not a valid comparison function for std::stable_sort and causes
different results between libstdc++ and libc++. This change uses DFS
numbering to give deterministic results for all reachable blocks.
Unreachable blocks are ignored already, so do not need special
consideration.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D103441
More information about the All-commits
mailing list