diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -7525,10 +7525,10 @@ unsigned Lane = State.Instance->Lane; Value *ConditionBit = nullptr; - if (!User) // Block in mask is all-one. + if (User.getNumOperands() == 0) // Block in mask is all-one. ConditionBit = State.Builder.getTrue(); else { - VPValue *BlockInMask = User->getOperand(0); + VPValue *BlockInMask = User.getOperand(0); ConditionBit = State.get(BlockInMask, Part); if (ConditionBit->getType()->isVectorTy()) ConditionBit = State.Builder.CreateExtractElement( diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -1063,12 +1063,12 @@ /// A recipe for generating conditional branches on the bits of a mask. class VPBranchOnMaskRecipe : public VPRecipeBase { - std::unique_ptr User; + VPUser User; public: VPBranchOnMaskRecipe(VPValue *BlockInMask) : VPRecipeBase(VPBranchOnMaskSC) { if (BlockInMask) // nullptr means all-one mask. - User.reset(new VPUser({BlockInMask})); + User.addOperand(BlockInMask); } /// Method to support type inquiry through isa, cast, and dyn_cast. @@ -1084,8 +1084,8 @@ void print(raw_ostream &O, const Twine &Indent, VPSlotTracker &SlotTracker) const override { O << " +\n" << Indent << "\"BRANCH-ON-MASK "; - if (User) - User->getOperand(0)->print(O, SlotTracker); + if (User.getNumOperands() != 0) + User.getOperand(0)->print(O, SlotTracker); else O << " All-One"; O << "\\l\"";