[PATCH] D105806: [LV] Print remark when loop cannot be vectorized due to invalid costs.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 07:15:43 PDT 2021


thakis added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6115
+    // Sort/group per instruction
+    llvm::sort(InvalidCosts, [](InstructionVFPair &A, InstructionVFPair &B) {
+      ElementCountComparator ECC;
----------------
sdesmalen wrote:
> thakis wrote:
> > …maybe this needs to be a stable_sort() instead?
> Doh! The latest issue seems caused by the change in rGdc7bdc1e7121693df112f2fdb11cc6b88580ba4b :
> 
>   const Instruction *AI = A.first, *BI = B.first;
>   if (AI->getParent() != BI->getParent())
>     return AI->getParent() < BI->getParent();   // pointer comparison
> 
> I considered writing:
> 
>   if (AI->getParent() != BI->getParent())
>     return false;
> 
> So that `AI < BI == false` && `BI < AI == false` and that stable_sort would keep it in place, but this doesn't work in practice.
> I didn't think of a more suitable way to order the blocks (the dominator tree is not part of CostModel, so I also can't use that).
> 
> Any tips?
Just the usual "if it takes a while to figure out, revert for now to keep the tree working", sorry.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105806



More information about the llvm-commits mailing list