summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/ObjCARC
Commit message (Collapse)AuthorAgeFilesLines
...
* [Modules] Move CFG.h to the IR library as it defines graph traits overChandler Carruth2014-03-042-2/+2
| | | | | | IR types. llvm-svn: 202827
* [Modules] Move CallSite into the IR library where it belogs. It isChandler Carruth2014-03-041-1/+1
| | | | | | | abstracting between a CallInst and an InvokeInst, both of which are IR concepts. llvm-svn: 202816
* [Modules] Move InstIterator out of the Support library, where it had noChandler Carruth2014-03-042-2/+2
| | | | | | | | | | | | | business. This header includes Function and BasicBlock and directly uses the interfaces of both classes. It has to do with the IR, it even has that in the name. =] Put it in the library it belongs to. This is one step toward making LLVM's Support library survive a C++ modules bootstrap. llvm-svn: 202814
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-022-7/+7
| | | | | | Remove the old functions. llvm-svn: 202636
* Update optimization passes to handle inalloca argumentsReid Kleckner2014-01-281-0/+1
| | | | | | | | | | | | | | | Summary: I searched Transforms/ and Analysis/ for 'ByVal' and updated those call sites to check for inalloca if appropriate. I added tests for any change that would allow an optimization to fire on inalloca. Reviewers: nlewycky Differential Revision: http://llvm-reviews.chandlerc.com/D2449 llvm-svn: 200281
* Fix known typosAlp Toker2014-01-241-7/+7
| | | | | | | Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. llvm-svn: 200018
* [PM] Split DominatorTree into a concrete analysis result object whichChandler Carruth2014-01-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | can be used by both the new pass manager and the old. This removes it from any of the virtual mess of the pass interfaces and lets it derive cleanly from the DominatorTreeBase<> template. In turn, tons of boilerplate interface can be nuked and it turns into a very straightforward extension of the base DominatorTree interface. The old analysis pass is now a simple wrapper. The names and style of this split should match the split between CallGraph and CallGraphWrapperPass. All of the users of DominatorTree have been updated to match using many of the same tricks as with CallGraph. The goal is that the common type remains the resulting DominatorTree rather than the pass. This will make subsequent work toward the new pass manager significantly easier. Also in numerous places things became cleaner because I switched from re-running the pass (!!! mid way through some other passes run!!!) to directly recomputing the domtree. llvm-svn: 199104
* [cleanup] Move the Dominators.h and Verifier.h headers into the IRChandler Carruth2014-01-131-1/+1
| | | | | | | | | | | | | | | | | | directory. These passes are already defined in the IR library, and it doesn't make any sense to have the headers in Analysis. Long term, I think there is going to be a much better way to divide these matters. The dominators code should be fully separated into the abstract graph algorithm and have that put in Support where it becomes obvious that evn Clang's CFGBlock's can use it. Then the verifier can manually construct dominance information from the Support-driven interface while the Analysis library can provide a pass which both caches, reconstructs, and supports a nice update API. But those are very long term, and so I don't want to leave the really confusing structure until that day arrives. llvm-svn: 199082
* Correct word hyphenationsAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities and contractions in nearby lines. llvm-svn: 196471
* Use accessor methods instead.Bill Wendling2013-12-011-2/+1
| | | | llvm-svn: 196006
* Use 'unsigned char' to get this past gcc error message:Bill Wendling2013-12-011-3/+4
| | | | | | error: invalid conversion from 'unsigned char' to '{anonymous}::Sequence' llvm-svn: 196004
* [objc-arc] Convert the one directional retain/release relation assert to a ↵Michael Gottesman2013-11-051-3/+18
| | | | | | | | | | | | | | | | | conditional check + fail. Due to the previously added overflow checks, we can have a retain/release relation that is one directional. This occurs specifically when we run into an additive overflow causing us to drop state in only one direction. If that occurs, we should bail and not optimize that retain/release instead of asserting. Apologies for the size of the testcase. It is necessary to cause the additive cfg overflow to trigger. rdar://15377890 llvm-svn: 194083
* Revert "Give internal classes hidden visibility."Benjamin Kramer2013-09-113-4/+4
| | | | | | | It works with clang, but GCC has different rules so we can't make all of those hidden. This reverts commit r190534. llvm-svn: 190536
* Give internal classes hidden visibility.Benjamin Kramer2013-09-113-4/+4
| | | | | | Worth 100k on a linux/x86_64 Release+Asserts clang. llvm-svn: 190534
* [objc-arc] Remove dead code from previous commit.Michael Gottesman2013-09-031-140/+0
| | | | llvm-svn: 189870
* [objc-arc] Turn off the objc_retainBlock -> objc_retain optimization.Michael Gottesman2013-09-031-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason that I am turning off this optimization is that there is an additional case where a block can escape that has come up. Specifically, this occurs when a block is used in a scope outside of its current scope. This can cause a captured retainable object pointer whose life is preserved by the objc_retainBlock to be deallocated before the block is invoked. An example of the code needed to trigger the bug is: ---- \#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { void (^somethingToDoLater)(); { NSObject *obj = [NSObject new]; somethingToDoLater = ^{ [obj self]; // Crashes here }; } NSLog(@"test."); somethingToDoLater(); return 0; } ---- In the next commit, I remove all the dead code that results from this. Once I put in the fixing commit I will bring back the tests that I deleted in this commit. rdar://14802782. rdar://14868830. llvm-svn: 189869
* [objc-arc] Track if we encountered an additive overflow while computing ↵Michael Gottesman2013-08-091-8/+53
| | | | | | | | | | | {TopDown,BottomUp}PathCounts and do nothing if it occurred. I fixed the aforementioned problems that came up on some of the linux boxes. Major thanks to Nick Lewycky for his help debugging! rdar://14590914 llvm-svn: 188122
* Revert "[objc-arc] Track if we encountered an additive overflow while ↵Michael Gottesman2013-08-081-32/+3
| | | | | | | | | | | | computing {TopDown,BottomUp}PathCounts and do nothing if it occured." This reverts commit r187941. The commit was passing on my os x box, but it is failing on some non-osx platforms. I do not have time to look into it now, so I am reverting and will recommit after I figure this out. llvm-svn: 187946
* [objc-arc] Track if we encountered an additive overflow while computing ↵Michael Gottesman2013-08-071-3/+32
| | | | | | | | {TopDown,BottomUp}PathCounts and do nothing if it occured. rdar://14590914 llvm-svn: 187941
* [objc-arc] Change 4 iterator methods which return const_iterators to be ↵Michael Gottesman2013-08-071-4/+4
| | | | | | const methods. llvm-svn: 187940
* Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector ↵Craig Topper2013-07-141-6/+6
| | | | | | size. llvm-svn: 186274
* [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also ↵Michael Gottesman2013-07-107-7/+7
| | | | | | removed unnecessary mode: c++ lines from .cpp files. llvm-svn: 186026
* [objc-arc] Fix assertion in EraseInstruction so that noop on null calls when ↵Michael Gottesman2013-07-081-1/+3
| | | | | | | | passed null do not trigger the assert. The specific case of interest is when objc_retainBlock is passed null. llvm-svn: 185885
* [objc-arc] Remove the alias analysis part of r185764.Michael Gottesman2013-07-071-8/+0
| | | | | | | Upon further reflection, the alias analysis part of r185764 is not a safe change. llvm-svn: 185770
* [objc-arc] Teach the ARC optimizer that objc_sync_enter/objc_sync_exit do ↵Michael Gottesman2013-07-072-0/+10
| | | | | | not modify the ref count of an objc object and additionally are inert for modref purposes. llvm-svn: 185769
* [objc-arc] When we initialize ARCRuntimeEntryPoints, make sure we reset all ↵Michael Gottesman2013-07-061-0/+9
| | | | | | references to entrypoint declarations as well. llvm-svn: 185764
* [objc-arc] Performed some small cleanups in ARCRuntimeEntryPoints and added ↵Michael Gottesman2013-07-061-3/+5
| | | | | | an llvm_unreachable after the switch to quiet -Wreturn_type errors. llvm-svn: 185746
* [objc-arc] Renamed Module => TheModule in ARCRuntimeEntryPoints. Also did ↵Michael Gottesman2013-07-061-17/+14
| | | | | | | | some small cleanups. This fixes an issue that came up due to -fpermissive on the bots. llvm-svn: 185744
* Removed trailing whitespace.Michael Gottesman2013-07-061-2/+2
| | | | llvm-svn: 185743
* [objc-arc] Updated ObjCARCContract to use ARCRuntimeEntryPoints.Michael Gottesman2013-07-061-99/+11
| | | | llvm-svn: 185742
* [objc-arc] Updated ObjCARCOpts to use ARCRuntimeEntryPoints.Michael Gottesman2013-07-061-123/+22
| | | | llvm-svn: 185741
* [objc-arc] Refactor runtime entrypoint declaration entrypoint creation.Michael Gottesman2013-07-061-0/+178
| | | | | | | | | | | | | | | | This is the first patch in a series of 3 patches which clean up how we create runtime function declarations in the ARC optimizer when they do not exist already in the IR. Currently we have a bunch of duplicated code in ObjCARCOpts, ObjCARCContract that does this. This patch refactors that code into a separate class called ARCRuntimeEntryPoints which lazily creates the declarations for said entrypoints. The next two patches will consist of the work of refactoring ObjCARCContract/ObjCARCOpts to use this new code. llvm-svn: 185740
* [objc-arc-opts] Make IsTrackingImpreciseReleases a const method.Michael Gottesman2013-06-211-1/+1
| | | | | | Thanks to Bill Wendling for pointing this out! llvm-svn: 184593
* [objc-arc-opts] Now that PtrState.RRI is encapsulated in PtrState, make ↵Michael Gottesman2013-06-211-5/+7
| | | | | | PtrState.RRI private and delete the TODO. llvm-svn: 184587
* [objc-arc-opts] Encapsulated PtrState.RRI.{Calls,ReverseInsertPts} into ↵Michael Gottesman2013-06-211-12/+28
| | | | | | several methods on PtrState. llvm-svn: 184586
* [objcarcopts] Encapsulated PtrState.RRI.IsTrackingImpreciseRelease() => ↵Michael Gottesman2013-06-211-4/+5
| | | | | | PtrState.IsTrackingImpreciseRelease(). llvm-svn: 184583
* [objcarcopts] Encapsulate PtrState.RRI.CFGHazardAfflicted via methods ↵Michael Gottesman2013-06-211-2/+10
| | | | | | PtrState.{IsCFGHazardAfflicted,SetCFGHazardAfflicted}. llvm-svn: 184582
* [objcarcopts] Encapsulate PtrState.RRI.ReleaseMetadata into the methods ↵Michael Gottesman2013-06-211-2/+10
| | | | | | PtrState.GetReleaseMetadata() and PtrState.SetReleaseMetadata(). llvm-svn: 184534
* [objcarcopts] Encapsulate PtrState.RRI.IsTailCallRelease into the method ↵Michael Gottesman2013-06-211-2/+10
| | | | | | PtrState.IsTailCallRelease() and PtrState.SetTailCallRelease(). llvm-svn: 184533
* [obcjarcopts] Encapsulate PtrState.RRI.KnownSafe in the methods ↵Michael Gottesman2013-06-211-6/+15
| | | | | | | | | | | | PtrState.IsKnownSafe and PtrState.SetKnownSafe. This is apart of a series of patches to encapsulate PtrState.RRI and make PtrState.RRI a private field of PtrState. *NOTE* This is actually the second commit in the patch stream. I should have put this note on the first such commit r184528. llvm-svn: 184532
* [objcarcopts] Some more minor code cleanups/comment additions.Michael Gottesman2013-06-211-1/+5
| | | | llvm-svn: 184531
* [objcarcopts] Refactor out the RRInfo merging code from PtrState into ↵Michael Gottesman2013-06-211-17/+28
| | | | | | | | RRInfo::Merge. I also added some comments and performed minor code cleanups. llvm-svn: 184528
* [objc-arc] Ensure that the cfg path count does not overflow when we multiply ↵Michael Gottesman2013-06-071-10/+38
| | | | | | | | TopDownPathCount/BottomUpPathCount. rdar://12480535 llvm-svn: 183489
* [objc-arc] KnownSafe does not imply that it is safe to perform code motion ↵Michael Gottesman2013-05-241-8/+40
| | | | | | | | across CFG edges since even if it is safe to remove RR pairs, we may still be able to move a retain/release into a loop. rdar://13949644 llvm-svn: 182670
* [objc-arc] Make sure that multiple owners is propogated correctly through ↵Michael Gottesman2013-05-241-17/+16
| | | | | | | | the pass via the usage of a global data structure. rdar://13750319 llvm-svn: 182669
* [objc-arc] Fixed number of prefixing slashes in some comments in a function ↵Michael Gottesman2013-05-231-6/+6
| | | | | | from 3 to 2 to match the rest of ObjCARCOpts. llvm-svn: 182557
* [objc-arc] Fixed a spelling error and made the statistic descriptions be ↵Michael Gottesman2013-05-151-5/+5
| | | | | | consistent about their usage of periods. llvm-svn: 181901
* Removed trailing whitespace.Michael Gottesman2013-05-141-4/+4
| | | | llvm-svn: 181760
* [objc-arc-opts] Added debug statements when we set and unset whether a ↵Michael Gottesman2013-05-141-0/+2
| | | | | | pointer is known positive. llvm-svn: 181745
* [objc-arc-opts] In the presense of an alloca unconditionally remove RR pairs ↵Michael Gottesman2013-05-131-5/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | if and only if we are both KnownSafeBU/KnownSafeTD rather than just either or. In the presense of a block being initialized, the frontend will emit the objc_retain on the original pointer and the release on the pointer loaded from the alloca. The optimizer will through the provenance analysis realize that the two are related (albiet different), but since we only require KnownSafe in one direction, will match the inner retain on the original pointer with the guard release on the original pointer. This is fixed by ensuring that in the presense of allocas we only unconditionally remove pointers if both our retain and our release are KnownSafe (i.e. we are KnownSafe in both directions) since we must deal with the possibility that the frontend will emit what (to the optimizer) appears to be unbalanced retain/releases. An example of the miscompile is: %A = alloca retain(%x) retain(%x) <--- Inner Retain store %x, %A %y = load %A ... DO STUFF ... release(%y) call void @use(%x) release(%x) <--- Guarding Release getting optimized to: %A = alloca retain(%x) store %x, %A %y = load %A ... DO STUFF ... release(%y) call void @use(%x) rdar://13750319 llvm-svn: 181743
OpenPOWER on IntegriCloud