Commit Graph

9 Commits

Author SHA1 Message Date
Arnold Schwaighofer
84de9c6763 ABCOpts: Accept retains of the array as matching retains to subscript checks
After stripRCIdentityPreservingOps the indirection through the array buffer data
structure is gone. We would no longer recognize a matching retain.

Where we had this before:

  %3 = load %0 : $*ArrayInt
  %4 = struct_extract %3 : $ArrayInt, #ArrayInt.buffer
  %5 = struct_extract %4 : $ArrayIntBuffer, #ArrayIntBuffer.storage
  retain_value %5 : $Builtin.NativeObject
  subscript_check(%3, i)

We now would just have:

  %3 = load %0 : $*ArrayInt
  retain_value %3 : $
  subscript_check(%3, i)

Swift SVN r21512
2014-08-28 02:50:21 +00:00
Michael Gottesman
0f7053bd01 Remove SILBasicBlock::getBBArgIndex(SILArgument *) in favor of SILArgument::getIndex().
The index is a property of the argument. There is no reason from a modeling
perspective to go through the BB to get it.

Swift SVN r21338
2014-08-21 04:06:19 +00:00
Arnold Schwaighofer
338739d873 ABCOpts: Comment code that matches an integer passed to the bounds check.
NFC.

Swift SVN r21212
2014-08-14 18:18:39 +00:00
Arnold Schwaighofer
86d43be559 IndVars: Store the increment of an induction variable
Such that we don't need to repeat part of the analysis in ABCOpts.

No functionality change.

Swift SVN r21211
2014-08-14 18:18:38 +00:00
Arnold Schwaighofer
effa193a01 ABCOpts: Cleanup - use PointerIntPair instead of reinterpret cast
No functionality change.

Swift SVN r21210
2014-08-14 18:18:37 +00:00
Arnold Schwaighofer
e0173f4585 ABCOpts: Move member variables to the top of the class
No functionality change.

Swift SVN r21209
2014-08-14 18:18:37 +00:00
Arnold Schwaighofer
04ca5e128e ABCOpts: Add bounds check hoisting of induction identity accesses
We can now hoist the check in:

 for (i = start; i != end; ++i)
   a[i] = ...

or

 for i in start ..< end
   a[i] = ...

We will also hoist invariant checks as in

 k =
 for i in start ..< end
   a[k] = ...

We will also hoists the overflow check for "++i" out of the loop.

The only thing blocking vectorization of memset loops is the fact that we are
overflow checking the type size muliplication of array accesses. "a[i]" is
translated to "a + sizeof(T) * i" and this multiplication is still overflow
checked.

We can remove bounds checks in PrimeNum, XorLoop, Hash, MemSet, NBody, Walsh.

Memset                 ,  2371.00   ,  1180.00  ,  1179.00  ,        99.9%
XorLoop                ,  1403.00   ,  1255.00  ,  149.00   ,        11.9%

rdar://14757945

Swift SVN r21182
2014-08-13 20:00:08 +00:00
Arnold Schwaighofer
32af1c622c ABCOpts: Enable per default
Swift SVN r20213
2014-07-20 00:16:37 +00:00
Arnold Schwaighofer
f6b0682988 Array bounds check optimization pass
Implements redundant bounds check elimination for basic blocks and along the
dominator tree of loops.

No induction variable based hoisting yet.

O3:
NBody          ,  473.00     ,  122.00    ,  294.2%
QuickSort      ,  477.00     ,  310.00    ,  53.9%
RC4            ,  1022.00    ,  736.00    ,  38.6%
Walsh          ,  1781.00    ,  1142.00   ,  55.5%

No effect on Ofast.

Disabled for now.

Swift SVN r20199
2014-07-19 01:18:50 +00:00