diff --git a/llvm/include/llvm/IR/Use.h b/llvm/include/llvm/IR/Use.h index 6bb958c173bf..917db2679c55 100644 --- a/llvm/include/llvm/IR/Use.h +++ b/llvm/include/llvm/IR/Use.h @@ -96,21 +96,18 @@ private: Use **Prev = nullptr; User *Parent = nullptr; - void setPrev(Use **NewPrev) { Prev = NewPrev; } - void addToList(Use **List) { Next = *List; if (Next) - Next->setPrev(&Next); - setPrev(List); - *List = this; + Next->Prev = &Next; + Prev = List; + *Prev = this; } void removeFromList() { - Use **StrippedPrev = Prev; - *StrippedPrev = Next; + *Prev = Next; if (Next) - Next->setPrev(StrippedPrev); + Next->Prev = Prev; } }; diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h index f7dc53430154..47f311f1ead6 100644 --- a/llvm/include/llvm/IR/Value.h +++ b/llvm/include/llvm/IR/Value.h @@ -837,7 +837,7 @@ template void Value::sortUseList(Compare Cmp) { // Fix the Prev pointers. for (Use *I = UseList, **Prev = &UseList; I; I = I->Next) { - I->setPrev(Prev); + I->Prev = Prev; Prev = &I->Next; } } diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index cf5474018713..665527094933 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -831,12 +831,12 @@ void Value::reverseUseList() { while (Current) { Use *Next = Current->Next; Current->Next = Head; - Head->setPrev(&Current->Next); + Head->Prev = &Current->Next; Head = Current; Current = Next; } UseList = Head; - Head->setPrev(&UseList); + Head->Prev = &UseList; } bool Value::isSwiftError() const {