[PATCH] D142885: [VPlan] Allow building a VPlan to may fail.
Thorsten via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 02:05:57 PDT 2023
tschuett added a comment.
Now that building may fail, you could even call it `tryBuildVPlanWithVPRecipes` .
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8823
+ if (auto Plan = buildVPlanWithVPRecipes(SubRange, DeadInstructions))
+ VPlans.push_back(std::move(*Plan));
VF = SubRange.End;
----------------
Ayal wrote:
> fhahn wrote:
> > Ayal wrote:
> > > nit: why is `std::move()` needed here now, because `buildVPlanWithVPRecipes()` now returns an `std::optional<VPlanPtr>` instead of a `VPlanPtr`? Could `nullptr` be returned instead of `optional`?
> > IIUC it's needed because `std::unique_ptr` doesn't allow copying.
> Ok, but can an empty unique_ptr initialized to null be returned, instead of optional and move?
std::nullopt is the modern and saver version of nullptr. It is more obvious that std::nullopt denotes failure.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142885/new/
https://reviews.llvm.org/D142885
More information about the llvm-commits
mailing list