[PATCH] D126939: [SLP] Avoid converting undef to poison when gathering.
Harald van Dijk via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 4 19:26:21 PDT 2022
hvdijk added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7530
std::distance(VL.begin(), find_if(reverse(VL), [](Value *V) {
return !isa<UndefValue>(V);
}).base());
----------------
What if we try this the other way around? We have the initialisation of `NumValues` here to find the last non-undef value and then assume we do not need to look beyond that. What if we look for the last non-poison value there, by changing this to `return !isa<PoisonValue>(V);` and treat `undef` as just another constant that needs to be preserved? (The `isa<UndefValue>` inside the next loop would also need to be changed to `isa<PoisonValue>`.) That appears to fix your test just as well, and the impact on other existing SLPVectorizer tests is far less great. Does that also fix your original test?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126939/new/
https://reviews.llvm.org/D126939
More information about the llvm-commits
mailing list