mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +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,27 +14,26 @@
|
||||
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) {
|
||||
RHS.removeFromList();
|
||||
Val = V2;
|
||||
V2->addUse(*this);
|
||||
} else {
|
||||
Val = 0;
|
||||
}
|
||||
if (Val)
|
||||
removeFromList();
|
||||
|
||||
if (V1) {
|
||||
RHS.Val = V1;
|
||||
V1->addUse(RHS);
|
||||
} else {
|
||||
RHS.Val = 0;
|
||||
}
|
||||
Value *OldVal = Val;
|
||||
if (RHS.Val) {
|
||||
RHS.removeFromList();
|
||||
Val = RHS.Val;
|
||||
Val->addUse(*this);
|
||||
} else {
|
||||
Val = 0;
|
||||
}
|
||||
|
||||
if (OldVal) {
|
||||
RHS.Val = OldVal;
|
||||
RHS.Val->addUse(RHS);
|
||||
} else {
|
||||
RHS.Val = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user