[PATCH] D142885: [VPlan] Allow building a VPlan to may fail.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 01:27:11 PDT 2023


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8823
+    if (auto Plan = buildVPlanWithVPRecipes(SubRange, DeadInstructions))
+      VPlans.push_back(std::move(*Plan));
     VF = SubRange.End;
----------------
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?


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