Commit Graph

823 Commits

Author SHA1 Message Date
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
swift-ci
2cf133a93f Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-15 11:38:11 -08:00
Andrew Trick
8a8c86a21f Exhaustive access marker verification. 2018-02-15 11:26:54 -08:00
swift-ci
7b6bd536e4 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-14 15:38:04 -08:00
Joe Groff
d4e03f2ba3 SIL: Add an 'external' KeyPathPatternComponent kind.
This will allow key paths to resiliently reference public properties from other binaries by referencing a descriptor vended by the originating binary. NFC yet, this just provides printing/parsing/verification of the new component.
2018-02-14 10:48:24 -08:00
swift-ci
2b9b846f42 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-14 05:38:02 -08:00
Arnold Schwaighofer
a9fa8c9c2b Merge pull request #14514 from aschwaighofer/wip_closure_capture_abi_part2
WIP: Closure ABI - Make @noescape Swift closures trivial
2018-02-14 05:19:25 -08:00
swift-ci
51fd06dda7 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-13 07:58:32 -08:00
Joe Shajrawi
102b6f0b61 Merge pull request #14587 from shajrawi/newinstr
Optimizer peephole for tagged BridgeObjects
2018-02-13 07:38:53 -08:00
Arnold Schwaighofer
48b3737404 SIL: Add support for trivial @noescape function types
- @noescape functions are trivial types
That makes @noescape functions incompatible with escaping functions.
- Forward ownership of mark_dependence %3 : callee_guaranteed () -> () on %0 : noescape @callee_guaranteed () -> ()
- SIL: Add ABIEscapeToNoEscapeConversion to SILFunctionType::ABICompatibilityCheckResult
- SIL: A thin_to_thick_function with a @noescape result type has trivial ownership
- SIL: thin_to_thick_function can create noescape function types

Part of:
SR-5441
rdar://36116691
2018-02-13 04:19:58 -08:00
Joe Shajrawi
f732ea66ef Builtins: add ValueToBridgeObject instruction 2018-02-12 13:27:59 +02:00
swift-ci
9097df627e Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-07 05:18:18 -08:00
Arnold Schwaighofer
d51053b003 Add convert_escape_to_noescape instruction for converting escaping to noescape functions
@noescape function types will eventually be trivial. A
convert_escape_to_noescape instruction does not take ownership of its
operand. It is a projection to the trivial value carried by the closure
-- both context and implementation function viewed as a trivial value.

A safe SIL program must ensure that the object that the project value is based
on is live beyond the last use of the trivial value. This will be
achieve by means of making the lifetimes dependent.

For example:

  %e = partial_apply [callee_guaranteed] %f(%z) : $@convention(thin) (Builtin.Int64) -> ()
  %n = convert_escape_to_noescape %e : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
  %n2 = mark_dependence %n : $@noescape @callee_guaranteed () -> () on %e : $@callee_guaranteed () -> ()
  %f2 = function_ref @use : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  apply %f2(%n2) : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  release_value %e : $@callee_guaranteed () -> ()

Note: This is not yet actually used.

Part of:
SR-5441
rdar://36116691
2018-02-06 18:01:23 -08:00
swift-ci
e77c3a60dd Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-02-06 05:59:28 -08:00
Mark Lacey
b4b66bc8e8 Replace getAnyOptionalObjectType with getOptionalObjectType. 2018-02-05 23:59:00 -08:00
swift-ci
26cc79d4df Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-31 20:58:20 -08:00
Saleem Abdulrasool
a134cdb2a3 SIL: use unsigned for the member for bool
Use `unsigned` instead of `bool` for the member to make all members of
the structure the same.  This fixes the behaviour of the structure on
Windows.  The difference in the type caused the bitfields to be pushed
to the natural alignment of int resulting in the structure being padded
to 12-bytes instead of being packed into 4.  Using `#pragma pack` also
did not make a difference here as the structure remained padded to
12-bytes.
2018-01-31 18:56:55 -08:00
swift-ci
ed1cf3bc48 Merge remote-tracking branch 'origin/master' into master-next 2018-01-02 15:29:18 -08:00
Chris Lattner
415cd50ba2 Reduce array abstraction on apple platforms dealing with literals (#13665)
* Reduce array abstraction on apple platforms dealing with literals

Part of the ongoing quest to reduce swift array literal abstraction
penalties: make the SIL optimizer able to eliminate bridging overhead
 when dealing with array literals.

Introduce a new classify_bridge_object SIL instruction to handle the
logic of extracting platform specific bits from a Builtin.BridgeObject
value that indicate whether it contains a ObjC tagged pointer object,
or a normal ObjC object. This allows the SIL optimizer to eliminate
these, which allows constant folding a ton of code. On the example
added to test/SILOptimizer/static_arrays.swift, this results in 4x
less SIL code, and also leads to a lot more commonality between linux
and apple platform codegen when passing an array literal.

This also introduces a couple of SIL combines for patterns that occur
in the array literal passing case.
2018-01-02 15:23:48 -08:00
swift-ci
684ef2cd9a Merge remote-tracking branch 'origin/master' into master-next 2017-12-30 22:49:12 -08:00
Chris Lattner
de289752fe Implement a few silcombine transformations for arrays (#13652)
* Implement a few silcombine transformations for arrays

 - Useless existential_ref <-> class conversions.
 - mark_dependence_inst depending on uninteresting instructions.
 - release(init_existential_ref(x)) -> release(x) when hasOneUse(x)
 - Update COWArrayOpt to handle the new forms generated by this.

these aren't massive performance wins, but do shrink the size of SIL when
dealing with arrays.

* Generalize testcase to work on linux and on mac when checking stdlib is enabled.
2017-12-30 22:30:37 -08:00
swift-ci
f8dde3619a Merge remote-tracking branch 'origin/master' into master-next 2017-12-27 10:49:23 -08:00
David Zarzycki
679538b72c [SIL] NFC: Migrate SelectInstBase subclasses to InstructionBaseWithTrailingOperands 2017-12-27 11:14:17 -05:00
David Zarzycki
d532fdefe0 [SIL] NFC: Migrate AllocRefInstBase subclasses to InstructionBaseWithTrailingOperands 2017-12-27 08:00:20 -05:00
David Zarzycki
26a1187a3a [SIL] NFC: Migrate CondBranchInst to InstructionBaseWithTrailingOperands
Also, repack misc bits and stop hard coding the number of fixed operands.
2017-12-26 07:39:59 -05:00
David Zarzycki
32284f1023 [SIL] NFC: Migrate ObjectInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
9f42304dd7 [SIL] NFC: Migrate MarkFunctionEscapeInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
81c29d7f98 [SIL] NFC: Migrate SwitchValueInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
bc31a3542f [SIL] NFC: Migrate YieldInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
25b85596b2 [SIL] NFC: Migrate BranchInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
2dc1917283 [SIL] NFC: Migrate AllocBoxInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
2630944535 [SIL] NFC: Migrate AllocExistentialBoxInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
f572569fb1 [SIL] NFC: Migrate BuiltinInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
33300640ae [SIL] NFC: Migrate BindMemoryInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
d2552969f6 [SIL] NFC: Migrate StructInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
65a31cf113 [SIL] NFC: Migrate TupleInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:59 -05:00
David Zarzycki
1321eceb0c [SIL] NFC: Migrate MetatypeInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:58 -05:00
David Zarzycki
ee0550ecdf [SIL] NFC: Migrate WitnessMethodInst to InstructionBaseWithTrailingOperands 2017-12-26 07:39:58 -05:00
David Zarzycki
09d541f758 [SIL] NFC: Refactor UnaryInstructionWithTypeDependentOperandsBase
Refactor UnaryInstructionWithTypeDependentOperandsBase into two template
classes, where the original template now subclasses a simpler template
called "InstructionBaseWithTrailingObjects".
2017-12-26 07:39:58 -05:00
swift-ci
d80084ea16 Merge remote-tracking branch 'origin/master' into master-next 2017-12-22 12:09:13 -08:00
David Zarzycki
ed85954275 [SIL] NFC: Migrate TupleInst to llvm::TrailingObjects
Also, repack the count variable into the misc object header bits.
2017-12-22 11:33:47 -05:00
David Zarzycki
83c1054034 [SIL] NFC: Migrate StructInst to llvm::TrailingObjects
Also, repack the count variable into the misc object header bits.
2017-12-22 11:16:33 -05:00
David Zarzycki
5012a80e39 [SIL] NFC: Repack misc StringLiteralInst bits 2017-12-22 10:58:21 -05:00
David Zarzycki
fcfdd4c8ca [SIL] NFC: Migrate BuiltinInst to llvm::TrailingObjects
Also, repack the count variables into the misc object header bits.
2017-12-22 10:29:41 -05:00
swift-ci
8e75a2fbbd Merge remote-tracking branch 'origin/master' into master-next 2017-12-18 13:28:54 -08:00
swift-ci
0302515cf0 Merge remote-tracking branch 'origin/master' into master-next 2017-12-18 12:48:55 -08:00
John McCall
94116347a2 Fix some warnings: extra semicolons, anonymous structs. 2017-12-18 15:31:47 -05:00
David Zarzycki
c75e8299f1 [SIL] NFC: Repack misc MetatypeInst bits 2017-12-17 21:35:27 -05:00
David Zarzycki
bc44e5a150 [SIL] NFC: Repack misc BeginAccessInst bits 2017-12-17 21:23:37 -05:00
David Zarzycki
931ea24f99 [SIL] NFC: Repack misc EndAccessInst bits 2017-12-17 21:14:49 -05:00