[PATCH] D38586: SLPVectorizer.cpp: Avoid std::stable_sort() due to asymmetric comparator
Davide Italiano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 5 13:38:56 PDT 2017
davide requested changes to this revision.
davide added a comment.
This revision now requires changes to proceed.
The issue here is that properlyDominates only captures the parent->child relation in the dom, and siblings in the {post}dominator tree can appear in any order.
I don't think stupid sort is the best way forward, as it seems to be badly O(N^2) in the number of nodes in the dom (i.e. the number of reachable blocks in the CFG).
You may want to instead tighten the check to have a deterministic ordering for siblings).
For example, if you do an RPO walk of the CFG for your function F, you can assign an integer (unique) starting from zero, everytime you visit a new block.
This is is a start, and it's O(N), but you want probably try to be smarter and piggy-back on some other BB scan (like the one happening before this sorting, although I haven't checked the details).
Repository:
rL LLVM
https://reviews.llvm.org/D38586
More information about the llvm-commits
mailing list