mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "MoveOnlyChecker: Treat trivial stores as reinitializations rather than initializations."
This commit is contained in:
@@ -1562,8 +1562,6 @@ void FieldSensitiveMultiDefPrunedLiveRange::findBoundariesInBlock(
|
||||
return getBlockLiveness(predBlock, bitNo) ==
|
||||
FieldSensitivePrunedLiveBlocks::IsLive::LiveOut;
|
||||
})) {
|
||||
PRUNED_LIVENESS_LOG(llvm::dbgs() << "Marking ourself as boundary edge: bb"
|
||||
<< block->getDebugID() << '\n');
|
||||
boundary.getBoundaryEdgeBits(block).set(bitNo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,9 +341,7 @@ static void convertMemoryReinitToInitForm(SILInstruction *memInst,
|
||||
}
|
||||
case SILInstructionKind::StoreInst: {
|
||||
auto *si = cast<StoreInst>(memInst);
|
||||
if (si->getOwnershipQualifier() != StoreOwnershipQualifier::Trivial) {
|
||||
si->setOwnershipQualifier(StoreOwnershipQualifier::Init);
|
||||
}
|
||||
si->setOwnershipQualifier(StoreOwnershipQualifier::Init);
|
||||
dest = si->getDest();
|
||||
break;
|
||||
}
|
||||
@@ -367,8 +365,7 @@ static bool isReinitToInitConvertibleInst(SILInstruction *memInst) {
|
||||
}
|
||||
case SILInstructionKind::StoreInst: {
|
||||
auto *si = cast<StoreInst>(memInst);
|
||||
return si->getOwnershipQualifier() == StoreOwnershipQualifier::Assign
|
||||
|| si->getOwnershipQualifier() == StoreOwnershipQualifier::Trivial;
|
||||
return si->getOwnershipQualifier() == StoreOwnershipQualifier::Assign;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2161,7 +2158,7 @@ bool GatherUsesVisitor::visitUse(Operand *op) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Then handle destroy_addr specially. We want to as part of our dataflow to
|
||||
// ignore destroy_addr, so we need to track it separately from other uses.
|
||||
if (auto *dvi = dyn_cast<DestroyAddrInst>(user)) {
|
||||
|
||||
@@ -213,7 +213,8 @@ bool noncopyable::memInstMustInitialize(Operand *memOper) {
|
||||
}
|
||||
case SILInstructionKind::StoreInst: {
|
||||
auto qual = cast<StoreInst>(memInst)->getOwnershipQualifier();
|
||||
return qual == StoreOwnershipQualifier::Init;
|
||||
return qual == StoreOwnershipQualifier::Init ||
|
||||
qual == StoreOwnershipQualifier::Trivial;
|
||||
}
|
||||
case SILInstructionKind::BuiltinInst: {
|
||||
auto bi = cast<BuiltinInst>(memInst);
|
||||
@@ -263,9 +264,7 @@ bool noncopyable::memInstMustReinitialize(Operand *memOper) {
|
||||
}
|
||||
case SILInstructionKind::StoreInst:
|
||||
return cast<StoreInst>(memInst)->getOwnershipQualifier() ==
|
||||
StoreOwnershipQualifier::Assign
|
||||
|| cast<StoreInst>(memInst)->getOwnershipQualifier() ==
|
||||
StoreOwnershipQualifier::Trivial;
|
||||
StoreOwnershipQualifier::Assign;
|
||||
|
||||
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
|
||||
case SILInstructionKind::Store##Name##Inst: \
|
||||
@@ -508,13 +507,6 @@ struct SimpleTemporaryAllocStackElimVisitor
|
||||
// tell these projections apart from projections from earlier allocations.
|
||||
return state.setFinalUser(op);
|
||||
}
|
||||
|
||||
if (auto *si = dyn_cast<StoreInst>(user);
|
||||
si && si->getOwnershipQualifier() == StoreOwnershipQualifier::Trivial) {
|
||||
// Bail on trivial stores.
|
||||
LLVM_DEBUG(llvm::dbgs() << "Found trivial store: " << *user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (auto *cai = dyn_cast<CopyAddrInst>(user)) {
|
||||
// If we already found a copy, bail. We always only visit one of these
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
// RUN: %target-swift-emit-silgen -disable-availability-checking -verify %s
|
||||
|
||||
|
||||
let a: InlineArray<_, (Int)->Int> = [{$0*2}]
|
||||
print(a[0](3))
|
||||
@@ -367,9 +367,9 @@ bb0(%0 : @owned $Klass, %1 : @owned $Klass):
|
||||
// CHECK: bb0([[ARG0:%.*]] : ${{.*}}, [[ARG1:%.*]] :
|
||||
// CHECK: debug_value [[ARG0]]
|
||||
// CHECK: debug_value [[ARG1]]
|
||||
// CHECK: destroy_addr [[ARG1]]
|
||||
// CHECK: [[ACCESS:%.*]] = begin_access [modify] [static] [[ARG1]]
|
||||
// CHECK: [[GEP:%.*]] = struct_element_addr [[ACCESS]]
|
||||
// CHECK: destroy_addr [[ARG1]]
|
||||
// CHECK: store [[ARG0]] to [trivial] [[GEP]]
|
||||
// CHECK: end_access [[ACCESS]]
|
||||
// CHECK: } // end sil function 'myBufferViewSetter'
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// RUN: %target-swift-frontend -emit-sil -verify %s
|
||||
|
||||
final class Bar {
|
||||
func update() {
|
||||
foo?.baz = Foo2(baz: 5)
|
||||
}
|
||||
var foo: Foo? = Foo()
|
||||
}
|
||||
|
||||
struct Foo: ~Copyable {
|
||||
var baz: Foo2 = Foo2(baz: 0)
|
||||
}
|
||||
|
||||
struct Foo2: ~Copyable {
|
||||
var baz: Int = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user