X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FUser.cpp;h=f01fa349adfd5f211d7cb57e047b43aea5314548;hb=5f4e02cbf1d0fa0d8048369264201c258f2ad717;hp=2f4587debb662b61d85015b21f7824374fbf1466;hpb=adede0387b749e58b845afac2979764f928efd74;p=oota-llvm.git diff --git a/lib/VMCore/User.cpp b/lib/VMCore/User.cpp index 2f4587debb6..f01fa349adf 100644 --- a/lib/VMCore/User.cpp +++ b/lib/VMCore/User.cpp @@ -40,14 +40,12 @@ void User::replaceUsesOfWith(Value *From, Value *To) { //===----------------------------------------------------------------------===// Use *User::allocHungoffUses(unsigned N) const { - Use *Begin = static_cast(::operator new(sizeof(Use) * N - + sizeof(AugmentedUse) - - sizeof(Use))); + // Allocate the array of Uses, followed by a pointer (with bottom bit set) to + // the User. + size_t size = N * sizeof(Use) + sizeof(Use::UserRef); + Use *Begin = static_cast(::operator new(size)); Use *End = Begin + N; - PointerIntPair& - ref(static_cast(End[-1]).ref); - ref.setPointer(const_cast(this)); - ref.setInt(1); + (void) new(End) Use::UserRef(const_cast(this), 1); return Use::initTags(Begin, End); }