Commit Graph

852 Commits

Author SHA1 Message Date
Michael Gottesman b00966e247 [+0-all-args] Add more module_names to tests to enable running their plus_zero variants.
rdar://34222540
2018-03-13 19:47:50 -07:00
swift-ci a0d9c2371a Merge pull request #15184 from adrian-prantl/38324861 2018-03-12 14:53:15 -07:00
Adrian Prantl 6663462c53 Debug Info: Fix the emission of vector types.
Thanks to an improved IR verifier upstream we found that support for
vector types has been incomplete.

<rdar://problem/38324861>
2018-03-12 12:25:22 -07:00
Michael Gottesman 16484c9be5 [+0-all-args] Update plus zero tests.
rdar://34222540
2018-03-11 22:34:47 -07:00
Michael Gottesman 8dd5ea9b60 [+0-all-args] Add a space after REQUIRES: plus_one_runtime to eliminate avoidable merge conflicts when editing other parts of the file.
This helps my tooling for enabling +0.
2018-03-11 16:19:09 -07:00
Michael Gottesman 1f1c2a6b87 [+0-all-args] Update plus zero tests.
rdar://34222540
2018-03-11 12:08:36 -07:00
Michael Gottesman 7add2fd020 [+0-all-args] Update plus zero tests.
rdar://34222540
2018-03-10 10:33:12 -08:00
Michael Gottesman e6e55df5ea [+0-all-args] Mark all tests that will need updates for +0 as requiring a plus_one_runtime. 2018-03-10 02:37:51 -08:00
swift-ci 79ab0802b4 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-03-08 16:58:06 -08:00
Adrian Prantl 39cda11752 Deserialize all modules with the default resilience strategy when in LLDB
This turns all resilient types into fixed layouts thus allowing LLDB
to query their size. The long-term plan is to use remote mirrors for
this unformation instead of swift IRGen, but the library is not yet up
to the task.

rdar://problem/36663932
2018-03-08 14:36:18 -08:00
Adrian Prantl 1203896b03 Factor out the test for the .apple_names section and disable it on Linux.
This is in reaction to LLVM r322633.
2018-02-28 13:17:08 -08:00
Adrian Prantl 7cd6f235a4 Reenable dwarfdump --verify on end-to-end tests 2018-02-28 11:28:14 -08:00
Adrian Prantl 05a372a5dc Update testcase for llvm-dwarfdump output change 2018-02-28 11:24:26 -08:00
Adrian Prantl df338a760f Relax testcase to also work with a debug stdlib 2018-02-27 17:03:59 -08:00
Adrian Prantl 9b6a9946ec Be explicit about whether a DebugInfo-carying SILInstruction has debug info.
This patch both makes debug variable information it optional on
alloc_stack and alloc_box instructions, and forced variable
information on debug_value and debug_value_addr instructions. The
change of the interface uncovered a plethora of bugs in SILGen,
SILTransform, and IRGen's LoadableByAddress pass.

Most importantly this fixes the previously commented part of the
DebugInfo/local-vars.swift.gyb testcase.

rdar://problem/37720555
2018-02-21 10:50:19 -08:00
Adrian Prantl 49b9c1fd6f Extend test/DebugInfo/local-vars.swift.gyb to include more scenarios.
New data types include various forms of enums, tuples, large structs,
generics, and existentials. New contexts include switch statements
closure captures and (also) tuples.

This uncovered at least one bug so some of the CHECKs are commented out.

<rdar://problem/36031959>
2018-02-20 13:50:41 -08:00
Adrian Prantl 3c96333929 Emit debug info shadow copies of the addresses of dynamic allocas.
Whan an alloca is dynamic, all FastISel can do is describe the
register in which the address of of the dynamic alloca is kept, and if
the value isn't used it will get kicked out by regalloc.

rdar://problem/36663932
2018-02-15 10:00:33 -08:00
Adrian Prantl 56d8a8dfe9 When generating debug info for AllocStackInst, make sure to describe the alloca.
This way an llvm.dbg.declare instrinsic is used, which is valid for
the entire lifetime of the alloca.

rdar://problem/36663932
2018-02-14 11:12:48 -08:00
Arnold Schwaighofer 3a63c0fc76 Update tests 2018-02-13 04:19:59 -08:00
Arnold Schwaighofer d981bb1d96 Mangling: noescape functions will be trivial and no longer compatible with escape function types.
Mangle escapeness as part of the type.

Part of:
SR-5441
rdar://36116691
2018-02-06 08:51:43 -08:00
Mark Lacey e43ff7164c Merge pull request #14299 from rudkx/iuo-remove-the-type
IUO: Generate Optional<T> rather than ImplicitlyUnwrappedOptional<T>
2018-02-01 21:58:37 -08:00
Erik Eckstein 17d4459227 debug-info: Don't write temporary file names in the debug info.
This would prevent incremental llvm compilation because we would generate different IR on every compiler invocation.
2018-02-01 12:15:36 -08:00
Mark Lacey f08823757a IUO: Generate Optional<T> rather than ImplicitlyUnwrappedOptional<T>.
Stop creating ImplicitlyUnwrappedOptional<T> so that we can remove it
from the type system.

Enable the code that generates disjunctions for Optional<T> and
rewrites expressions based on the original declared type being 'T!'.

Most of the changes supporting this were previously merged to master,
but some things were difficult to merge to master without actually
removing IUOs from the type system:
- Dynamic member lookup and dynamic subscripting
- Changes to ensure the bridging peephole still works

Past commits have attempted to retain as much fidelity with how we
were printing things as possible. There are some cases where we still
are not printing things the same way:
- In diagnostics we will print '?' rather than '!'
- Some SourceKit and Code Completion output where we print a Type
  rather than Decl.

Things like module printing via swift-ide-test attempt to print '!'
any place that we now have Optional types that were declared as IUOs.

There are some diagnostics regressions related to the fact that we can
no longer "look through" IUOs. For the same reason some output and
functionality changes in Code Completion. I have an idea of how we can
restore these, and have opened a bug to investigate doing so.

There are some small source compatibility breaks that result from
this change:
- Results of dynamic lookup that are themselves declared IUO can in
  rare circumstances be inferred differently. This shows up in
  test/ClangImporter/objc_parse.swift, where we have
    var optStr = obj.nsstringProperty
  Rather than inferring optStr to be 'String!?', we now infer this to
  be 'String??', which is in line with the expectations of SE-0054.
  The fact that we were only inferring the outermost IUO to be an
  Optional in Swift 4 was a result of the incomplete implementation of
  SE-0054 as opposed to a particular design. This should rarely cause
  problems since in the common-case of actually using the property rather
  than just assigning it to a value with inferred type, we will behave
  the same way.
- Overloading functions with inout parameters strictly by a difference
  in optionality (i.e. Optional<T> vs. ImplicitlyUnwrappedOptional<T>)
  will result in an error rather than the diagnostic that was added
  in Swift 4.1.
- Any place where '!' was being used where it wasn't supposed to be
  allowed by SE-0054 will now treat the '!' as if it were '?'.
  Swift 4.1 generates warnings for these saying that putting '!'
  in that location is deprecated. These locations include for example
  typealiases or any place where '!' is nested in another type like
  `Int!?` or `[Int!]`.

This commit effectively means ImplicitlyUnwrappedOptional<T> is no
longer part of the type system, although I haven't actually removed
all of the code dealing with it yet.

ImplicitlyUnwrappedOptional<T> is is dead, long live implicitly
unwrapped Optional<T>!

Resolves rdar://problem/33272674.
2018-01-31 12:15:58 -08:00
Greg Parker e223f1fc9b [IRGen][runtime] Simplify runtime CCs and entry point ABIs (#14175)
* Remove RegisterPreservingCC. It was unused.
* Remove DefaultCC from the runtime. The distinction between C_CC and DefaultCC
  was unused and inconsistently applied. Separate C_CC and DefaultCC are
  still present in the compiler.
* Remove function pointer indirection from runtime functions except those
  that are used by Instruments. The remaining Instruments interface is
  expected to change later due to function pointer liability.
* Remove swift_rt_ wrappers. Function pointers are an ABI liability that we
  don't want, and there are better ways to get nonlazy binding if we need it.
  The fully custom wrappers were only needed for RegisterPreservingCC and
  for optimizing the Instruments function pointers.
2018-01-29 13:22:30 -08:00
Davide Italiano 9f341886e7 [DebugInfo] Improve check lines in a test.
Addresses Vedant's post commit review. Make sure we store a
value to the shadow SSA copy we create.
2018-01-25 07:46:50 -08:00
Davide Italiano fa10866c38 [IRGenSIL] When emitting a shadow copy, honour the layout.
This code was ad-hoc trying to reconstruct the layout. Ask TypeInfo
instead, as it knows what's the right thing to do.
This allows to print field of classes nested inside classes correctly
in lldb (SR-6791).

<rdar://problem/36518505>
2018-01-24 13:20:26 -08:00
Arnold Schwaighofer 2678788438 IRGen: Set artifical functions for key path code
Otherwise, debug info asserts get triggered because of a missing debug
loc.

rdar://36797675
2018-01-23 20:44:51 -08:00
Karoy Lorentey f2a96496a0 [StringGuts] Support for 32-bit platforms
Add 32-bit support to the new StringGuts.
2018-01-21 12:36:09 -08:00
Michael Ilseman 3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00
Adrian Prantl b4781f63ef Debug Info: Create artificial functions in a virtual file <compiler-generated>.
For the majority of artificial helper functions the filename is
actively misleading since it usually represents the file of the caller
that triggered the helper to be generated. Instead, this patch creates
a virtual filname `<compiler-generated>` to make it very obvious that
the function has not correspondence to any source code.

<rdar://problem/33809560>
2018-01-17 11:09:35 -08:00
Adrian Prantl c74ae5f375 Remove the redundant SILLocation::getCompilerGenerated interface (NFC) 2018-01-17 11:09:23 -08:00
Slava Pestov bb842eadf7 Attempt to fix DebugInfo/self.swift on 32-bit 2018-01-12 21:28:25 -08:00
Vedant Kumar b27ed065b6 [DebugInfo] Avoid applying a misleading cleanup loc in case blocks
Switch cases without a trailing curly brace have ambiguous cleanup
locations. Here's what the current stepping behavior looks like:

  switch x {
    case ...:
      if true { foo() } // Step
      else    { bar() } // Step
  }

The second step can be misleading, because users might think that the
else branch is taken.

rdar://35628620
2018-01-12 17:19:45 -08:00
Adrian Prantl cb125bd3f9 Don't drop function argument debug info in the LoadableByAddress transformation
rdar://problem/36392957
2018-01-10 08:58:56 -08:00
Erik Eckstein cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Adrian Prantl fdc9489d25 Zero-initialize uninitialized variables at -Onone.
This un-breaks the LLDB testsuite.

To make it unambiguous whether a `var` binding has been initialized,
zero-initialize the first pointer-sized field. LLDB uses this to
recognize to detect uninitizialized variables. This can be removed once
swiftc switches to @llvm.dbg.addr() intrinsics. This dead store will get
optimized away when optimizations are enabled.

<rdar://problem/36156857>
2017-12-21 13:18:03 -08:00
Pavel Yaskevich c18edfc632 [Mangling/ABI] NFC: Fix test failures uncovered by CI on i386 (IRGen/stdlib/DebugInfo) 2017-12-18 21:06:54 -08:00
Pavel Yaskevich 600b15821d [Mangling/ABI] NFC: Fix DebugInfo tests to reflect label mangling changes 2017-12-18 15:44:24 -08:00
Adrian Prantl 521de91ba7 Fix the debug info generated by the LoadableByAddress transformation.
And unbreak the LLDB testsuite.

This patch fixes three problems with the original implementation:
- Use SILBuilderWithScope instead of SILBuilder to avoid holes in the
  lexical scopes.
- Use an artificial location for stores to the alloca to avoid the debugger
  stopping before the variable is initialized.
- Recognize debug_value_addr instructions referring to an alloc_stack
  instruction to avoid introducing an extra indirection in the debug info.

rdar://problem/31975108
2017-12-02 16:48:34 -08:00
swift-ci 0d91b89948 Merge pull request #13145 from adrian-prantl/25772716 2017-11-29 11:59:45 -08:00
Adrian Prantl 64425c8525 Remove dead code and an obsolete testcase.
The debug location is now unconditionally being set for each
instruction, so resetting the location at the beginning of each basic
block is redundant.

<rdar://problem/25772716>
2017-11-29 10:02:13 -08:00
Slava Pestov b74d1b1be8 Add test case that causes IRGen to construct a SIL type with unbound generics in it 2017-11-28 16:04:15 -08:00
Bob Wilson 7d8661a93a Fix test to avoid checking for named IR values
The previous change to the DebugInfo/linetable-cleanups.swift test
introduced FileCheck patterns with references to named IR values. In a
release build, the values are anonymous, so those patterns do not match.
rdar://problem/35639381
2017-11-19 21:29:31 -08:00
Joe Shajrawi d8289aa3ec Code size: destroy_addr outline 2017-11-17 16:10:27 -08:00
swift-ci 80f0e66a04 Merge pull request #12967 from adrian-prantl/34326355 2017-11-16 13:48:48 -08:00
Adrian Prantl e574aa765f Don't emit shadow copies for anonymous variables.
Switch statements generate at least one anonymous match variable per
case, which consumes both a lot of stack space and an explosion of
range extension depencies due to the way case statements are scoped.

rdar://problem/34326355
2017-11-16 10:41:40 -08:00
Arnold Schwaighofer 0971d82f70 SILGen: Remaining fixes for @callee_guaranteed closures and enable it
- Fix block to func reabstraction thunks block argument handling
- Forward cast ownership
- Fix applyPartiallyAppliedSuperMethod ownership for @callee_guaranteed closures
- Avoid a copy in buildBlockToFuncThunkBody
- Update tests for callee_guaranteed closures

SR-5441
rdar://33255593
2017-11-15 19:46:08 -08:00
Adrian Prantl 5e36991290 Debug Info / SILGen: fix the source location of variable assignments
by setting the location of the store emitted for a pattern binding
decl to the location of that PBD.

<rdar://problem/35430708>
2017-11-12 10:35:26 -08:00
swift-ci 2996e332b4 Merge pull request #12861 from adrian-prantl/35430708 2017-11-10 16:33:21 -08:00
swift-ci b14077d6aa Merge pull request #12827 from adrian-prantl/unxfail 2017-11-10 15:22:16 -08:00