Commit Graph

68 Commits

Author SHA1 Message Date
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
Kuba Mracek
f572000d94 [ARCOpts] Don't move releases before landingpads 2024-06-15 13:12:43 -07:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Evan Wilde
41d59b215a Update Triple.h location
Triple moved from ADT to TargetParser. Updating includes to reflect
that.
2023-07-17 10:53:42 -07:00
Arnold Schwaighofer
5c9eab0f6c Update Swift's LLVM passes to include new pass manager versions 2022-07-15 08:22:32 -07:00
Meghana Gupta
87cde88aca Fix for a crash due to performLocalReleaseMotion and performLocalRetainMotion (#38150)
In low level LLVMARCOptimizer, during canonicalization we don't rauw the result of RT_Retain with its arg similarly to RT_ObjCRetain and RT_BridgeRetain.
And during performLocalReleaseMotion, we assert that we have canonicalized RT_Retain.
In a release compiler, if we optimize such an RT_Retain with a RT_Release, then this can result in a compiler crash

Similarly not rauw'ing, can cause a crash due to performLocalRetainMotion

Fixes rdar://79238115
2021-06-30 15:40:15 -07:00
Minhyuk Kim
53d1fc481e Replace usages of .find(Key) != .end() to .contains(Key) in llvm sets 2021-02-06 18:24:20 +09:00
Michael Gottesman
9326ef4d73 [upstream-update] Update LLVMPasses for new objc arc intrinsics.
We used to represent these just as normal LLVM functions, e.x.:

  declare objc_object* @objc_retain(objc_object*)
  declare void @objc_release(objc_object*)

Recently, special objc intrinsics were added to LLVM. This pass updates these
small (old) passes to use the new intrinsics.

This turned out to not be too difficult since we never create these
instructions. We only analyze them, move them, and delete them.

rdar://47852297
2019-02-08 14:22:57 -08:00
Saleem Abdulrasool
2c91da5d88 lib: update for LLVM API change
TerminatorInst has been removed and been made into a regular Instruction.  Use
the `isTerminator` function instead of the dyn_cast.
2019-02-07 17:54:59 -08:00
Mike Ash
46309d9794 [Runtime] Rename swift_unknown* functions to swift_unknownObject*.
These functions don't accept local variable heap memory, although the names make it sound like they work on anything. When you try, they mistakenly identify such things as ObjC objects, call through to the equivalent objc_* function, and crash confusingly. This adds Object to the name of each one to make it more clear what they accept.

rdar://problem/37285743
2018-08-15 17:48:23 -04:00
Bob Wilson
4dd5d4eeee master-next: Adjust for LLVM r328165 moving a header file
The "llvm/Transforms/Utils/Local.h" header was moved to
"llvm/Analysis/Utils/Local.h".
2018-03-23 16:42:39 -07:00
Michael Gottesman
3f1a3c7cb8 [llvm-arc] Remove dead incorrect code.
The code I am ripping out was meant to look at the input argument, not the
return value so was incorrect. Luckily this code was actually dead since whether
or not we returned no capture or unknown, we bailed.

Since the code is already dead, just rip it out.
2017-05-08 12:06:31 -07:00
practicalswift
492f5cd35a [gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.

The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).

See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
2017-05-05 09:45:53 +02:00
Hugh Bellamy
f001b7562b Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH 2017-02-12 10:47:03 +07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Michael Gottesman
59c6a64f5a [gardening] 0 => nullptr. Fixed with clang-tidy. 2016-12-06 23:14:13 -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
b018645418 [semantic-arc] Add __swift_endBorrow support to LLVMPasses and make sure it is removed by LLVMARCContract.cpp. 2016-10-17 14:43:28 -07:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07:00
Xin Tong
026cee2f84 Fix a globalvariable initializer bug in LLVMSwiftARC 2016-08-22 14:23:21 -07:00
Doug Gregor
77a876877f Adjust to LLVM r265762. 2016-04-14 10:13:10 -07:00
Roman Levenstein
d8e28bb690 Handle the [nonatomic] attribute in IRGen and LLVM passes.
Properly lower reference counting SIL instructions with nonatomic attribute as invocations of corresponding non-atomic reference counting runtime functions.
2016-04-06 22:30:23 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
149b50d901 Fix typos in code (non-comment/documentation typos). 2015-12-28 11:42:15 +01:00
practicalswift
6e3b700b44 Fix typos. 2015-12-23 00:31:13 +01:00
practicalswift
cd7d8dfaff Fix alignment as requested by @gribozavr in #692 2015-12-21 08:54:24 +01:00
practicalswift
176f487d76 Fix incorrect filenames in headers. 2015-12-20 23:59:05 +01:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Xin Tong
0b79ecf51c Rename swift-arc-optimize to swift-llvm-arc-optimize as this is a LLVM pass 2015-11-18 11:53:23 -08:00
Michael Gottesman
9fb54bf4bf Fix for upstream ilist changes. 2015-11-11 16:07:41 -08:00
Michael Gottesman
9ebc0d214b Move the declaration of initializeSwiftARCContractPass and initializeSwiftARCOptPass from {LLVMARCContarct,LLVMARCOpts}.cpp => PassesFwd.h so swift-llvm-opts can use them.
Swift SVN r32807
2015-10-21 21:45:19 +00:00
Michael Gottesman
72f5063f3c Update SwiftAA for upstream AA changes.
Swift SVN r32800
2015-10-21 21:45:13 +00:00
Xin Tong
921a951b63 Fix a compiler crasher with replaceAllUsesWith in LLVMARCOpt.
Swift SVN r32148
2015-09-22 16:20:45 +00:00
Xin Tong
ecc7cc091c Use LLVM RC Identity for LLVMARCOpt Retain/Release code motion.rdar://22774326
Swift SVN r32146
2015-09-22 05:58:07 +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
33193ef2d8 Strength reduce unknownRetain to retain.
when an object is passed to unknownRetain and retain, the unknownRetain
can be strength reduced to retain.  same for unknownRelease and release.

Swift SVN r32087
2015-09-18 23:20:20 +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
0db8d77e4c Refactor LLVMARCContract => LLVMARCContract.cpp.
Swift SVN r30393
2015-07-20 06:34:55 +00:00
Michael Gottesman
3ddaf105b0 Refactor ARCEntryPointBuilder => ARCEntryPointBuilder.h
Swift SVN r30392
2015-07-20 06:34:54 +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
672d32ef02 [llvm-arc-opts] Merge together multiple retains/releases in the same BB into retain_n/release_n calls.
We are taking advantage of the fact that we can always safely move a retain
earlier in the program and a release later in the program. Given this
information, in every BB, we merge together all retains into the first retain
(creating a retain_n) and all releases into the last release in that BB
(creating a release_n).

rdar://21803771

Swift SVN r30261
2015-07-16 12:28:29 +00:00
Michael Gottesman
123dbc6912 [llvm-arc-opts] Extract out single BB analysis/opts into its own method. To shrink the size of SwiftARCContractImpl::run.
Swift SVN r30260
2015-07-16 12:28:28 +00:00
Michael Gottesman
cd0e84acb7 [llvm-arc-opts] Extract out the implementation of SwiftARCContract into SwiftARCContractImpl so we can store global information more conveniently without polluting the public header where the actual LLVM pass is declared.
Swift SVN r30259
2015-07-16 12:28:27 +00:00
Michael Gottesman
3c86d000e4 Small style fixes. NFC.
Swift SVN r30258
2015-07-16 12:28:26 +00:00
Michael Gottesman
89ce119646 Add support to ARCEntryPointBuilder for emitting RetainN and ReleaseN calls.
Swift SVN r30257
2015-07-16 12:28:25 +00:00
Michael Gottesman
2315c8fd06 [llvm-arc-opts] Rename SwiftARCExpand => SwiftARCContract.
This pass does things similar to LLVMARCContract so it makes sense to use the
same naming schema.

Also I am going to be implementing some contracting optimziations here later
today.

Swift SVN r30203
2015-07-15 00:03:01 +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
Michael Gottesman
24c9c75df0 [llvm-arc-opts] Refactor the ARC call constant caches and ARC call creation code into a builder class.
This removes a bunch of boilerplate from the LLVMARCOpts passes related
to Constant caches and creating these calls.

Swift SVN r30130
2015-07-12 22:13:10 +00:00