Commit Graph

20 Commits

Author SHA1 Message Date
Arnold Schwaighofer
411ba4e830 COWArrayOpt: Fix the array property specializer to recompute the loop tree after cloning
Cloning the loop is going to invalidate the loop tree. Be conservative and
recompute it.

No test case. I did not run into an error but also don't want to in the future.

Swift SVN r25733
2015-03-04 01:06:27 +00:00
Arnold Schwaighofer
c8180d6ee7 Revert "COWArrayOpt: Enable array.props hoisting"
This reverts commit r25699.

There is build bot breakage I believe due to this.

Swift SVN r25702
2015-03-03 02:43:50 +00:00
Arnold Schwaighofer
646e5e1f68 COWArrayOpt: Enable array.props hoisting
O speedup (before/after):
  ClassArrayGetter`7.4
  Rectangles```````1.9
  InsertionSort````0.9
  Chars````````````0.92

I looked at the Chars and InsertionSort regressions and did not see something
actionable. It looked like noise.

rdar://17955309

Swift SVN r25699
2015-03-03 00:46:00 +00:00
Arnold Schwaighofer
c087f218f9 COWArrayOpt: Hoist array projections to the preheader
In nested loops the projection operations to get to the array are only
conditionally executed (they reside in the preheader of the inner loop).
So LICM will not hoist them. Instead, recognize them and hoist them on demand.

rdar://19957962

Swift SVN r25620
2015-02-27 22:07:40 +00:00
Arnold Schwaighofer
283a6bee39 Fix users of ArraySemantics::getSelf to correctly handle Array.init
Array.init does not have a self argument (it returns the newly created array
@owned). Passes using the ArraySemantic::getSelf() interface must handle it
specially.

rdar://19724033

Swift SVN r25013
2015-02-05 19:31:23 +00:00
Arnold Schwaighofer
71922a4daa COWArrayOpt: Handle cases where the array is not uniquely identified
We can still hoist in many cases if all operations in the loop are 'safe' wrt.
hoisting.

'Safe' array operations are

  * all array semantic functions (as long as one array type cannot contain
    another).
  * stores to array elements
  * any instruction that does not have side effects.
  * any retain must be matched by a release before we hit a make_unique.

rdar://19668784

Swift SVN r24960
2015-02-04 16:39:14 +00:00
Arnold Schwaighofer
0f4f6833c1 COWArrayOpt: Update for array addressor changes
A mark_dependence use of the buffer is safe.

Swift SVN r24445
2015-01-15 15:33:44 +00:00
Mark Lacey
4a74e94b40 Fix release build warnings about unused variables.
Swift SVN r23893
2014-12-12 20:05:30 +00:00
Arnold Schwaighofer
2f949056d6 SIL utils: Rename array.props.isCocoa to array.props.isNative
The upcoming stdlib patch will also be modified.

NFC

rdar://17955309

Swift SVN r23813
2014-12-09 21:58:16 +00:00
Arnold Schwaighofer
83cf4f3405 Add a pass to specialize array code based on array semantic array.props calls
We know that a native swift array that does not need an element type check is
not going to change to an nsarray, or to an array that needs an element type
check. This allows us to specialize array code.

The array semantic calls 'array.props.isCocoa/needsElementTypeCheck' returns
said array properties for a read.

  func f(a : A[AClass]) {
     for i in 0..a.count {
       let b = a.props.isCocoa()
        .. += _getElement(a, i, b)
     }
  }

   ==>

  func f(a : A[AClass]) {
    let b2 = a.props.isCocoa()
    if (!b2) {
      for i in 0..a.count {
         .. += _getElement(a, i, false)
      }
    } else {
      for i in 0..a.count {
        let b = a.props.isCocoa
        .. += _getElement(a, i, b)
      }
    }
  }

The stdlib will be changed to use array.props calls in a future commit.

rdar://17955309

Swift SVN r23689
2014-12-04 19:24:40 +00:00
Ben Langmuir
e9e1666ab0 Update for upstream LLVM changes
* removal of StringMap's GetOrCreateValue
* SmallSet::insert now returns a pair like std::set

Swift SVN r23435
2014-11-19 16:49:30 +00:00
Arnold Schwaighofer
bb47ce9e00 COWArrayOpts: strong_release on the array is also harmless
Needed for the upcoming array implementation change.

rdar://18777237

Swift SVN r23075
2014-11-03 02:18:35 +00:00
Arnold Schwaighofer
e6c44a377b COWArrayOpt: We could (and are now) also use a strong retain on the array storage
Swift SVN r22998
2014-10-29 01:56:14 +00:00
Andrew Trick
2ca16462b2 NFC: Update COW Array pass name string
Swift SVN r21964
2014-09-16 01:56:41 +00:00
Arnold Schwaighofer
12b0e13459 COWArrayOpt: Use ArraySemanticsCall utility
NFC

Swift SVN r21929
2014-09-12 21:05:23 +00:00
Arnold Schwaighofer
6da1647e1f COWArrayOpt: Use ValueBase's getParentBB api
Swift SVN r21927
2014-09-12 21:05:22 +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
Andrew Trick
bba2a37070 More COWArrayOpts cleanup.
Arnold noticed during review that ArrayUserSet was not properly
updated after previous rounds of cleanup.

This also removes some innefficiency by eliminating a few hash maps.

I want to make sure this is in good shape before reusing the analysis
for immutable array properties.

Swift SVN r21608
2014-08-30 09:20:07 +00:00
Andrew Trick
ed4d8e6b71 Cleanup COWArrayOpts.
Rewrite comments and refactor.

The refactored code now handles the latest SILCombine.

Swift SVN r21547
2014-08-28 22:42:15 +00:00
Andrew Trick
da5a4411bf Rename ArrayOpts to COWArrayOpts.
It looks like we'll have a separate pass for different types of array
opts. There isn't much overlap between COW and ABC opts.

Swift SVN r21258
2014-08-18 18:44:01 +00:00