[PATCH] D157954: [LoopSink] Don't sort BBs if there is only 1 of them (NFC)
Danila Kutenin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 01:59:18 PDT 2023
danlark added a comment.
In D157954#4587555 <https://reviews.llvm.org/D157954#4587555>, @nikic wrote:
> Which debug check did this trigger? Do you have a test case?
If you build llvm with libcxx at head as a standard library with `-D_LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK` and `-D_LIBCPP_ENABLE_DEBUG_MODE`, then for this sorting it will invoke comp(a, a) for llvm/test/Transforms/LICM/loopsink.ll.test
This change is extremely safe, on line 216 it's checked that `llvm::set_is_subset(BBsToSinkInto, LoopBlockNumber)` if `BBsToSinkInto.size() > 1`. If it's size 1, it implicitly thought no comparator will be called. But it can and `LoopBlockNumber.find(A)->second` will be a .end() iterator dereference
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157954/new/
https://reviews.llvm.org/D157954
More information about the llvm-commits
mailing list