diff --git a/llvm/lib/IR/User.cpp b/llvm/lib/IR/User.cpp index b0aa785deb9af..ab44cb4b8a3f7 100644 --- a/llvm/lib/IR/User.cpp +++ b/llvm/lib/IR/User.cpp @@ -146,6 +146,9 @@ void *User::allocateFixedOperandUser(size_t Size, unsigned Us, Use *Start = reinterpret_cast(Storage + DescBytesToAllocate); Use *End = Start + Us; User *Obj = reinterpret_cast(End); + Obj->NumUserOperands = Us; + Obj->HasHungOffUses = false; + Obj->HasDescriptor = DescBytes != 0; for (; Start != End; Start++) new (Start) Use(Obj); @@ -172,6 +175,9 @@ void *User::operator new(size_t Size, HungOffOperandsAllocMarker) { void *Storage = ::operator new(Size + sizeof(Use *)); Use **HungOffOperandList = static_cast(Storage); User *Obj = reinterpret_cast(HungOffOperandList + 1); + Obj->NumUserOperands = 0; + Obj->HasHungOffUses = true; + Obj->HasDescriptor = false; *HungOffOperandList = nullptr; return Obj; }