Commit Graph

15 Commits

Author SHA1 Message Date
Michael Gottesman
150efb6ef4 [immutable-ptr-set] Change data structure to use T instead of T *, but require T to conform to PointerLikeTypeTraits.
This allows one to place types like PointerIntPair and value types that wrap a
pointer into the pointer set.

I am making this change before I use this data structure in TransferNonSendable
and using ARC to validate that I haven't broken anything.
2023-12-01 13:53:57 -08:00
Meghana Gupta
586de0af75 Fix KnownSafety optimization bugs in ARCSequenceOpts
While doing bottom up dataflow, if we encounter an
unmatched retain instruction, that can pair with a 'KnownSafe'
already visited release instruction, we turn off KnownSafety if the two
RCIdentities mayAlias.
This is done in BottomUpRefCountState::checkAndResetKnownSafety.
In order to determine if a retain is umatched, we look at
IncToDecStateMap. If a retain was matched during bottom up dataflow, it
is always found in IncToDecStateMap with value of the matched release's
BottomUpRefCountState.

Similarly, during top down dataflow, if we encounter an unmatched
release instruction, that can pair with a 'KnownSafe' already
visited retain instruction, we turn off KnownSafety if the two RCIdentities
mayAlias.
This is done in TopDownRefCountState::checkAndResetKnownSafety.
In order to determine if a release is umatched, we look at
DecToIncStateMap. If a release was matched during top down dataflow, it
is always found in DecToIncStateMap with value of the matched retain's
TopDownRefCountState.

For ARCLoopOpts, during bottom up and top down traversal of a region with
a nested loop, we find if the retain/release in the loop summary was
matched or not by looking at the persistent RefCountInstToMatched map.
This map is populated when processing the nested loop region from the
IncToDecStateMap/DecToStateMap which gets thrown away after the loop
region is processed.

This fixes the bugs in both ARCSequenceOpts without loop
support and with loop support.
2020-09-03 00:51:19 -07:00
Meghana Gupta
132d49f5bc ARCSequenceOpts: Minor code consolidation 2020-09-03 00:51:19 -07:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Michael Gottesman
2007badf6b [blot-map-vector] Merge blot/erase => erase.
They do the same thing.
2018-04-02 11:29:49 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01: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
Xin Tong
6213ac2307 Wire the new epilogue release matcher with ASO
I see some small performance improvements on a few benchmarks, but they
are likely to be due to noise.

The compilation pipeline is very epilogue release friendly at the moment,i.e.
we do not move the epilogue release of a function till very late in the pipeline.

Therefore, this global data flow sort of an overkill. I am going to change
the pass pipeline next so that we can move epilogue releases freely and the data
flow will become useful.

I do not see compilation time increase.

rdar://26446587
2016-09-13 10:13:54 -07:00
Michael Gottesman
f718111a4f [arc] Integrate ImmutablePointerSet{,Factory} into ARC Sequence Opts.
This speeds and reduces memory consumption of test cases with large
CFGs. The specific test case that spawned this fix was a large function
with many dictionary assignments:

public func func_0(dictIn : [String : MyClass]) -> [String : MyClass] {
  var dictOut : [String : MyClass] = [:]
  dictOut["key5000"] = dictIn["key500"]
  dictOut["key5010"] = dictIn["key501"]
  dictOut["key5020"] = dictIn["key502"]
  dictOut["key5030"] = dictIn["key503"]
  dictOut["key5040"] = dictIn["key504"]
  ...
}

This continued for 10k - 20k values.

This commit reduces the compile time by 2.5x and reduces the amount of
memory allocated by ARC by 2.6x (the memory allocation number includes
memory that is subsequently freed).

rdar://24350646
2016-02-14 15:26:59 -08:00
Michael Gottesman
79de928006 [arc] Only visit instructions that are actually interesting from the perspective of ARC when performing the dataflow.
This will improve ARC compile time performance.

rdar://24350646
2016-02-14 14:56:13 -08:00
practicalswift
a3f857ca7b [gardening] Add "-*- C++ -*-" to header files currently missing it 2016-01-23 11:53:05 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
81e7439a9a Fix typos. 2015-12-23 11:16:34 +01:00
Michael Gottesman
4f69bfc77f [arc] Always visit terminators bottom up so we can handle try_apply correctly.
Previously, we relied on a quirk in the ARC optimizer so that we only
need to visit terminators top down. This simplified the dataflow. Sadly,
try_apply changes this since it is a terminator that provides a call
with the value, causing this assumption to break program correctness.

Now during the bottom up traversal, while performing the dataflow for a
block B, we (after visiting all instructions), visit B's predecessors to
see if any of them have a terminator that is a use or decrement. We then
take the most conservative result among all of the terminators and
advance the sequence accordingly.

I do not think that we can have multiple such predecessors today since all
interesting terminators can not have any critical edges to successors. Thus if
our block is a successor of any such block, it can not have any other
predecessors. This is mainly for future proofing if we decide that this is able
to be done in the future.

rdar://23853221
SR-102
2015-12-21 16:41:24 -06:00
Andrew Trick
739b0e9c56 Reorganize SILOptimizer directories for better discoverability.
(libraries now)

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 15:14:23 -08:00