profile
viewpoint
Michael Gottesman gottesmm Apple, Inc. San Francisco, CA

llvm/llvm-project 6355

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.

gottesmm/swift 2

The Swift Programming Language

gottesmm/llvm 0

Mirror of official llvm git repository located at http://llvm.org/git/llvm. Updated every five minutes.

gottesmm/swift-corelibs-foundation 0

The Foundation Project, providing core utilities, internationalization, and OS independence

gottesmm/swift-corelibs-libdispatch 0

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware

delete branch gottesmm/swift

delete branch : pr-3cbf7497635726b45422a5de76eb1b040580dd24

delete time in a day

PR closed apple/swift

Reviewers
[build-script-impl] Add an option to skip stripping executables.

This is to work around a bug in strip we are seeing on the bots.

+8 -5

0 comment

1 changed file

gottesmm

pr closed time in a day

push eventapple/swift

Michael Gottesman

commit sha 8c5737d1d5f87d6d2379e6b074797557561e82aa

[ownership] Change thin_to_thick function to always produce a none value. It can already only accept values with none ownership and the merging of ownership around ownership phis ensure that if we phi this with a partial_apply or the like, we get the appropriate ownership on any such ownership phi values. We are now out of SILGen emitting fewer destroy_value unnecessarily on thin_to_thick functions. This changed some codegen and also forced me to update some tests/fix AutoDiff. I also deleted the DebugInfo test mandatoryinlining-wrongdebugscope.swift since: 1. It was depending on these destroys being there. 2. Given the need to improve the test @aprantl suggested I just eliminate it solving the test failure for me.

view details

Michael Gottesman

commit sha 40ce7f6e24bef01bf1ed63a6d26718084dc5a6cd

Merge pull request #34415 from gottesmm/pr-7013fe1c78c3e6068b82f7095479d50054110652 [ownership] Change thin_to_thick function to always produce a none value

view details

push time in a day

delete branch gottesmm/swift

delete branch : pr-7013fe1c78c3e6068b82f7095479d50054110652

delete time in a day

PR merged apple/swift

Reviewers
[ownership] Change thin_to_thick function to always produce a none value

It can already only accept values with none ownership and the merging of ownership around ownership phis ensure that if we phi this with a partial_apply or the like, we get the appropriate ownership on any such ownership phi values.

+122 -65

12 comments

12 changed files

gottesmm

pr closed time in a day

push eventapple/swift

Michael Gottesman

commit sha bdd7b42633106239ed4cc2cccae8c80c7024886a

[copy-propagation] Since this runs on OSSA and we have formalized consuming there, use that instead of our own handrolled consuming use impl. This is in preparation for adding a run of this around ownership lowering in order to eliminate extra copies that passes may introduce as they transform IR. The tests for the pass all still pass in the exact same way so no updates were needed.

view details

Michael Gottesman

commit sha fc2bd05dc8062f676a9ae56cebeb9a324a682247

Merge pull request #34416 from gottesmm/pr-494b149e92fdf8f15a07109c6a33d12a1d3ab666 [copy-propagation] Since this runs on OSSA and we have formalized consuming there, use that instead of our own handrolled consuming use impl.

view details

push time in a day

delete branch gottesmm/swift

delete branch : pr-494b149e92fdf8f15a07109c6a33d12a1d3ab666

delete time in a day

PR merged apple/swift

Reviewers
[copy-propagation] Since this runs on OSSA and we have formalized consuming there, use that instead of our own handrolled consuming use impl.

This is in preparation for adding a run of this around ownership lowering in order to eliminate extra copies that passes may introduce as they transform IR.

The tests for the pass all still pass in the exact same way so no updates were needed.

+36 -222

2 comments

1 changed file

gottesmm

pr closed time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

preset=buildbot,tools=RA,stdlib=RD,test=non_executable @swift-ci Please test with preset macOS

gottesmm

comment created time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

Just in case to catch small test perturbations.

gottesmm

comment created time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

@swift-ci test OS X platform

gottesmm

comment created time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

@swift-ci test

gottesmm

comment created time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

@swift-ci test

gottesmm

comment created time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

@swift-ci test

gottesmm

comment created time in a day

push eventgottesmm/swift

Michael Gottesman

commit sha 8c5737d1d5f87d6d2379e6b074797557561e82aa

[ownership] Change thin_to_thick function to always produce a none value. It can already only accept values with none ownership and the merging of ownership around ownership phis ensure that if we phi this with a partial_apply or the like, we get the appropriate ownership on any such ownership phi values. We are now out of SILGen emitting fewer destroy_value unnecessarily on thin_to_thick functions. This changed some codegen and also forced me to update some tests/fix AutoDiff. I also deleted the DebugInfo test mandatoryinlining-wrongdebugscope.swift since: 1. It was depending on these destroys being there. 2. Given the need to improve the test @aprantl suggested I just eliminate it solving the test failure for me.

view details

push time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

@adrian-prantl just to double check, the debug info test removal is cool with you?

gottesmm

comment created time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

@rxwei can you look at the differentiation part to see if I need to change anything else.

gottesmm

comment created time in a day

push eventgottesmm/swift

Michael Gottesman

commit sha 91c4faf6cbc36804ee37ec73065c2bae0415018d

[ownership] Change thin_to_thick function to always produce a none value. It can already only accept values with none ownership and the merging of ownership around ownership phis ensure that if we phi this with a partial_apply or the like, we get the appropriate ownership on any such ownership phi values. We are now out of SILGen emitting fewer destroy_value unnecessarily on thin_to_thick functions. This changed some codegen and also forced me to update some tests/fix AutoDiff. I also deleted the DebugInfo test mandatoryinlining-wrongdebugscope.swift since: 1. It was depending on these destroys being there. 2. Given the need to improve the test @aprantl suggested I just eliminate it solving the test failure for me.

view details

push time in a day

push eventapple/swift

Michael Gottesman

commit sha 4a52f5afa3c584f73f8ac6f3815e73e425a55f17

[ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions. This just canonicalizes the ARC before we lower OME in the face of ARC twiddles by other passes.

view details

Michael Gottesman

commit sha b385332281ed40295ee3500979db54dbc90231bf

Merge pull request #34413 from gottesmm/pr-125681629f67f2d2cfe3cde57c7f890bad4ed299 [ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions.

view details

push time in a day

delete branch gottesmm/swift

delete branch : pr-125681629f67f2d2cfe3cde57c7f890bad4ed299

delete time in a day

PR merged apple/swift

[ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions.

This just canonicalizes the ARC before we lower OME in the face of ARC twiddles by other passes.

+6 -3

4 comments

2 changed files

gottesmm

pr closed time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

Looks like some sort of funkiness in Autodiff

gottesmm

comment created time in a day

pull request commentapple/swift

[copy-propagation] Since this runs on OSSA and we have formalized consuming there, use that instead of our own handrolled consuming use impl.

This isn't running anywhere yet, so I just needed to make sure the singular test passed.

gottesmm

comment created time in a day

PR opened apple/swift

Reviewers
[copy-propagation] Since this runs on OSSA and we have formalized consuming there, use that instead of our own handrolled consuming use impl.

This is in preparation for adding a run of this around ownership lowering in order to eliminate extra copies that passes may introduce as they transform IR.

The tests for the pass all still pass in the exact same way so no updates were needed.

+36 -222

0 comment

1 changed file

pr created time in a day

create barnchgottesmm/swift

branch : pr-494b149e92fdf8f15a07109c6a33d12a1d3ab666

created branch time in a day

pull request commentapple/swift

[ownership] Change thin_to_thick function to always produce a none value

@swift-ci test

gottesmm

comment created time in a day

PR opened apple/swift

Reviewers
[ownership] Change thin_to_thick function to always produce a none value

It can already only accept values with none ownership and the merging of ownership around ownership phis ensure that if we phi this with a partial_apply or the like, we get the appropriate ownership on any such ownership phi values.

+93 -5

0 comment

3 changed files

pr created time in a day

create barnchgottesmm/swift

branch : pr-7013fe1c78c3e6068b82f7095479d50054110652

created branch time in a day

pull request commentapple/swift

[ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions.

I am also going to add a run of CopyPropagation here.

gottesmm

comment created time in a day

Pull request review commentapple/swift

Add a -emit-dead-strippable-symbols flag that emits functions/variable/metadata in a dead_strip-friendly way.

 llvm::Constant *IRGenModule::emitSwiftProtocols() {   if (SwiftProtocols.empty())     return nullptr; +  StringRef sectionName;+  switch (TargetInfo.OutputObjectFormat) {+  case llvm::Triple::UnknownObjectFormat:+    llvm_unreachable("Don't know how to emit protocols for "+                     "the selected object format.");+  case llvm::Triple::MachO:+    sectionName = IRGen.Opts.EmitDeadStrippableSymbols+        ? "__TEXT, __swift5_protos, regular, live_support"+        : "__TEXT, __swift5_protos, regular, no_dead_strip";+    break;+  case llvm::Triple::ELF:+  case llvm::Triple::Wasm:+    sectionName = "swift5_protocols";+    break;+  case llvm::Triple::XCOFF:+  case llvm::Triple::COFF:+    sectionName = ".sw5prt$B";

I guess it was just below? Nm.

kubamracek

comment created time in a day

PullRequestReviewEvent

Pull request review commentapple/swift

Add a -emit-dead-strippable-symbols flag that emits functions/variable/metadata in a dead_strip-friendly way.

 llvm::Constant *IRGenModule::emitSwiftProtocols() {   if (SwiftProtocols.empty())     return nullptr; +  StringRef sectionName;+  switch (TargetInfo.OutputObjectFormat) {+  case llvm::Triple::UnknownObjectFormat:+    llvm_unreachable("Don't know how to emit protocols for "+                     "the selected object format.");+  case llvm::Triple::MachO:+    sectionName = IRGen.Opts.EmitDeadStrippableSymbols+        ? "__TEXT, __swift5_protos, regular, live_support"+        : "__TEXT, __swift5_protos, regular, no_dead_strip";+    break;+  case llvm::Triple::ELF:+  case llvm::Triple::Wasm:+    sectionName = "swift5_protocols";+    break;+  case llvm::Triple::XCOFF:+  case llvm::Triple::COFF:+    sectionName = ".sw5prt$B";

One question I have is if this information around sectionName is something that is also somewhere else. Seems like we should have that centralized so it isn't out of sync, no?

kubamracek

comment created time in a day

PullRequestReviewEvent

pull request commentapple/swift

Add an end-to-end test for ThinLTO (-lto=llvm-thin flag), fix compiler crashes

@kubamracek I talked with compnerd offline. I explained my concern was that LLVM doesn't have a convention around this so we should have some sort of names-acing. I think what they wanted was for us to follow a true namespace. So maybe instead .swiftrestofname -> .swift.restofname.

kubamracek

comment created time in a day

push eventgottesmm/swift

Michael Gottesman

commit sha 4a52f5afa3c584f73f8ac6f3815e73e425a55f17

[ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions. This just canonicalizes the ARC before we lower OME in the face of ARC twiddles by other passes.

view details

push time in a day

PR opened apple/swift

Reviewers
[ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions.

This just canonicalizes the ARC before we lower OME in the face of ARC twiddles by other passes.

+2 -1

0 comment

1 changed file

pr created time in a day

create barnchgottesmm/swift

branch : pr-125681629f67f2d2cfe3cde57c7f890bad4ed299

created branch time in a day

pull request commentapple/swift

Bring up tests + validation tests for the 'freestanding' build and the standalone_minimal preset

@kubamracek I'm fine if you want to do the fix I suggested in a follow on commit.

kubamracek

comment created time in a day

pull request commentapple/swift

[Concurrency] SIL: add hop_to_executor instruction

@atrick is it safe to assume that SILGen will always protect such a read by a "hop" instruction. If we create an invariant in the IR we can guarantee that and define away mistakes.

eeckstein

comment created time in 2 days

Pull request review commentapple/swift

[concurrency] Ban associated objects from being set on instances of actor classes.

+// RUN: %empty-directory(%t)+// RUN: %target-swiftc_driver -Xfrontend -enable-experimental-concurrency %s -o %t/out+// RUN: %t/out++// REQUIRES: concurrency+// REQUIRES: objc_interop++import ObjectiveC+import _Concurrency+import StdlibUnittest++defer { runAllTests() }++var Tests = TestSuite("Actor.AssocObject")++final actor class Actor {+}++Tests.test("final class crash when set assoc object")+  .crashOutputMatches("objc_setAssociatedObject called on instance")+  .code {+  expectCrashLater()+  let x = Actor()+  objc_setAssociatedObject(x, "myKey", "myValue", .OBJC_ASSOCIATION_RETAIN)

Done

gottesmm

comment created time in 2 days

PullRequestReviewEvent

pull request commentapple/swift

[concurrency] Ban associated objects from being set on instances of actor classes.

shakes fist at 32 bit

gottesmm

comment created time in 2 days

Pull request review commentapple/swift

Add an end-to-end test for ThinLTO (-lto=llvm-thin flag), fix compiler crashes

 llvm::Constant *IRGenModule::getAddrOfGlobalUTF16String(StringRef utf8) {   auto init = llvm::ConstantDataArray::get(getLLVMContext(), utf16);   auto global = new llvm::GlobalVariable(Module, init->getType(), true,                                          llvm::GlobalValue::PrivateLinkage,-                                         init);+                                         init, ".str");

Can you add a comment here saying that this is cargo culled from clang's cstring handling.

kubamracek

comment created time in 2 days

Pull request review commentapple/swift

Add an end-to-end test for ThinLTO (-lto=llvm-thin flag), fix compiler crashes

 static void embedBitcode(llvm::Module *M, const IRGenOptions &Opts)   llvm::Constant *CmdConstant =     llvm::ConstantDataArray::get(M->getContext(), CmdData);   GV = new llvm::GlobalVariable(*M, CmdConstant->getType(), true,-                                llvm::GlobalValue::PrivateLinkage,-                                CmdConstant);+                                llvm::GlobalValue::PrivateLinkage, CmdConstant,+                                ".cmdconstant");

we may want to call this .swiftcmdconstant1? Just trying to think about how to make this more future proof. Should we do this with the other ones as well. If you think its too crazy, no worries. I definitely want a swift prefix here though so at minimum .swiftcmdconstant.

kubamracek

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentapple/swift

Bring up tests + validation tests for the 'freestanding' build and the standalone_minimal preset

 foreach(SDK ${SWIFT_SDKS})     set(test_dependencies)     get_test_dependencies("${SDK}" test_dependencies) -    if(SWIFT_BUILD_STDLIB AND SWIFT_INCLUDE_TESTS)+    if(SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_INCLUDE_TESTS)

Can you add a comment here explaining for future readers what is happening? Explaining why this is wanted for dynamic stdlib and the same inverse question for static stdlib.

kubamracek

comment created time in 2 days

Pull request review commentapple/swift

Bring up tests + validation tests for the 'freestanding' build and the standalone_minimal preset

 add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_SDK_       ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}       -Xfrontend -disable-objc-attr-requires-foundation-module     LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"-    TARGET_SDKS ALL_APPLE_PLATFORMS+    TARGET_SDKS ALL_APPLE_PLATFORMS FREESTANDING

Maybe the way to do this is to create a notion of if freestanding is "apple" flavored. If it is apple flavored it is part of ALL_APPLE_PLATFORMS and if not. Or we could define a sort of "base" sdk for the freestanding sdk with the idea that it would try to emit these libraries. Just some thoughts.

kubamracek

comment created time in 2 days

Pull request review commentapple/swift

Bring up tests + validation tests for the 'freestanding' build and the standalone_minimal preset

 add_swift_target_library(swiftSwiftPrivateThreadExtras ${SWIFT_STDLIB_LIBRARY_BU   SWIFT_MODULE_DEPENDS_OSX Darwin   SWIFT_MODULE_DEPENDS_TVOS Darwin   SWIFT_MODULE_DEPENDS_WATCHOS Darwin+  SWIFT_MODULE_DEPENDS_FREESTANDING Darwin

This may not always be true (considered free standing on Linux will want Glibc here and on windows would want CRT and WinSDK). I imagine that instead the right thing to do is make this a cmake variable.

kubamracek

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentapple/swift

Bring up tests + validation tests for the 'freestanding' build and the standalone_minimal preset

@kubamracek before you land can you fix up the git history?

kubamracek

comment created time in 2 days

pull request commentapple/swift

[concurrency] Ban associated objects from being set on instances of actor classes.

@atrick I added tests for the other policies. @DougGregor I XFAILed the things that should work once the generic actor class isa stomping issue is dealt with.

gottesmm

comment created time in 2 days

push eventgottesmm/swift

Michael Gottesman

commit sha 5a568e30efe85682e6c4549541176d299f0a01c1

[concurrency] Ban associated objects from being set on instances of actor classes. Associated objects are actively dangerous there because they’re non-isolated actor state, and it’s “new” code wher no backward compatibility concerns that make it more difficult to ban this on other forms of classes. rdar://69769048

view details

push time in 2 days

push eventgottesmm/swift

Michael Gottesman

commit sha bd59776d71acf7bc1f42425663043b4bd1d3b964

[concurrency] Ban associated objects from being set on instances of actor classes. Associated objects are actively dangerous there because they’re non-isolated actor state, and it’s “new” code wher no backward compatibility concerns that make it more difficult to ban this on other forms of classes. rdar://69769048

view details

push time in 2 days

pull request commentapple/swift

Add Compilation "Wave" Assertion in +Asserts Builds

@CodaFi isn't a wave just a generation counter?

CodaFi

comment created time in 2 days

push eventgottesmm/swift

Michael Gottesman

commit sha 44e13ffc23bd7c3cd3738c27671cc9419b61b4d6

[concurrency] Ban associated objects from being set on instances of actor classes. Associated objects are actively dangerous there because they’re non-isolated actor state, and it’s “new” code wher no backward compatibility concerns that make it more difficult to ban this on other forms of classes. rdar://69769048

view details

push time in 3 days

push eventgottesmm/swift

Michael Gottesman

commit sha c0da9815bbf97b18bc1969a218ebb219d759cc07

[concurrency] Ban associated objects from being set on instances of actor classes. Associated objects are actively dangerous there because they’re non-isolated actor state, and it’s “new” code wher no backward compatibility concerns that make it more difficult to ban this on other forms of classes. rdar://69769048

view details

push time in 3 days

push eventgottesmm/swift

Antoine Cœur

commit sha 4c30f8bd6de5487603ed645cc4dd2a2983f4f0ba

appendingPathComponent(:isDirectory:) should account for isDirectory

view details

Xiaodi Wu

commit sha 26cda274ca78b1df246521ba1eeea33285b57d5f

[stdlib] Simplify 'BinaryFloatingPoint.init?<T: BinaryFloatingPoint>(exactly: T)'

view details

Mike Ash

commit sha ece0399d601eec1069131f465bdbe7e16f4c6a50

[Runtime] Have ConcurrentReadableHashMap use 1-byte or 2-byte indices when possible.

view details

Butta

commit sha 69d04aad08da3245f87c6a2df35869126d48b55e

[linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries This was presumably added as a backup, in case the libraries in a toolchain couldn't be found, but will not work well, so take it out.

view details

Alexis Laferrière

commit sha 14e6772dc04cf778ba393bebc21a0a8b8ada3603

Consider inherited platform unavailability to silence diagnostics rdar://68597591

view details

Holly Borla

commit sha 3a47087cc197aab8970a55ee265d395bc4f6f002

[Parser] Don't resolve decl references in the parser if the declaration has a custom attribute.

view details

Holly Borla

commit sha 9b2cd5e3ffa09063a8b64250cd0c62850a41fd26

[NameLookup] Teach unqualified lookup to resolve backing property wrapper and projected value references

view details

Holly Borla

commit sha b33dbedd9b8d3dc2e6ee28373c69a24764249745

[SILGen] Teach SIlGen to emit local property wrappers

view details

Holly Borla

commit sha 0842b4212773b36778d773331155df6be20d2c21

[SILGen] Only use assign_by_wrapper for wrapped instance properties inside an initializer, and for wrapped local variables.

view details

Holly Borla

commit sha 9bd3d0b67fc9599c693735d98c6ff98defccc8e5

[Property Wrappers] Make sure captures are computed for synthesized property wrapper accessors.

view details

Holly Borla

commit sha d8df6217d32cf7ec970d67bc66ff966df0c1a671

[Property Wrappers] Allow property wrappers on local variables.

view details

Holly Borla

commit sha 21cbdfa337dfa41e108573d5d99c6259bee671c9

[Property Wrappers] Add a VarDecl helper method for visiting synthesized property wrapper vars.

view details

Arnold Schwaighofer

commit sha 8e8c57caf59f043b4046ad0df6e7c358bcac9903

SIL type lowering: Compute IsTypeExpansionSensitive and use it instead of TypeBase's hasOpaqueArchetypePropertiesOrCases A type is IsTypeExpansionSensitive if it contains an opaque result type that influences how the type is lowered. This could be because the type mentions an opaque archetype and therefore we would look through to the underlying type depending on the type expansion and could get a different SIL type. For example '() -> out some P' could lower to '() -> @out Int'. Or this could be because when we lower an aggregate type some of its fields are opaque types that could be looked through and therefore the aggregate has different lowering (e.g address vs. loadable) in different type expansion contexts. By replacing it this change also fixes an infinite recursion in hasOpaqueArchetypePropertiesOrCases. rdar://68798822

view details

Adrian Prantl

commit sha 26b5230f3c93ace3b5ad77ce36826bb5ea5da0d6

Remove stray character.

view details

Holly Borla

commit sha 2a67c651eecb6ccd6384a90961cfee46338c954e

[Property Wrappers] Generalize a few property wrapper decl context checks to check for type context instead of local context. This generalization will help us implement property wrappers on global variables, which should use the same approach of not adding synthesized accessors to the AST and instead lazily visit them in SILGen.

view details

Slava Pestov

commit sha dec9bf680e00eac0e1ca3074bc3967f5e582c068

AST: Remove unused UnqualifiedLookupFactory::Consumer field

view details

Slava Pestov

commit sha ba4d6ede07919fe141eb134dc2ab8aee8ea1aae6

AST: Remove unused NamedDeclConsumer class

view details

Slava Pestov

commit sha 17a0b41a40cc5d8e2c20aca07d96c096bab2bffc

Sema: Remove dead code from CheckRedeclarationRequest::evaluate()

view details

Slava Pestov

commit sha c56ab07c77184229d215213ec7a9e0b3c360fa36

ASTScope: Add finishLookupInBraceStmt parameter to ASTScope::lookupLocalDecls() This will be used to implement re-declaration checking for local declarations. Currently this is handled by parse-time lookup. To make it work with ASTScope, we need to perform lookups that look into the innermost local scope only; for example, this is an invalid redeclaration: do { let x = 321 let x = 123 } But the following is fine, even though both VarDecls are in the same *DeclContext*: do { let x = 321 do { let x = 123 } }

view details

Slava Pestov

commit sha d58583850d323cc8538f4508d4fcc16395556439

Sema: Check for re-declarations in local context in CheckRedeclarationRequest

view details

push time in 3 days

Pull request review commentapple/swift

RCIdentity: fix another case of not-RC-identity-preserving casts.

 static CanType getHashableExistentialType(ModuleDecl *M) {   return hashable->getDeclaredInterfaceType()->getCanonicalType(); } +bool SILDynamicCastInst::isRCIdentityPreserving() const {+  // Casts which cast from a trivial type, like a metatype, to something which+  // is retainable, like an AnyObject, are not RC identity preserving.+  // On some platforms such casts dynamically allocate a ref-counted box for the+  // metatype. Naturally that is the place where a new rc-identity begins.+  // Therefore such a cast is introducing a new rc identical object.+  //+  // If RCIdentityAnalysis would look through such a cast, ARC optimizations+  // would get confused and might eliminate a retain of such an object+  // completely.+  if (getSourceLoweredType().isTrivial(*getFunction()))+    return false;++  CanType source = getSourceFormalType();+  CanType target = getTargetFormalType();++  // Be conservative with generic parameters.+  if (source->is<ArchetypeType>() || target->is<ArchetypeType>())

I wonder if we could maybe have a different instruction or something like that. The problem here is as I understand it around bridging. Rather than using normal casts for bridging, lets use special casts. Then we have a nice split.

eeckstein

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 void StackAllocationPromoter::fixBranchesAndUses(BlockSet &PhiBlocks) {     // on.     SILBasicBlock *BB = Inst->getParent(); +    if (!BB->isEntry()) {+      if (auto *SI = dyn_cast<StoreInst>(Inst)) {

If I am understanding this correctly, this is here b/c of the code https://github.com/apple/swift/pull/34276/files#diff-a0cdc552f97b0b66a7c8f63788292539566ab2a53affa110bc00f904df39ecf9R504. Can you put a comment here explaining that?

meg-gupta

comment created time in 4 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 StackAllocationPromoter::promoteAllocationInBlock(SILBasicBlock *BB) {       if (SI->getDest() != ASI)         continue; -      // The stored value is the new running value.-      RunningVal = SI->getSrc();+      // Special handling of entry block

Can you make this pop more? Maybe put a newline? This line is a bit of a title.

meg-gupta

comment created time in 4 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 bb0(%0 : @owned $(Builtin.BridgeObject, Builtin.Int32)):   %7 = tuple ()   return %7 : $() }++// CHECK-LABEL: sil [ossa] @multiple_debug_value :+// CHECK-NOT: alloc_stack

Nice fix! We have seen this bug before I think where someone had a test case that hit this somehow!

meg-gupta

comment created time in 4 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 class MemoryToRegisters { /// Returns true if \p I is an address of a LoadInst, skipping struct and /// tuple address projections. Sets \p singleBlock to null if the load (or /// it's address is not in \p singleBlock.-static bool isAddressForLoad(SILInstruction *I, SILBasicBlock *&singleBlock) {-  -  if (isa<LoadInst>(I))+/// This function looks for these patterns:+/// 1. (load %ASI)+/// 2. (load (struct_element_addr/tuple_element_addr/unchecked_addr_cast %ASI))+static bool isAddressForLoad(SILInstruction *I, SILBasicBlock *&singleBlock,+                             bool &hasGuaranteedOwnership) {++  if (isa<LoadInst>(I)) {+    // SILMem2Reg is disabled when we find:+    // (load [take] (struct_element_addr/tuple_element_addr %ASI))+    // struct_element_addr and tuple_element_addr are lowered into+    // struct_extract and tuple_extract and these SIL instructions have a+    // guaranteed ownership. For replacing load's users, we need an owned value.+    // We will need a new copy and destroy of the running val placed after the+    // last use. This is not implemented currently.+    if (hasGuaranteedOwnership && cast<LoadInst>(I)->getOwnershipQualifier() ==

Can you give an example of this in SIL that shows this problem?

meg-gupta

comment created time in 4 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 void StackAllocationPromoter::fixBranchesAndUses(BlockSet &PhiBlocks) {       fixPhiPredBlock(PhiBlocks, Block, PBB);     }   }++  // If the owned phi arg we added did not have any uses, create end_lifetime to+  // end its lifetime. In asserts mode, make sure we have only undef incoming+  // values for such phi args.+  if (ASI->getFunction()->hasOwnership()) {+    for (auto Block : PhiBlocks) {+      auto *phiArg = cast<SILPhiArgument>(+          Block->getArgument(Block->getNumArguments() - 1));+      if (phiArg->getOwnershipKind() == ValueOwnershipKind::Owned &&+          phiArg->use_empty()) {+        assert(hasOnlyUndefIncomingValues(phiArg));

Nice defensive assert!

meg-gupta

comment created time in 4 days

PullRequestReviewEvent
PullRequestReviewEvent

delete branch gottesmm/swift

delete branch : pr-5b70b29de84d902644bc21dc530816c78e919469

delete time in 5 days

push eventapple/swift

Michael Gottesman

commit sha f0a59a25eae63bc140563c4044e580b7e9be0339

[silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups. This has been a long standing issue that we have been hacking around in various points in SILGen. Now CleanupCloner just does the right thing. I was unable to cause any issues to pop up in tree (since I believe we hacked around this and converged on correctness). But it does come up in combination with new code in https://github.com/apple/swift/pull/31779. rdar://63514765

view details

Michael Gottesman

commit sha 8d2c85d50e9483e0d1fb830792f027163e95e83b

Merge pull request #34357 from gottesmm/pr-5b70b29de84d902644bc21dc530816c78e919469 [silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups.

view details

push time in 5 days

PR merged apple/swift

[silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups.

This has been a long standing issue that we have been hacking around in various points in SILGen. Now CleanupCloner just does the right thing.

I was unable to cause any issues to pop up in tree (since I believe we hacked around this and converged on correctness). But it does come up in combination with new code in https://github.com/apple/swift/pull/31779.

rdar://63514765

+31 -10

5 comments

3 changed files

gottesmm

pr closed time in 5 days

pull request commentapple/swift

[silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups.

The source compatibility failure is a known unrelated failure.

gottesmm

comment created time in 5 days

pull request commentapple/swift

[temp-rvalue-opt] Disable handling of load [take] in temp-rvalue-elim.

@swift-ci nominate

gottesmm

comment created time in 5 days

pull request commentapple/swift

[temp-rvalue-opt] Disable handling of load [take] in temp-rvalue-elim.

@swif-ci nominate

gottesmm

comment created time in 5 days

PR opened apple/swift

Reviewers
[build-script-impl] Add an option to skip stripping executables.

This is to work around a bug in strip we are seeing on the bots.

+8 -5

0 comment

1 changed file

pr created time in 5 days

create barnchgottesmm/swift

branch : pr-3cbf7497635726b45422a5de76eb1b040580dd24

created branch time in 5 days

create barnchgottesmm/swift

branch : pr-13b7298d64d2a610458363f37e37061d6ffb4283

created branch time in 5 days

pull request commentapple/swift

[silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups.

@swift-ci test source compatibility

gottesmm

comment created time in 5 days

pull request commentapple/swift

[silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups.

@swift-ci test windows platform

gottesmm

comment created time in 5 days

pull request commentapple/swift

Correct a path in the Windows build instructions

Just doing a drive by test (not reviewing)

texasmichelle

comment created time in 5 days

pull request commentapple/swift

Correct a path in the Windows build instructions

@swift-ci smoke test

texasmichelle

comment created time in 5 days

pull request commentapple/swift

[silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups.

@swift-ci test source compatibilité

gottesmm

comment created time in 5 days

PR opened apple/swift

Reviewers
[silgen] Ensure that cleanup cloner clones formal access cleanups to formal access cleanups.

This has been a long standing issue that we have been hacking around in various points in SILGen. Now CleanupCloner just does the right thing.

I was unable to cause any issues to pop up in tree (since I believe we hacked around this and converged on correctness). But it does come up in combination with new code in https://github.com/apple/swift/pull/31779.

rdar://63514765

+31 -10

0 comment

3 changed files

pr created time in 5 days

create barnchgottesmm/swift

branch : pr-5b70b29de84d902644bc21dc530816c78e919469

created branch time in 5 days

pull request commentapple/swift

[temp-rvalue-opt] Disable handling of load [take] in temp-rvalue-elim.

@swift-ci test

gottesmm

comment created time in 6 days

pull request commentapple/swift

[temp-rvalue-opt] Disable handling of load [take] in temp-rvalue-elim.

@swift-ci test

gottesmm

comment created time in 6 days

push eventgottesmm/swift

Michael Gottesman

commit sha d0b06006e4d1dfeec81186cfbb6b37c32f03c135

[temp-rvalue-opt] Disable handling of load [take] in temp-rvalue-elim. This pass was attempting to handle cases where we use load [take] + destroy_value instead of a destroy_addr since we have a loadable value. There are a few issues around how this was done, so for 5.3, we are just going to turn off the optimization. rdar://70356725

view details

push time in 6 days

push eventapple/swift-integration-tests

Butta

commit sha fc25f1865940d8a0b188d460fdaf2d21c1758130

Make sure apple/swift#34023, which removes /usr/lib/swift/linux from the RUNPATH of several Swift libraries, stays that way.

view details

Michael Gottesman

commit sha be08fba6150a391882162c5512c2b511ad34bc94

Merge pull request #72 from buttaface/rpath Make sure apple/swift#34023, which removes /usr/lib/swift/linux from the RUNPATH of several Swift libraries, stays that way

view details

push time in 6 days

push eventapple/swift

Butta

commit sha 69d04aad08da3245f87c6a2df35869126d48b55e

[linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries This was presumably added as a backup, in case the libraries in a toolchain couldn't be found, but will not work well, so take it out.

view details

Michael Gottesman

commit sha 86b7bac395542602f5e22b493edd7bd8c58f604a

Merge pull request #34023 from buttaface/rpath [linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries

view details

push time in 6 days

PR merged apple/swift

[linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries

This was presumably added as a backup, in case the libraries in a toolchain couldn't be found, but will not work well, so take it out.

Here's a full list of shared library runpaths from the just-released official Swift 5.3 toolchain for linux:

> find swift-5.3-RELEASE-ubuntu20.04/ -name "lib*.so"| xargs readelf -d | ag "File:|runpath"
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/libsourcekitdInProc.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib/swift/linux:/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/pm/4_2/libPackageDescription.so
 0x000000000000001d (RUNPATH)            Library runpath: [/home/build-user/swift-nightly-install/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/pm/4/libPackageDescription.so
 0x000000000000001d (RUNPATH)            Library runpath: [/home/build-user/swift-nightly-install/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/pm/llbuild/libllbuildSwift.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:$ORIGIN/../../linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/pm/llbuild/libllbuild.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libicuucswift.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libswiftRemoteMirror.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libdispatch.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libBlocksRuntime.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libFoundationNetworking.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libicudataswift.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libXCTest.so
 0x000000000000001d (RUNPATH)            Library runpath: [/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libswiftDispatch.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libswift_Differentiation.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/lib_InternalSwiftSyntaxParser.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libswiftGlibc.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libFoundationXML.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libFoundation.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libswiftSwiftOnoneSupport.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libicui18nswift.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/swift/linux/libswiftCore.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/usr/lib/swift/linux]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/liblldb.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/libIndexStore.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0/lib/linux/libclang_rt.hwasan-x86_64.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0/lib/linux/libclang_rt.ubsan_standalone-x86_64.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0/lib/linux/libclang_rt.scudo_minimal-x86_64.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0/lib/linux/libclang_rt.scudo-x86_64.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0/lib/linux/libclang_rt.ubsan_minimal-x86_64.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0/lib/linux/libclang_rt.dyndd-x86_64.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0/lib/linux/libclang_rt.asan-x86_64.so
File: swift-5.3-RELEASE-ubuntu20.04/usr/lib/libswiftDemangle.so
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:/usr/lib/swift/linux]

If there's any difference between the toolchain being used and the one installed in /usr/lib/swift/linux, say if you download this 5.3 toolchain for linux into your home directory but 5.2.5 is installed in /usr/lib/swift/linux, using that system runpath won't work properly. I checked and all these libraries already have a runpath relative to $ORIGIN, ie locally, so all this absolute path will do is supply the system Swift library if the local one is missing (obviously if the used toolchain is installed in the system, ie /usr/lib/swift/linux, this absolute path is redundant). But since using the system Swift libraries will not work properly if the Swift versions don't match, causing subtle bugs in the worst case, I think it's better not to add this absolute runpath at all.

It was added five years ago by @bitjammer, ad95b5f, and copied to SourceKit a couple years later, a93bddf. I brought up this issue earlier this year, but got no response at the time, so I let it go. I think this is worth getting in and into the 5.3 branch for the next patch release.

@gottesmm and @compnerd, I think this should be removed, similar to the other ELF runpath issues we discussed. @tachoknight, let us know what you think from your Fedora packaging perspective.

+3 -3

11 comments

3 changed files

buttaface

pr closed time in 6 days

Pull request review commentapple/swift

Fix several correctness issues in TempRValueOpt

 bool TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {       auto *cai = cast<CopyAddrInst>(user);       if (cai != copyInst) {         assert(cai->getSrc() == tempObj);-        if (cai->isTakeOfSrc() && !copyInst->isTakeOfSrc())+        if (cai->isTakeOfSrc())

Looks good!

eeckstein

comment created time in 9 days

Pull request review commentapple/swift

Fix several correctness issues in TempRValueOpt

 bool TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {   }    // Check if the source is modified within the lifetime of the temporary.

Nice!

eeckstein

comment created time in 9 days

Pull request review commentapple/swift

Fix several correctness issues in TempRValueOpt

 collectLoads(Operand *addressUse, CopyAddrInst *originalCopy,   case SILInstructionKind::UncheckedAddrCastInst:     return collectLoadsFromProjection(cast<SingleValueInstruction>(user),                                       originalCopy, loadInsts);-  case SILInstructionKind::LoadInst:++  case SILInstructionKind::LoadInst: {

So just to ask real quick. Are we handling load [take] now by always converting to load [copy] when before we would try to eliminate it?

eeckstein

comment created time in 9 days

more