[PATCH] D101290: [LV] Try to sink and hoist inside candidate loops for vectorization.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 27 02:08:00 PDT 2021
lebedev.ri added a comment.
As far as i can tell, this doesn't reintroduce the problem that was fixed by disabling early hoisting in simplifycfg, so LG.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9989
+ bool Changed = false;
+ DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);
+ for (BasicBlock *BB : make_early_inc_range(L->blocks())) {
----------------
FWIW these sink/hoist helpers are fine with lazy updates.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10006-10016
+ if (hoistThenElseCodeToIf(BI, TTI, false, &DTU)) {
+ Changed = true;
+ SmallPtrSet<BasicBlock *, 2> NewSuccs(succ_begin(BB), succ_end(BB));
+ if (!NewSuccs.count(OldThen)) {
+ LI.removeBlock(OldThen);
+ DeleteDeadBlock(OldThen);
+ }
----------------
I think it would be fine to sink that into `hoistThenElseCodeToIf()`.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10025-10031
+ if (sinkCommonCodeFromPredecessors(BB, &DTU)) {
+ // sinkCommonCodeFromPredecessors may introduce a new split block in
+ // the loop. Add it.
+ for (auto *Pred : predecessors(BB)) {
+ if (!L->contains(Pred))
+ L->addBasicBlockToLoop(Pred, LI);
+ }
----------------
I think it would be fine to sink that into `sinkCommonCodeFromPredecessors()`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101290/new/
https://reviews.llvm.org/D101290
More information about the llvm-commits
mailing list