diff --git a/lib/SIL/SILDeclRef.cpp b/lib/SIL/SILDeclRef.cpp index 37da515d26b..419cdda1ba8 100644 --- a/lib/SIL/SILDeclRef.cpp +++ b/lib/SIL/SILDeclRef.cpp @@ -597,10 +597,6 @@ bool SILDeclRef::isNoinline() const { return true; } - if (auto *attr = decl->getAttrs().getAttribute()) - if (attr->Value.equals("keypath.entry")) - return true; - return false; } diff --git a/lib/SILOptimizer/Transforms/AccessEnforcementDom.cpp b/lib/SILOptimizer/Transforms/AccessEnforcementDom.cpp index a1a81da9d4d..1b2129f59d8 100644 --- a/lib/SILOptimizer/Transforms/AccessEnforcementDom.cpp +++ b/lib/SILOptimizer/Transforms/AccessEnforcementDom.cpp @@ -110,6 +110,8 @@ private: // Returns a bool: If we should bail on this function // we return false - else true // See the discussion in DominatedAccessRemoval::analyze() below +// +// FIXME: Handle KeyPath access. bool DominatedAccessRemoval::visitInstruction( SILInstruction *instr, AccessedStorageInfo &visitedDomAccessesToStorageInfo) { @@ -123,18 +125,6 @@ bool DominatedAccessRemoval::visitInstruction( } visitBeginAccess(BAI, storage, visitedDomAccessesToStorageInfo); - } else if (auto fullApply = FullApplySite::isa(instr)) { - SILFunction *callee = fullApply.getReferencedFunction(); - if (!callee) - return true; - if (!callee->hasSemanticsAttr("keypath.entry")) - return true; - // we can't eliminate dominated checks even when we can prove that - // the dominated scope has no internal nested conflicts. - // We just bail on these functions. - // Aprevious commit handled them, you can see the full support there, - // but, to simplify the code, assuming key-paths are rare for now, bail. - return false; } else if (auto *BUAI = dyn_cast(instr)) { // We have an Implementation that handles this in the analyzer // and optimizer in a previous commit, However, diff --git a/test/SILOptimizer/access_dom.sil b/test/SILOptimizer/access_dom.sil index d12f930cf72..8f4dd24d553 100644 --- a/test/SILOptimizer/access_dom.sil +++ b/test/SILOptimizer/access_dom.sil @@ -334,47 +334,6 @@ bb0: return %10 : $() } -sil [_semantics "keypath.entry"] @stdlibKeyPathEntry: $@convention(thin) () -> () { -bb0: - %ret = tuple () - return %ret : $() -} - -// public func testDomKeyPath() { -// Checks 3 scopes, two of which are dominated and access the same storage -// However, There's a call to a "fake" key-path entry function - bail for now -// -// CHECK-LABEL: sil @testDomKeyPath : $@convention(thin) () -> () { -// CHECK: [[GLOBAL:%.*]] = global_addr @globalX : $*X -// CHECK-NEXT: [[BEGIN:%.*]] = begin_access [read] [dynamic] [[GLOBAL]] : $*X -// CHECK-NEXT: load [[BEGIN]] : $*X -// CHECK-NEXT: end_access [[BEGIN]] : $*X -// CHECK-NEXT: [[BEGIN:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[GLOBAL]] : $*X -// CHECK-NEXT: load [[BEGIN]] : $*X -// CHECK-NEXT: end_access [[BEGIN]] : $*X -// CHECK-NEXT: [[BEGIN:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[GLOBAL]] : $*X -// CHECK-NEXT: load [[BEGIN]] : $*X -// CHECK-NEXT: end_access [[BEGIN]] : $*X -// CHECK-NOT: begin_access -// CHECK-LABEL: } // end sil function 'testDomKeyPath' -sil @testDomKeyPath : $@convention(thin) () -> () { -bb0: - %0 = global_addr @globalX: $*X - %1 = begin_access [read] [dynamic] %0 : $*X - %2 = load %1 : $*X - end_access %1 : $*X - %4 = begin_access [read] [dynamic] [no_nested_conflict] %0 : $*X - %5 = load %4 : $*X - end_access %4 : $*X - %7 = begin_access [read] [dynamic] [no_nested_conflict] %0 : $*X - %8 = load %7 : $*X - end_access %7 : $*X - %keyRef = function_ref @stdlibKeyPathEntry : $@convention(thin) () -> () - apply %keyRef() : $@convention(thin) () -> () - %10 = tuple () - return %10 : $() -} - // public func testLoopDominatingAccessAdderSimple() { // Checks creation of new scope in loop preheader //