Commit Graph

10 Commits

Author SHA1 Message Date
Joe Groff
8adaab0233 Fold ExtInfo::isThin and ::isBlock into a "Representation" enum.
These bits are orthogonal to each other, so combine them into one, and diagnose attempts to produce a type that's both. Spot-fix a bunch of places this revealed by inspection that we would have crashed in SILGen or IRGen if blocks were be handled.

Swift SVN r16088
2014-04-09 00:37:26 +00:00
Nadav Rotem
a72cd1af2a ARCOpt: fix an object ownership bug.
When checking for users of an object we need to consider all values
because any use of the object may increase its lifetime. 

For example, in the sil code below, instruction %26 increases the lifetime of
object %9. If we remove the retain-release pair then the apply inst may
release %9 and the load would become invalid. 

  strong_retain %9#0 : $Builtin.ObjectPointer
  %24 = apply %19<>()
  %26 = load %9#1 : $*Int
  strong_release %9#0 : $Builtin.ObjectPointer
  return %26 : $Int

This fixes rdar://16233340



Swift SVN r14745
2014-03-06 19:46:18 +00:00
Nadav Rotem
e620ed323c Additional negative logic changes. NFC.
Swift SVN r14743
2014-03-06 19:10:32 +00:00
Nadav Rotem
15ec637128 Reverse the negative logic. NFC.
Swift SVN r14742
2014-03-06 19:02:42 +00:00
Doug Gregor
5d8bd84dfa Introduce the SIL instruction alloc_ref_dynamic.
alloc_ref_dynamic allocates an instance of a class type based on the
value in its metatype operand. Start emitting these instructions for
the allocating constructor of a complete object initializer (not yet
tested) and for the allocating constructor synthesized for an imported
Objective-C init method.

Still missing:
  - IRGen still does the same thing as alloc_ref right now. That
  change will follow.
  - There are devirtualization opportunities when we know the value of
  the metatype that would turn an alloc_ref_dynamic into an alloc_ref;
  I'm not planning to do this optimization.



Swift SVN r14560
2014-03-01 21:55:50 +00:00
Joe Groff
88b6efcc43 Rename ArchetypeMethodInst -> WitnessMethodInst more thoroughly.
Swift SVN r14501
2014-02-28 06:41:18 +00:00
Michael Gottesman
0044c1d379 [arc-opts] Teach cannotDecrementRefCount how to use alias information to prove
that an apply which may decrement ref counts can not decrement a value with
reference semantics if we can prove the value does not alias any of the applies
arguments.

Swift SVN r14120
2014-02-20 01:08:49 +00:00
Michael Gottesman
fbe2ccf0d6 [sil-aa] Add in convenience methods for querying AliasAnalysis::getMemoryBehavior.
The methods are:

 * mayWriteToMemory()
 * mayReadFromMemory()
 * mayReadOrWriteMemory()
 * mayHaveSideEffects() [Side effects + writing to memory]
 * mayHavePureSideEffects() [Only side effects, ignores writes to memory]

Swift SVN r13791
2014-02-12 00:14:29 +00:00
Michael Gottesman
8cb9693830 [sil-arc-opts] Teach SILARCOpts how to use alias analysis to determine if a store/load could use a value.
Swift SVN r13658
2014-02-07 22:56:59 +00:00
Michael Gottesman
7461dbd70a Now that we have a PM, separate passes from analyses by creating a separate library swiftSILAnalysis and a separate folder/etc.
Swift SVN r13511
2014-02-05 22:17:50 +00:00