[PATCH] D69563: [LV] Strip wrap flags from vectorized reductions
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 00:28:50 PST 2019
Ayal added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:394
+ Instruction *UI = cast<Instruction>(U);
+ if (L->contains(UI->getParent()) && Result.insert(UI).second)
+ Worklist.push_back(UI);
----------------
This is indeed a general way to record all transitively dependent instructions inside a loop. In our case, though, there's a single known `LoopExitInst `with a single (loop-closed phi) user outside the loop. More efficient to record that user and check if (UI != OutsideUser && Result.insert(UI).second) than to repeatedly check if parent block belongs to L. Agreed?
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3732
+ // Wrap flags are in general invalid after vectorization, clear them.
+ SmallPtrSet<Instruction *, 4> RedictionInstructions;
----------------
Worth restricting this wrap-dropping treatment to RecurrenceKind's that may wrap, namely RK_IntegerAdd and RK_IntegerMult.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3733
+ // Wrap flags are in general invalid after vectorization, clear them.
+ SmallPtrSet<Instruction *, 4> RedictionInstructions;
+ collectReductionInstructions(Phi, OrigLoop, RedictionInstructions);
----------------
RedictionInstructions >> ReductionInstructions
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69563/new/
https://reviews.llvm.org/D69563
More information about the llvm-commits
mailing list