Commit Graph

69 Commits

Author SHA1 Message Date
Xin Tong
a191ae72a7 Minor refactoring in epilogue release matcher. NFC 2016-03-20 23:13:50 -07:00
Michael Gottesman
bb15808554 Convert some trivial std::count_if invocations on ranges to use the provided range adaptor. 2016-03-08 14:58:13 -08:00
Xin Tong
56a09b67da Update some comments and delete abit dead code. NFC 2016-03-07 21:26:57 -05:00
Xin Tong
5176173cc8 Rename ConsumedReturnValueToEpilogueRetainMatcher.
Rename to ConsumedResultToEpilogueRetainMatcher

Also remove some dead code in ConsumedResultToEpilogueRetainMatcher.

NFC.
2016-03-01 20:21:00 -08:00
Xin Tong
6c0186b61c Reinstate "Improve funciton signature @owned return result to "not owned" conversion"
This enables function signature handles a case of self-recursion.

With this change we convert 11 @owned return value to "not owned", while
we convert 179 @owned parameter to @guanrateed.

rdar://24022375
2016-03-01 17:25:16 -08:00
Xin Tong
d72ad28b08 Revert "Improve funciton signature @owned return result to "not owned" conversion"
This reverts commit c6de7c0123.

Broke OSS linux and OSX builds.
2016-03-01 11:17:06 -08:00
Xin Tong
c6de7c0123 Improve funciton signature @owned return result to "not owned" conversion
More specifically, this handles a case of self-recursion.

With this change we convert 11 @owned return value to "not owned", while
we convert 179 @owned parameter to @guanrateed.

rdar://24022375
2016-03-01 10:58:32 -08:00
Xin Tong
fcb707b40c Improve epilogue retain matcher.
Instead of only checking the return block, we could potentially check
its predecessors and its predecessors's predecessors, etc.

Alos put in a threshold to throttle this to make sure its cheap.

We are still only being able to find of a small # of epilogue retains.
The bail on MayDecrement is blocking many of the opportunites.

This should bring us closer to being able to handle Walsh.

This is part of rdar://24022375.
2016-02-19 16:22:41 -08:00
Xin Tong
b69706734d Implement @owned to @unowned retain value conversion.
If a value is returned as @owned, we can move the epilogue retain
to the caller and convert the return value to @unowned. This gives
ARC optimizer more freedom to optimize the retain out on the caller's
side.

It appears that epilgue retains are harder to find than epilogue
releases. Most of the time they are not in the return block.

(1) Sometimes, they are in predecessors
(2) Sometimes they come from a call which returns an @owned return value.
This should be improved if we fix (1) and go bottom up.
(3) We do not handle exploded retain_value.

Currently, this catches a small number of opportunities.

We probably need to improve epilogue retain matcher if we are to handle
more cases.

This is part of rdar://24022375.

We also need some refactoring in the pass. e.g. break functions into smaller
functions. I will do with subsequent commit.
2016-02-17 21:59:55 -08:00
Xin Tong
a007d47dd4 Add a simple epilogue retain matcher.
This is similar and yet different from epilogue release matcher. Particularly
how retain is found and when to bail. Therefore this is put into a different
class than ConsumedArgToEpilogueReleaseMatcher

This is currently a NFC other than some basic testing using the epilogue dumper.
2016-02-16 22:27:40 -08:00
practicalswift
4cdb142b57 [gardening] Fix recently introduced typo: "sematics" → "semantics" 2016-02-16 09:53:36 +01:00
Xin Tong
99ca08e4af Check whether epilogue releases cover all non-trivial fields.
When we have all the epilogue releases. Make sure they cover all the non-trivial
parts of the base. Otherwise, treat as if we've found no releases for the base.

Currently. this is a NFC other than epilogue dumper. I will wire it up with
function signature with next commit.

This is part of rdar://22380547
2016-02-15 16:00:02 -08:00
Xin Tong
4f66bc88b4 Move ProjectionTree::isRedundantRelease to ConsumedArgToEpilogueReleaseMatcher::isRedundantRelease.
NFC.
2016-02-15 10:22:47 -08:00
Xin Tong
40ff0895d6 Improve epilogue release matcher to handle exploded release_value.
So instead of only being able to match %1 and release %1 in (1). we
can also match %1 with (release %2, and release%3, i.e. exploded release_value)
in (2).

(1)
foo(%1)
  strong_release %1

(2)
foo(%1)
  %2 = struct_extract %1, field_a
  %3 = struct_extract %1, field_b
  strong_release %2
  strong_release %3

This will allow function signature to better move the release instructions to
the callers.

Currently, this is a NFC other than testing using the epilogue match dumper.
2016-02-12 15:22:13 -08:00
Erik Eckstein
aef0a11a7c remove some unneeded forward declearations 2016-01-25 15:00:49 -08: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
Andrew Trick
84450b4c43 Reorganize SILOptimizer directories for better discoverability.
(Headers first)

It has been generally agreed that we need to do this reorg, and now
seems like the perfect time. Some major pass reorganization is in the
works.

This does not have to be the final word on the matter. The consensus
among those working on the code is that it's much better than what we
had and a better starting point for future bike shedding.

Note that the previous organization was designed to allow separate
analysis and optimization libraries. It turns out this is an
artificial distinction and not an important goal.
2015-12-11 12:34:51 -08:00