Commit Graph

24 Commits

Author SHA1 Message Date
Arnold Schwaighofer
f664b16010 SIL: Add an on stack version of partial_apply
It does not take ownership of its non-trivial arguments, is a trivial
function type and therefore must not be destroyed. The compiler must
make sure to extend the lifetime of non-trivial arguments beyond the
last use of the closure.

  %objc = copy_value %0 : $AnObject
  %closure = partial_apply [stack] [callee_guaranteed] %16(%obj) : $@convention(thin) (@guaranteed AnObject) -> ()
  %closure2 = mark_dependence %closure : $@noescape @callee_guaranteed () -> () on %obj : $AnObject
  %user = function_ref @useClosure : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  apply %user(%closure2) : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  dealloc_stack %closure : $() ->()
  destroy_value %obj : $AnObject // noescape closure does not take ownership

SR-904
rdar://35590578
2019-01-15 11:20:33 -08:00
Arnold Schwaighofer
74736d8ee2 Don't duplicate basic blocks ending in dynamic_method_br
IRGen does not support objc methods thunks.

rdar://46531828
2018-12-11 10:26:52 -08:00
John McCall
3a044683b0 Update SILLoop::canDuplicate to correctly handle begin_apply.
Leave a warning in isTriviallyDuplicatable so that future updates
there will know to also update this code.
2018-08-26 04:10:07 -04:00
Andrew Trick
1d08be56a3 Mark begin_access is non-clonable (!isTriviallyDuplicatable()).
In one shot, this prevents multiple CFG transforms from breaking the simple
begin/end access marker pattern for access scopes.
2018-03-01 00:05:34 -08:00
John McCall
ab3f77baf2 Make SILInstruction no longer a subclass of ValueBase and
introduce a common superclass, SILNode.

This is in preparation for allowing instructions to have multiple
results.  It is also a somewhat more elegant representation for
instructions that have zero results.  Instructions that are known
to have exactly one result inherit from a class, SingleValueInstruction,
that subclasses both ValueBase and SILInstruction.  Some care must be
taken when working with SILNode pointers and testing for equality;
please see the comment on SILNode for more information.

A number of SIL passes needed to be updated in order to handle this
new distinction between SIL values and SIL instructions.

Note that the SIL parser is now stricter about not trying to assign
a result value from an instruction (like 'return' or 'strong_retain')
that does not produce any.
2017-09-25 02:06:26 -04:00
Andrew Trick
3871a54402 Fix SILLoop::canDuplicate to handle all kinds of open_existential instructions. 2017-09-15 14:08:58 -07:00
Arnold Schwaighofer
d6586d95c3 SimplifyCFG: We can't duplicate blocks that contain 'throw'
SR-4404
rdar://31328081
2017-03-30 14:00:07 -07:00
Bob Wilson
37e7d1c627 Merge remote-tracking branch 'origin/master' into master-next 2017-01-08 17:07:46 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Bob Wilson
b227f45b7e Merge remote-tracking branch 'origin/master' into master-next 2016-10-27 22:28:28 -07:00
Erik Eckstein
6924badcc1 SIL: fix a bug which can cause the stack nesting to get broken by loop unrolling
We must not unroll a loop with alloc_ref [stack] if a dealloc_stack is outside the loop.

related to rdar://problem/28878079
2016-10-21 09:06:59 -07:00
Erik Eckstein
49f90584c5 SIL: fix a bug which can cause the stack nesting to get broken by SimplifyCFG's jump threading
We must not copy an alloc_ref [stack] in jump-threading (and similar optimizations).

fixes rdar://problem/28878079
2016-10-20 17:44:46 -07:00
Bob Wilson
88d896429b LoopInfo::verify needs the dominator tree (as of llvm r280280)
Since the dominator tree is passed to the LoopInfo constructor, just save
a pointer to it for use in the verify function. If this is not sufficiently
flexible, we could alternatively change to pass the dominator tree as an
argument to the verify function, but let's try the simpler approach first.
2016-10-15 11:02:19 -07:00
Arnold Schwaighofer
001998c642 Use LoopInfo.verify() instead of coding this ourselves 2016-04-13 16:03:10 -07:00
practicalswift
8efa5f587e [gardening] Remove "-*- C++ -*-" tag from .cpp files
Emacs assumes .h files are C files by default which is why the
tag "-*- C++ -*-" is needed.

.cpp files do not have this problem.
2016-01-23 12:09:32 +01:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
practicalswift
f91525a10f Consistent placement of "-*- [language] -*-===//" in header. 2016-01-04 09:46:20 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Arnold Schwaighofer
6bac8ab9e6 Add canDuplicate() to LoopInfo
To determine whether it is safe to duplicate the instruction by duplicating the
loop body. Will be used in loop versioning for array and loop unrolling.
2015-12-14 12:03:41 -08:00
Michael Gottesman
f9eab6243d Update LoopInfo for changes to LLVM.
The two changes were:

1. I added a graphtraits implementation for a const
DomTreeNodeBase<SILBasicBlock>.
2. LoopInfoBase::Analyze() => LoopInfoBase::analyze().

Swift SVN r31807
2015-09-09 04:37:25 +00:00
Dmitri Hrybenko
c5185d66ae Adjust to the new LLVM APIs
Swift SVN r29696
2015-06-25 22:01:35 +00:00
Michael Gottesman
24c138f29c Move SILLoopInfo into swiftSIL from swiftSILAnalysis so that we match the separation in between analysis and IR entities.
This follows the model of dominance info and allows me to create reachability
methods on SILBasicBlock without creating dependencies from swiftSIL to
swiftSILAnalysis.

Swift SVN r21866
2014-09-11 03:03:06 +00:00