[PATCH] D82444: [SLP] Make sure instructions are ordered when computing spill cost.

Valeriy Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 09:36:47 PDT 2020


vdmitrie added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3777
+  llvm::stable_sort(OrderedScalars, [this](Instruction *A, Instruction *B) {
+    return !DT->dominates(A, B);
+  });
----------------
There is a problem with this predicate function.
MSFT STL implementation of stable_sort asserts that if predicate returned true
then it must return false when operands are swapped.
But (A dom B) == false does not necessarily mean that (B dom A) == true.
Instead: (A dom B) ==true means that (B dom A) == false.
Rewriting it like this solves this issue:
    return DT->dominates(B, A);


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82444/new/

https://reviews.llvm.org/D82444





More information about the llvm-commits mailing list