Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks good to me, and raises some thoughts ;-)
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
---|---|---|
3861 | nit (Independent of this patch): else block deserves parentheses considering comments? | |
3882 | nit: "only user should be FirstOrderRecurrenceSplice VPInstruction" >> | |
3883 | nit: worth asserting opcode is FirstOrderRecurrenceSplice ? | |
3887 | (Independent of this patch:) Do multiple live-out users feed multiple LCSSAPhi's, should they all feed the same LCSSAPhi, are there tests covering multiple live-out users? | |
3890 | nit: add message to assert. | |
3893 | TODO (Independent of this patch): LiveOuts is presumably needed only for delayed destruction of VPLiveOuts, as adding an incoming IR Value to LCSSAPhi should not interfere with traversing the VPUsers of RecurSplice. Why are VPLiveOut VPUsers destroyed here, rather than during the destruction of VPlan, along with all other VPUsers? |
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
---|---|---|
3882 | adjusted thanks! | |
3883 | Added the check to the assert. | |
3887 | They feed different LCSSA phis, the test for that is llvm/test/Transforms/LoopVectorize/pr36983.ll. | |
3890 | Thanks, I added a message to the assert. | |
3893 | At the moment, logic later relies on any live-outs that cannot fix themselves to be removed so they are excluded from the handling below // Fix LCSSA phis not already fixed earlier. Extracts may need to be generated // in the exit block, so update the builder. State.Builder.SetInsertPoint(State.CFG.ExitBB->getFirstNonPHI()); for (const auto &KV : Plan.getLiveOuts()) KV.second->fixPhi(Plan, State); ```. Once live-outs of FOR & IVs can be handled completely in VPlan, no removal should be necessary. |
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
---|---|---|
3893 | Thanks for the reminder. LiveOuts that haven't fixed themselves already could alternatively be filtered by checking if their underlying LCSSAPhi has an incoming Value attached; the savings in traversing only those who do comes at the cost of copying ToFix and LiveOuts for delayed destructions, and starting the tear down parts of VPlan early. This raises some follow-up thoughts - could fixPhi() also take care of fixing LCSSAPhi's of FORs where the LiveOut's operand is a FOR splice, instead of taking care of them here? (Ideally all LiveOut phi's should be fixed at the end of VPlan::execute(), but handling reductions is more involved). There may be an issue of reusing same extract for parallel LCSSAPhi's instead of replicating the same extract for each. This is also relevant for fixing other, non-FOR LCSSAPhis, and relates to the general issue of representing extracts in VPlan. It may be simpler to fuse such parallel LCSSAPhi's together, but those currently reside outside the scope of VPlan. |
nit (Independent of this patch): else block deserves parentheses considering comments?