Commit Graph

13 Commits

Author SHA1 Message Date
John McCall
ab3f77baf2 Make SILInstruction no longer a subclass of ValueBase and
introduce a common superclass, SILNode.

This is in preparation for allowing instructions to have multiple
results.  It is also a somewhat more elegant representation for
instructions that have zero results.  Instructions that are known
to have exactly one result inherit from a class, SingleValueInstruction,
that subclasses both ValueBase and SILInstruction.  Some care must be
taken when working with SILNode pointers and testing for equality;
please see the comment on SILNode for more information.

A number of SIL passes needed to be updated in order to handle this
new distinction between SIL values and SIL instructions.

Note that the SIL parser is now stricter about not trying to assign
a result value from an instruction (like 'return' or 'strong_retain')
that does not produce any.
2017-09-25 02:06:26 -04:00
Andrew Trick
d45f171c98 Cleanup AccessMarkerElimination.
In raw SIL, access markers are unconditionally retained. In canonical SIL,
markers are still removed prior to optimization.

A new flag, -sil-optimized-access-markers, allows testing access markers in
optimized builds, but it is not yet fully supported.
2017-07-05 15:18:48 -07:00
Andrew Trick
ab0d0184e8 Add tracing to AccessMarkerElimination. 2017-05-01 22:36:56 -07:00
Andrew Trick
195da33d1d [Exclusivity] Add deserialization callbacks from the optimizer.
AccessMarkerElimination now registers a callback so that any subsequently
deserialized function bodies will have access markers stripped for optimization.

rdar:31908496 Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of
              incompatible type!") in SILPerformanceInliner
2017-05-01 21:50:44 -07:00
Saleem Abdulrasool
51ef30732e SIL: IWYU (NFC)
Include CommandLine.h from LLVM Support.
2017-04-30 14:33:35 -07:00
Andrew Trick
2336a87866 [Exclusivity] Enable access markers for the entire -Onone pipeline.
Dynamic markers are still conditional on the command line option.
2017-04-28 21:33:09 -07:00
Andrew Trick
e8b0947897 [Exclusivity] Allow testing the -Onone pipeline with access markers.
Markers are always eliminated before -O passes.

At -Onone, markers can be enabled via command line for all -Onone passes.
2017-04-26 17:32:48 -07:00
Andrew Trick
0f70130852 [Exclusivity] Eliminate unpaired access instructions before optimization. 2017-04-26 09:02:47 -07:00
Andrew Trick
48ecd6d563 [Exclusivity] Enable SILGen access marker emission by default.
This has no measurable effect on benchmarks and does not affect
standard library compile time.
2017-04-24 08:32:15 -07:00
John McCall
82c2d11632 Allow dynamic access markers in non-raw SIL. 2017-04-17 17:16:13 -04:00
Andrew Trick
b308daf311 [SILOpt] fix the ASAN issue in the new pass completely.
LLVM's ilist::erase is actually correct. It just implements a nonstandard remove
method that modifies it's iterator argument.

I forgot to add "continue" statements when fixing the iterator-invalidation problem.
2017-04-11 15:48:24 -07:00
Andrew Trick
2eb6d48b1c [AccessMarker] Fix a reverse instruction iterator.
I reversed this loop's direction over the instruction list and forgot to change
the order of erasing an instruction with respect to advancing the iterator.

Thankfully ASAN is far smarter than I.

Converting between forward/reverse iterators makes the loop unreadable.
Add an iterator return value to BasicBlock::erase(SILInstruction*).
2017-04-10 14:08:59 -07:00
Andrew Trick
4355cad83e Add a pass to eliminate access markers. 2017-04-10 09:47:50 -07:00