mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 05:56:51 +00:00
[cleanup] Use early exit and simpler temporary variables to clarify the
swap implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4f6b2a26da
commit
775581c418
@ -14,28 +14,27 @@
|
||||
namespace llvm {
|
||||
|
||||
void Use::swap(Use &RHS) {
|
||||
Value *V1(Val);
|
||||
Value *V2(RHS.Val);
|
||||
if (V1 != V2) {
|
||||
if (V1) {
|
||||
removeFromList();
|
||||
}
|
||||
if (Val == RHS.Val)
|
||||
return;
|
||||
|
||||
if (V2) {
|
||||
if (Val)
|
||||
removeFromList();
|
||||
|
||||
Value *OldVal = Val;
|
||||
if (RHS.Val) {
|
||||
RHS.removeFromList();
|
||||
Val = V2;
|
||||
V2->addUse(*this);
|
||||
Val = RHS.Val;
|
||||
Val->addUse(*this);
|
||||
} else {
|
||||
Val = 0;
|
||||
}
|
||||
|
||||
if (V1) {
|
||||
RHS.Val = V1;
|
||||
V1->addUse(RHS);
|
||||
if (OldVal) {
|
||||
RHS.Val = OldVal;
|
||||
RHS.Val->addUse(RHS);
|
||||
} else {
|
||||
RHS.Val = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
User *Use::getUser() const {
|
||||
|
Loading…
Reference in New Issue
Block a user