Commit Graph

1612 Commits

Author SHA1 Message Date
Augusto Noronha
46117cefdd [NFC] Fix debug info enum test failing on 32 bit 2023-11-30 11:35:01 -08:00
Augusto Noronha
1296aeeb65 Merge pull request #69789 from augusto2112/gen-enum-debug
Generate full debug info for enums
2023-11-16 11:09:56 -08:00
Felipe de Azevedo Piovezan
d11563022f [DebugInfo] Re-enable x86 async tests
With https://github.com/apple/llvm-project/pull/7787 merged, we can now finally
renable these tests, as the x86 swift async handling should be properly
preserved by the x86 instruction selector.

These tests contained some incorrect checks from a time where it was expecting
an entry value even in the entry funclet of coroutines. For example, it had
this:
```
CHECK-NEXT: [[ASYNC_REG:DW_OP_.*], DW_OP_plus_uconst 0x10, DW_OP_plus_uconst 0x8,
DW_OP_deref
```

Which tries to find some "async reg", but really matches anything. It worked by
accident on arm, but not on x86. The correct check is simply:

```
CHECK-NOT: OP_entry_value
```
2023-11-14 06:26:48 -08:00
Augusto Noronha
594f51a13e Generate full debug info for enums
Replace the generation of debug info for enums from DW_TAG_union_type
to either DW_TAG_enumeration_type or DW_TAG_variant_part, as these
representation match Swift enums more closely.
2023-11-13 14:31:29 -08:00
Richard Howell
3d8e4b9102 Merge pull request #68847 from rmaz/filecompdirpassthrough
Pass through file-compilation-dir to the ClangImporter.
2023-10-30 07:12:02 -07:00
Felipe de Azevedo Piovezan
d2be399bd8 Merge pull request #69439 from felipepiovezan/felipe/renable-async-test 2023-10-27 08:05:58 -07:00
Felipe de Azevedo Piovezan
bae0087259 Merge pull request #69438 from felipepiovezan/felipe/c11_tests 2023-10-27 08:05:34 -07:00
Felipe de Azevedo Piovezan
5f1c40926f [DebugInfo][NFC] Re-enable async-direct-arg.swift test
This test had been disabled back in 2021:
https://github.com/apple/swift/pull/36479

With this commit, it should now pass.

We also add a 64-bit target requirement, since this test relies on entry_values
being produced.
2023-10-26 12:47:29 -07:00
Felipe de Azevedo Piovezan
22e1badc55 [DebugInfo][NFC] Update tests to account for C11 compile units
These tests were specifically checking for C99 compile units, causing them to
fail on the Ubuntu bots.
2023-10-26 12:36:29 -07:00
Felipe de Azevedo Piovezan
9f81e3ace6 [DebugInfo][NFC] Add 64-bit requirement to async tests
Since https://reviews.llvm.org/D158638, entry values are only produced for
64-bit architectures. As such, related tests need to be guarded by the
appropriate REQUIRES directive.
2023-10-26 08:52:25 -07:00
Richard Howell
198d2ff2ca Pass through file-compilation-dir to the ClangImporter.
This change passes through the -file-compilation-dir flag to the
ClangImporter instance as -ffile-compilation-dir. When used in
conjunction with https://github.com/llvm/llvm-project/pull/67744
this will allow for setting the compilation directory of pcm
files using the -file-compilation-dir flag.
2023-10-26 08:38:22 -07:00
Augusto Noronha
75e45bd024 Emit extra inhabitants in debug info for basic types
To support debugging embedded Swift, we will need to store information
that previously we searched in metadata. Extra inhabitants is one of
those.
2023-10-20 16:14:52 -07:00
Adrian Prantl
94754613d2 Relax test.
On Windows a separate .loc directive is emitted to introduce the function
epilogue, which is not there on other platforms.

rdar://116482190
2023-10-06 13:55:33 -07:00
swift-ci
049f867392 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-03 13:58:47 -07:00
Richard Howell
76dd1f9069 Set clang module directory correctly with fmodule-file-home-is-cwd
When building and importing modules built with
`-fmodule-file-home-is-cwd` we should be setting the debug info
directory to the current working directory. This matches the
behavior in clang: https://reviews.llvm.org/D134911
2023-09-29 08:32:36 -07:00
Evan Wilde
700aa8aa70 Merge remote-tracking branch 'upstream/main' into rebranch
Merge conflict while removing `nocapture` from
`s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF`. Resolution
was to remove nocapture from the expected output in both cases:
```
// CHECK-LABEL: define swiftcc void @"$s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF"(ptr noalias[-nocapture-] %0, ptr %T, ptr %T.P)
```

Conflict cause: 4858cb6225
This is the same as the original change to this file. The conflict seems
to be due to the next line changing, when moving from llvm.dbg.addr to
llvm.dbg.value.

Conflicts:
  test/DebugInfo/move_function_dbginfo.swift
2023-09-26 13:36:57 -07:00
Alex Lorenz
6ecea1ac09 Merge pull request #68481 from hyp/eng/no-nocapture
[IRGen][interop] do not add 'nocapture' to not bitwise takable types
2023-09-26 07:52:05 -07:00
Alex Lorenz
4858cb6225 [IRGen][interop] do not add 'nocapture' to not bitwise takable types
The use of 'nocapture' for parameters and return values is incorrect for C++ types, as they can actually capture a pointer into its own value (e.g. std::string in libstdc++)

rdar://115062687
2023-09-25 17:43:34 -07:00
swift-ci
01085510f0 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-22 16:42:20 -07:00
Slava Pestov
156fd080e7 Merge pull request #68700 from slavapestov/fix-rdar115459973
ASTDemangler: Fix round-tripping of SILBoxTypeWithLayout
2023-09-22 19:25:11 -04:00
Slava Pestov
57b702be07 ASTDemangler: Fix round-tripping of SILBoxTypeWithLayout
The more awkward setup with pushGenericParams()/popGenericParams()
is required so that when demangling requirements and field types
we get the correct pack-ness for each type parameter. The pack-ness
is encoded as part of the generic signature, and not as part of
the type parameter mangling itself.

Fixes the ASTDemangler issue from rdar://problem/115459973.
2023-09-22 11:27:18 -04:00
swift-ci
1b6470ca9c Merge remote-tracking branch 'origin/main' into rebranch 2023-09-20 15:07:15 -07:00
Yuta Saito
c5314bd3af Centralize KeyPath accessor calling convention logic to IRGen
KeyPath's getter/setter/hash/equals functions have their own calling
convention, which receives generic arguments and embedded indices from a
given KeyPath argument buffer.
The convention was previously implemented by:
1. Accepting an argument buffer as an UnsafeRawPointer and casting it to
   indices tuple pointer in SIL.
2. Bind generic arguments info from the given argument buffer while emitting
   prologue in IRGen by creating a new forwarding thunk.

This 2-phase lowering approach was not ideal, as it blocked KeyPath
projection optimization [^1], and also required having a target arch
specific signature lowering logic in SIL-level [^2].

This patch centralizes the KeyPath accessor calling convention logic to
IRGen, by introducing `@convention(keypath_accessor_XXX)` convention in
SIL and lowering it in IRGen. This change unblocks the KeyPath projection
optimization while capturing subscript indices, and also makes it easier
to support WebAssembly target.

[^1]: https://github.com/apple/swift/pull/28799
[^2]: https://forums.swift.org/t/wasm-support/16087/21
2023-09-20 11:25:39 -07:00
swift-ci
af68664ed6 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-06 08:13:48 -07:00
Felipe de Azevedo Piovezan
2c3c3c1933 Merge pull request #67077 from DianQK/type-decl-disubprogram
[IRGen][DebugInfo] split method declaration and definition.
2023-09-06 11:08:39 -04:00
Evan Wilde
a9ea9da67e Disabling DebugInfo tests for rebranch
Disabling failing tests:
 - DebugInfo/BridgingHeaderPCH.swift
 - DebugInfo/ClangModuleBreadcrumbs.swift

Trying to get more visibility on Linux for rebranch status.
Radar to track fixing these test failures: rdar://114728459
2023-09-05 11:46:03 -07:00
Felipe de Azevedo Piovezan
d069ad80dd [DebugInfo] Disable failing x86 tests for rebranch 2023-09-01 14:31:37 -04:00
Adrian Prantl
238c73e0d4 Update test to be more robust. 2023-08-23 17:07:12 -07:00
Adrian Prantl
f1d2e8f965 Relax test 2023-08-23 16:32:19 -07:00
swift-ci
c1b7cac54b Merge remote-tracking branch 'origin/main' into rebranch 2023-08-17 18:34:10 -07:00
Hiroshi Yamauchi
72bdac64ba Fix three tests for Windows AArch64 2023-08-17 13:42:23 -07:00
Felipe de Azevedo Piovezan
0d24362fa0 [DebugInfo] Update coroutine tests to expect fewer entry values 2023-08-17 10:36:27 -04:00
swift-ci
864fd7fc68 Merge remote-tracking branch 'origin/main' into rebranch 2023-08-08 16:14:54 -07:00
Zak Kent
a459c97d74 [SILGen] [Test] Address code review comments 2023-08-08 11:25:11 -07:00
Zak Kent
3b4e94f65b [SILGen] Emit toplevel code through emitFunctionDefinition
Emit SILDeclRefs representing entry points with SourceFile
source correctly.
2023-08-08 11:25:11 -07:00
DianQK
81953efcfb [IRGen][DebugInfo] Split method declaration and definition.
When the function is a method, we want a DW_AT_declaration there.
Because there's no good way to cross the CU boundary to insert a nested
DISubprogram definition in one CU into a type defined in another CU when
doing LTO builds.
2023-08-06 20:21:15 +08:00
swift-ci
9acd53dfcb Merge remote-tracking branch 'origin/main' into rebranch 2023-08-02 11:16:25 -07:00
Evan Wilde
24cdf71ca4 Merge pull request #67630 from etcwilde/ewilde/compat-cleanups
Reenable compat lib in a couple tests
2023-08-02 11:11:05 -07:00
Evan Wilde
8b41d2b003 Reenable compat lib in a couple tests
This patch re-enables the compat library on a couple of tests. The issue
was that the compat library was pulling in compiler-rt symbols for
determining system version. That was fixed with a little dlsym action in
188c7bd626. It was using the symbols to
determine if we had voucher_needs_adopt. It just took a while to
re-enable it in these tests.
2023-07-31 15:00:55 -07:00
swift-ci
6610561794 Merge remote-tracking branch 'origin/main' into rebranch 2023-07-28 08:53:26 -07:00
Adrian Prantl
1f6091aa45 Merge pull request #66744 from asavonic/debuginfo-fragment-distinct-inline-loc
[DebugInfo] Emit distinct DILocation for different inline instances
2023-07-28 08:45:53 -07:00
swift-ci
b0f5b893fb Merge remote-tracking branch 'origin/main' into rebranch 2023-07-28 06:34:47 -07:00
Slava Pestov
3a24b5361d TypeDecoder: Push one-element tuple unwrapping down into createTupleType() implementations
The old behavior was only correct when building substituted types,
ie, if createTupleType() was never called with a pack expansion type.

This was the case in the runtime's MetadataLookup which applies
substitutions to an interface type to ultimately construct metadata
for a fully-concrete type, but not in the ASTDemangler, where we
actually build interface types.

Since TypeDecoder doesn't have any way to query the kind of type
it just built, let's just instead make this decision inside the
implementation of the type builder concept.

Fixes https://github.com/apple/swift/issues/67322.
2023-07-27 12:14:54 -04:00
swift-ci
1969199a8e Merge remote-tracking branch 'origin/main' into rebranch 2023-07-26 23:13:08 -07:00
Max Desiatov
f8dee9e270 test/DebugInfo: enable test for Wasm object format (#67532)
This test is valid when testing the Wasm target, so let's fully enable it.
2023-07-26 18:42:44 +01:00
Joe Groff
aee071bf4e Introduce an experimental @_rawLayout attribute.
This attribute can be attached to a noncopyable struct to specify that its
storage is raw, meaning the type definition is (with some limitations)
able to do as it pleases with the storage. This provides a basis for
implementing types for things like atomics, locks, and data structures
that use inline storage to store conditionally-initialized values.
The example in `test/Prototypes/UnfairLock.swift` demonstrates the use
of a raw layout type to wrap Darwin's `os_unfair_lock` APIs, allowing
a lock value to be stored inside of classes or other types without
needing a separate allocation, and using the borrow model to enforce
safe access to lock-guarded storage.
2023-07-24 14:28:19 -07:00
swift_jenkins
6c10e53a92 Merge remote-tracking branch 'origin/main' into next 2023-07-03 16:41:55 -07:00
Arnold Schwaighofer
fc766a39d3 Fix some more tests 2023-06-29 16:16:56 -07:00
Evan Wilde
7c77fa6f45 Merge branch 'main' into ewilde/update-next
Automerger into next doesn't seem to be working. Manually merging.
2023-06-29 08:33:53 -07:00
Andrew Savonichev
ca6e74226d [DebugInfo] Emit distinct DILocation for different inline instances
LLVM seems to determine a variable instance as a combination of DILocalVariable
and DILocation. Therefore if multiple llvm.dbg.declare have the same
variable/location parameters, they are considered to be referencing the same
instance of variable.

Swift IRGen emits a set of llvm.dbg.declare calls for every variable
instance (with unique SILDebugScope), so it is important that these calls have
distinct variable/location parameters. Otherwise their DIExpression may be
incorrect when treated as referencing the same variable. For example, if they
have a DIExpression with fragments, we will see this as multiple declarations of
the same fragment. LLVM detects this and crashes with assertion failure:

DwarfExpression.cpp:679: void llvm::DwarfExpression::addFragmentOffset(const
llvm::DIExpression *): Assertion `FragmentOffset >= OffsetInBits &&
"overlapping or duplicate fragments"' failed.

The patch resolves #55703. The LIT test (debug_scope_distinct.swift) is the
reproducer from that issue.
2023-06-29 17:06:24 +09:00