Commit Graph

28 Commits

Author SHA1 Message Date
Arnold Schwaighofer
5c9eab0f6c Update Swift's LLVM passes to include new pass manager versions 2022-07-15 08:22:32 -07:00
Michael Gottesman
36b9cac6a1 [upstream-update] Add to SwiftAAResult a getModRefInfo entrypoint that takes an llvm::AAQueryInfo.
I left in the old entrypoint as well that doesn't take the AAQueryInfo by having
it delegate to the AAQueryInfo entrypoint passing a default constructed
AAQueryInfo. This matches how people upstream have handled this.

rdar://49450147
2019-04-09 10:50:38 -07:00
Saleem Abdulrasool
1c09e2479d LLVMPasses: addjust for SVN r356783
SVN r356783 added a new parameter to `modRefInfo` for caching the results.
Update the API usage.
2019-03-26 09:47:50 -07:00
Bob Wilson
8c2f7a352d master-next: Adjust for LLVM r350503
LLVM's Alias Analysis APIs were changed to use a new CallBase class
instead of the CallSite wrapper
2019-01-10 15:39:22 -08:00
Bob Wilson
47dde9695d [master-next] Update to use ModRefInfo enum from llvm r320107 2017-12-08 16:51:49 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Hugh Bellamy
1aa951dfb2 Fix errors and warnings building swift/IRGen on Windows using MSVC (#5958) 2016-11-30 13:27:02 -08: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
Michael Gottesman
1ed04f8d94 [semantic-arc] Use BaseModRef effects from LLVMSwift.def in LLVMSwiftAA instead of a switch. 2016-10-17 14:43:28 -07:00
Saleem Abdulrasool
f363c5496e [upstream-update] update AA interface usage
SVN r262490 reformulated the Alias Analysis interfaces.  The TLI is no longer
needed to construct the AA Result.  Because the TLI was used specifically for
the base constructor, we now no longer need that option.  Simplify it according
to the new API.  NFC.

(cherry picked from commit 12dc8a831c)
(cherry picked from commit 270a4c240781e012a1c0d63c581102707130e02b)
2016-05-13 22:03:24 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Michael Gottesman
72f5063f3c Update SwiftAA for upstream AA changes.
Swift SVN r32800
2015-10-21 21:45:13 +00:00
Xin Tong
768a6011de Add retain_n entry points to SwiftAA. rdar://22765670
Swift SVN r32094
2015-09-19 16:37:27 +00:00
Xin Tong
dca508bfbb This is part of a series of commits to remove reference forwarding for
some of the ARC entry points. rdar://22724641. After this commit,
swift_retain_noresult will be completely replaced by swift_retain.
LLVMARCOpts pass is modified NOT to rewrite swift_retain to
swift_retain_noresult which forward no reference.

Swift SVN r32082
2015-09-18 21:56:50 +00:00
Michael Gottesman
121ef3ef9f Revert the series of commits for removing the return value from swift_retain_noresult.
I asked that the patches were split up so I could do post commit review.

This reverts commit r32059.
This reverts commit r32058.
This reverts commit r32056.
This reverts commit r32055.

Swift SVN r32060
2015-09-18 02:31:24 +00:00
Xin Tong
4e46dacc3d Completely replace swift_retain_noresult with swift_retain. this is part of a series of commits
to remove reference forwarding for some of the ARC entry points. rdar://22724641. After this
commit, swift_retain_noresult will be completely replaced by swift_retain and LLVMARCOpts.cpp
will no longer canonicalize swift_retain to swift_retain_noresult as now swift_retain returns no
reference.

Swift SVN r32058
2015-09-18 01:51:17 +00:00
Michael Gottesman
72f7476ce9 Adjust to upstream changes in the ModRefResult enum
Swift SVN r31799
2015-09-09 04:37:15 +00:00
Erik Eckstein
57c5de4491 [llvm-arc-opts] Optimize strong_retain_unowned/strong_release pairs.
Replaces a swift_retainUnowned/swift_release pair with a swift_checkUnowned, if possible.
For details see rdar://problem/21297936




Swift SVN r30262
2015-07-16 13:46:18 +00:00
Michael Gottesman
04890c964e [llvm-arc-opts] Remove retainAndReturnThree.
We were never generating it and are going to transition all of the stdlib data
structures to single pointer representations.

rdar://21665665

Swift SVN r30174
2015-07-13 23:10:12 +00:00
Dmitri Hrybenko
8f61538f64 Adjust to llvm::Location -> llvm::MemoryLocation rename
Swift SVN r29698
2015-06-25 22:01:36 +00:00
Andrew Trick
af711933b7 Update DataLayout API for upstream LLVM changes.
Swift SVN r25771
2015-03-04 23:21:47 +00:00
Michael Gottesman
56f7797609 Remove trailing whitespace. NFC.
Swift SVN r22884
2014-10-23 02:37:19 +00:00
Joe Groff
5a2f48e3be Add a Builtin.BridgeObject type.
This is a type that has ownership of a reference while allowing access to the
spare bits inside the pointer, but which can also safely hold an ObjC tagged pointer
reference (with no spare bits of course). It additionally blesses one
Foundation-coordinated bit with the meaning of "has swift refcounting" in order
to get a faster short-circuit to native refcounting. It supports the following
builtin operations:

- Builtin.castToBridgeObject<T>(ref: T, bits: Builtin.Word) ->
  Builtin.BridgeObject

  Creates a BridgeObject that contains the bitwise-OR of the bit patterns of
  "ref" and "bits". It is the user's responsibility to ensure "bits" doesn't
  interfere with the reference identity of the resulting value. In other words,
  it is undefined behavior unless:

    castReferenceFromBridgeObject(castToBridgeObject(ref, bits)) === ref

  This means "bits" must be zero if "ref" is a tagged pointer. If "ref" is a real
  object pointer, "bits" must not have any non-spare bits set (unless they're
  already set in the pointer value). The native discriminator bit may only be set
  if the object is Swift-refcounted.

- Builtin.castReferenceFromBridgeObject<T>(bo: Builtin.BridgeObject) -> T

  Extracts the reference from a BridgeObject.

- Builtin.castBitPatternFromBridgeObject(bo: Builtin.BridgeObject) -> Builtin.Word

  Presents the bit pattern of a BridgeObject as a Word.

BridgeObject's bits are set up as follows on the various platforms:

i386, armv7:

  No ObjC tagged pointers
  Swift native refcounting flag bit: 0x0000_0001
  Other available spare bits:        0x0000_0002

x86_64:

  Reserved for ObjC tagged pointers: 0x8000_0000_0000_0001
  Swift native refcounting flag bit: 0x0000_0000_0000_0002
  Other available spare bits:        0x7F00_0000_0000_0004

arm64:

  Reserved for ObjC tagged pointers: 0x8000_0000_0000_0000
  Swift native refcounting flag bit: 0x4000_0000_0000_0000
  Other available spare bits:        0x3F00_0000_0000_0007

TODO: BridgeObject doesn't present any extra inhabitants. It ought to at least provide null as an extra inhabitant for Optional.

Swift SVN r22880
2014-10-23 00:09:23 +00:00
Michael Gottesman
a623886d6c Teach the LLVM level ARC optimizer about swift_fixLifetime.
This includes:

1. Teaching SwiftAA that swift_fixLifetime does not affect loads, stores of pointers.
2. Teaching SwiftARCExpand to remove swift_fixLifetime.
3. Teaching SwiftARCOpts that it can move retains but not releases over
swift_fixLifetime.

At -O I get the following % speedups > 10%.

InsertionSort:|%29.73
ImageProc:|||||%23.97
RC4:|||||||||||%19.46
PrimeNum|||||||%18.10
Ary||||||||||||%14.09
Ary2|||||||||||%13.16

<rdar://problem/18685662>

Swift SVN r22814
2014-10-17 08:29:29 +00:00
Michael Gottesman
7b599597ca Move createSwiftAliasAnalysisPass from LLVMARCOpts.cpp => LLVMSwiftAA.cpp
Swift SVN r22813
2014-10-17 08:29:28 +00:00
Arnold Schwaighofer
d55ba9959d LLVMARC: Don't bail on obj_retain/release or unknown_retain/release
We can remove objc_retain/releases just like swift ones.

Results -O where SU = minbefore/minafter (10 samples):

TEST`````````````````MIN``MAX``MEAN`SD```MED``MIN``MAX``MEAN`SD```MED````SU
ClassArrayGetter`````1931`1943`1938`4````1940`1143`1158`1150`5````1153```1.68
DeltaBlue````````````3434`3450`3439`4````3441`2906`2932`2913`7````2911```1.18
Dictionary```````````5616`5933`5755`112``5748`5291`5713`5515`140``5563```1.06
PopFrontArray````````103``109``104``1````104``96```99```96```1````96`````1.07
PopFrontArrayGeneric`102``106``103``1````103``95```98```96```1````96`````1.07
PrimeNum`````````````4098`7552`5953`1164`6319`4496`8653`6336`1210`6639```0.91
QuickSort````````````6380`6415`6396`11```6398`6071`6115`6086`13```6082```1.05
Rectangles```````````2277`2377`2322`31```2320`1636`1682`1657`12```1655```1.39
StrCat```````````````2811`2849`2825`12```2822`2487`2516`2501`12```2505```1.13
StringWalk```````````5784`5797`5790`4````5790`6124`6137`6129`4````6127```0.94

Swift SVN r22695
2014-10-12 22:57:21 +00:00
Arnold Schwaighofer
1ee1b40dae LLVMARCOpts: We can move retains across an objc_retain.
Teach LLVMARCOpts about swift_unknownRetain and that we can move retains accross
objc_retains.

This recovers the performance we lost (see rdar below) due to making retain
sinking more aggressive.

ClassArrayGetter```````,``581.00````,``488.00````,``92.00```,````````18.9%
Rectangles`````````````,``618.00````,``552.00````,``71.00```,````````13.0%

rdar://18337069

Swift SVN r21999
2014-09-16 23:51:27 +00:00
Michael Gottesman
1f9e654def Split lib/LLVMPasses/Passes.cpp into LLVMARCOpts.cpp and LLVMSwiftAA.cpp.
Swift SVN r21655
2014-09-02 21:14:21 +00:00