mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Enhance -assume-single-threaded option (SR-3945)
This commit is contained in:
@@ -73,17 +73,19 @@ static void createRefCountOpForPayload(SILBuilder &Builder, SILInstruction *I,
|
||||
|
||||
++NumRefCountOpsSimplified;
|
||||
|
||||
auto *RCI = cast<RefCountingInst>(I);
|
||||
|
||||
// If we have a retain value...
|
||||
if (isa<RetainValueInst>(I)) {
|
||||
// And our payload is refcounted, insert a strong_retain onto the
|
||||
// payload.
|
||||
if (UEDITy.isReferenceCounted(Mod)) {
|
||||
Builder.createStrongRetain(I->getLoc(), UEDI, Atomicity::Atomic);
|
||||
Builder.createStrongRetain(I->getLoc(), UEDI, RCI->getAtomicity());
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, insert a retain_value on the payload.
|
||||
Builder.createRetainValue(I->getLoc(), UEDI, Atomicity::Atomic);
|
||||
Builder.createRetainValue(I->getLoc(), UEDI, RCI->getAtomicity());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,13 +96,13 @@ static void createRefCountOpForPayload(SILBuilder &Builder, SILInstruction *I,
|
||||
|
||||
// If our payload has reference semantics, insert the strong release.
|
||||
if (UEDITy.isReferenceCounted(Mod)) {
|
||||
Builder.createStrongRelease(I->getLoc(), UEDI, Atomicity::Atomic);
|
||||
Builder.createStrongRelease(I->getLoc(), UEDI, RCI->getAtomicity());
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise if our payload is non-trivial but lacking reference semantics,
|
||||
// insert the release_value.
|
||||
Builder.createReleaseValue(I->getLoc(), UEDI, Atomicity::Atomic);
|
||||
Builder.createReleaseValue(I->getLoc(), UEDI, RCI->getAtomicity());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -1545,9 +1547,9 @@ sinkIncrementsOutOfSwitchRegions(AliasAnalysis *AA,
|
||||
//
|
||||
// TODO: Which debug loc should we use here? Using one of the locs from the
|
||||
// delete list seems reasonable for now...
|
||||
SILBuilder(getBB()->begin()).createRetainValue(DeleteList[0]->getLoc(),
|
||||
EnumValue,
|
||||
Atomicity::Atomic);
|
||||
SILBuilder Builder(getBB()->begin());
|
||||
Builder.createRetainValue(DeleteList[0]->getLoc(), EnumValue,
|
||||
cast<RefCountingInst>(DeleteList[0])->getAtomicity());
|
||||
for (auto *I : DeleteList)
|
||||
I->eraseFromParent();
|
||||
++NumSunk;
|
||||
|
||||
Reference in New Issue
Block a user