[PATCH] D105806: [LV] Print remark when loop cannot be vectorized due to invalid costs.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 15 06:51:54 PDT 2021
sdesmalen 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;
----------------
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?
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