Commit Graph

4477 Commits

Author SHA1 Message Date
Devin Coughlin
c50ca98ac6 [SIL] Factor out logic for detecting sanitizer instrumentation. NFC.
Factor out common logic for detecting sanitizer instrumentation and put it in
SIL/InstructionUtils.
2018-06-10 16:44:19 -07:00
Michael Gottesman
12b2742de4 Fix typo. \b -> \n 2018-06-10 14:16:15 -07:00
kitasuke
802774c327 Don't print duplicated import decls by sil-opt if input file is silgen 2018-06-09 12:36:20 -07:00
swift-ci
83f5d1b79c Merge remote-tracking branch 'origin/master' into master-next 2018-06-07 16:29:38 -07:00
Erik Eckstein
a5b33396ce Allow global variables which are string literals to be generated in the data section.
So there is no need to initialize global string variables dynamically (with dispatch_once) anymore.
This is much more efficient, both in terms of code size and performance
2018-06-07 13:43:34 -07:00
swift-ci
9b93fd1d46 Merge remote-tracking branch 'origin/master' into master-next 2018-06-06 19:09:43 -07:00
Andrew Trick
df94dffab7 [NFC] Add SILBuilderContext.
In an upcoming bug fix, I want to pass SILBuilderContext to a
utility. I could continue reusing SILBuilder, even though the utility
must set its own insertion point and debug location. However, this is
terrible practice that I don't want to perpetuate.

The lifetime of a SILBuilder should correspond to a single insertion
point and debug location. That's the only sane way to preserve debug
information in SIL passes.

There are various pieces of contextual state that we've been adding to
the SILBuilder. Those have made it impossible to use SILBuilder
correctly. I'm pulling the context out, so clients can begin using
better practices. In the future, we can make SILBuilderContext
polymorphic, so passes can extend it easily with arbitrary
callbacks. We can also make it self-contained so we don't need to pass
around pointers to an InsertedInst list anymore.
2018-06-06 14:45:45 -07:00
swift-ci
febaec42cb Merge remote-tracking branch 'origin/master' into master-next 2018-06-05 18:29:10 -07:00
Slava Pestov
bb7ed52479 SIL: SILFunction::isNoReturnFunction() also needs to handle functions that return Never indirectly 2018-06-04 22:34:47 -07:00
swift-ci
568855a33c Merge remote-tracking branch 'origin/master' into master-next 2018-05-31 09:29:52 -07:00
Lily Vulcano
63348bce6f Merge pull request #16736 from millenomi/LinuxAsBridging_2
Turn on 'as' bridging for Linux (2)
2018-05-31 09:23:45 -07:00
swift-ci
b2e2a6363f Merge remote-tracking branch 'origin/master' into master-next 2018-05-30 15:29:29 -07:00
swift-ci
9aca727949 Merge pull request #16844 from gottesmm/definite-init-fix 2018-05-30 15:17:22 -07:00
Lily Vulcano
1377ab7d7e Turn on ‘as’ bridging on Darwin. 2018-05-30 15:07:22 -07:00
Michael Gottesman
8886368854 [definite-init] Treat destroys of mark_uninitialized [var] container to be a load + destroy.
This ensures that DI creates dealloc_box in cases where the box is uninitialized
conditionally.

In the process, I also discovered that we were missing a test case for DI being
used by LLDB. Long term we shouldn't support that code pattern in the general
case, but for now we at least need a test case for it.

rdar://40332620
2018-05-30 14:25:50 -07:00
Jordan Rose
73ee008bfd Merge remote-tracking branch 'origin/master' into master-next 2018-05-29 11:18:44 -07:00
David Zarzycki
52fd7cb2c9 [SIL] Perf: Cache basic block during SILSuccessor iteration
'operator*' in this patch becomes a hot spot in some scenarios. For
example: an enum with an unusually large number of cases.
2018-05-29 09:44:07 -04:00
Slava Pestov
5ab1a852f7 Merge pull request #16875 from slavapestov/sub-map-cleanup
SubstitutionMap cleanups
2018-05-28 20:57:09 -07:00
Slava Pestov
b1a436601e Use MakeAbstractConformanceForGenericType() in various places 2018-05-28 19:45:29 -07:00
Slava Pestov
d8fc9decf9 AST: Remove GenericSignature::getSubstitutionMap() 2018-05-28 19:45:28 -07:00
David Zarzycki
c11c2d9ebd [SILVerifier] NFC: Actually verify all BB predecessors/successors
This verifier has been broken since its inception four years ago.
2018-05-28 08:13:10 -04:00
swift-ci
6339b949e9 Merge remote-tracking branch 'origin/master' into master-next 2018-05-24 17:09:06 -07:00
swift-ci
24abeca16a Merge pull request #16829 from shajrawi/fix_dynamic_cast 2018-05-24 17:03:41 -07:00
Joe Shajrawi
c49a1ff14e [DynamicCasts] Fix a bug in dynamic casting from optionals to protocols
Assume we have:
Protocol P
An intenal extension to Optional - conforming to P
Compiling under whole module mode
Use of Optional type T?

Given a dynamic cast from T? to P, that cast might succeed even if T itself does not conform to P

rdar://problem/40500142
2018-05-24 16:30:51 -07:00
Vedant Kumar
105a61e50d Use LLVM_DEBUG() instead of DEBUG()
Upstream has renamed the DEBUG() macro to LLVM_DEBUG. This updates swift
accordingly:

$ find . -name \*.cpp -print -exec sed -i "" -E "s/ DEBUG\(/ LLVM_DEBUG(/g" {} \;
2018-05-24 13:10:45 -07:00
swift-ci
2ee4fa9e73 Merge remote-tracking branch 'origin/master' into master-next 2018-05-24 10:29:06 -07:00
Andrew Trick
88a2b4360d Verify that exclusivity access marker producers are well-formed in SILVerifier.
This is necessary for the correctness of optimizations that remove markers. We
must know that an unidentified access can never see class or global properties.
2018-05-23 09:23:39 -07:00
Andrew Trick
e29c2089a4 Rework AccessStorageAnalysis design. 2018-05-23 09:23:39 -07:00
swift-ci
1b30e9f16b Merge remote-tracking branch 'origin/master' into master-next 2018-05-22 10:29:29 -07:00
Michael Gottesman
e8af11d61b [gardening] Rename ProjectionTree::getLeafTypes() => getLiveLeafTypes().
This is a more appropriate name. Otherwise, a reader could think that it returns
/all/ leaf types including dead leaf types.
2018-05-22 09:16:27 -07:00
swift-ci
f80606acce Merge remote-tracking branch 'origin/master' into master-next 2018-05-19 17:29:42 -07:00
Slava Pestov
bd6281c558 AST: Change SubstitutionMap conformance lookup callbacks to take ProtocolDecl and not ProtocolType 2018-05-19 01:09:17 -07:00
Slava Pestov
ebb1198d57 AST: There's no longer any reason to pass SubstitutionMap by const reference
SubstitutionMaps are now just a trivial pointer-sized value, so
pass them by value instead.

I did have to move a couple of functors from Type.h to SubstitutionMap.h
to resolve some issues with forward declarations.
2018-05-19 00:45:36 -07:00
swift-ci
2061fe38e6 Merge remote-tracking branch 'origin/master' into master-next 2018-05-18 15:09:32 -07:00
Jordan Rose
ff227f7c3b [SIL] Add comments and tests to prevent the 'mutableCopy' regression
rdar://problem/40373771
2018-05-18 13:29:49 -07:00
Jordan Rose
a68fbd1779 Revert "[SIL] Use camel_case::getFirstWord instead of custom hasPrefix function in getSelectorFamily"
We'd like to match what Clang does as closely as possible, but more
importantly 'mutableCopy' is two words. Comment and test case in
following commit.

This reverts commit 3cca85f435.
2018-05-18 13:29:49 -07:00
swift-ci
a51f750f32 Merge remote-tracking branch 'origin/master' into master-next 2018-05-18 13:09:32 -07:00
swift-ci
48a7bb2337 Merge pull request #16716 from vedantk/cov-do-catch 2018-05-18 13:03:28 -07:00
Vedant Kumar
d3ea09fafc [Coverage] Fix mappings of regions following do-catch stmts
Coverage reporting for source regions following do-catch statements was
incorrect, because it did not properly reflect early exits.

rdar://34244637
2018-05-18 12:11:14 -07:00
Vedant Kumar
2f5bed40da [Coverage] Add DEBUG helpers, NFC
These helpers make it easier to debug how profiling state and coverage
mappings are built up (just add -Xllvm -debug-only=SILProfiler to your
swiftc invocation).
2018-05-18 12:08:39 -07:00
swift-ci
bdc8528ac6 Merge remote-tracking branch 'origin/master' into master-next 2018-05-18 08:49:40 -07:00
Davide Italiano
78bdc45a2e [SIL] Relax isTypeMetadataAccessible() for debugger-produced modules.
SILModules built for the debugger have special powers to access
metadata for types in other files/modules. Thanks to John McCall for
suggesting the fix. This should fix a verifier failure in the lldb
testsuite. The reason why it wasn't caught during PR testing is that
this test wasn't run as part of the standard swift-pr cycle. I'm
going to submit another PR in lldb next to make sure it runs (and,
therefore, we can catch other regressions).

<rdar://problem/40336275>
2018-05-17 16:56:47 -07:00
swift-ci
336e42ee2c Merge remote-tracking branch 'origin/master' into master-next 2018-05-17 15:09:01 -07:00
Ben Langmuir
628b6a1fc7 Revert "Turn on ‘as’ bridging on Linux." 2018-05-17 14:54:35 -07:00
swift-ci
e0c8c31b0b Merge remote-tracking branch 'origin/master' into master-next 2018-05-17 14:29:05 -07:00
Lily Vulcano
b9455930ee Turn on ‘as’ bridging on Darwin. 2018-05-17 09:59:39 -07:00
swift-ci
448e1f8f13 Merge remote-tracking branch 'origin/master' into master-next 2018-05-17 09:28:51 -07:00
Jordan Rose
d224db89ba Merge pull request #16129 from ChristopherRogers/SR-7263
[SR-7263] Treat APIs returning unmanaged CF types as NS_RETURNS_INNER_POINTER
2018-05-17 09:16:10 -07:00
swift-ci
2714ed70c6 Merge remote-tracking branch 'origin/master' into master-next 2018-05-15 14:09:30 -07:00
John McCall
f75d0e76d2 Merge pull request #16615 from rjmccall/abi-accessibility
Perform value operations opaquely on ABI-inaccessible types
2018-05-15 16:59:52 -04:00