llvm-6502/lib/Transforms/ObjCARC
Michael Gottesman 0d92a3c600 [ObjCARC] Strength reduce objc_retainBlock -> objc_retain if the objc_retainBlock is optimizable.
If an objc_retainBlock has the copy_on_escape metadata attached to it
AND if the block pointer argument only escapes down the stack, we are
allowed to strength reduce the objc_retainBlock to to an objc_retain and
thus optimize it.

Current there is logic in the ARC data flow analysis to handle
this case which is complicated and involved making distinctions in
between objc_retainBlock and objc_retain in certain places and
considering them the same in others.

This patch simplifies said code by:

1. Performing the strength reduction in the initial ARC peephole
analysis (ObjCARCOpts::OptimizeIndividualCalls).

2. Changes the ARC dataflow analysis (which runs after the peephole
analysis) to consider all objc_retainBlock calls to not be optimizable
(since if the call was optimizable, we would have strength reduced it
already).

This patch leaves in the infrastructure in the ARC dataflow analysis to
handle this case, which due to 2 will just be dead code. I am doing this
on purpose to separate the removal of the old code from the testing of
the new code.

<rdar://problem/13249661>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178284 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 20:11:19 +00:00
..
CMakeLists.txt Extracted ObjCARCContract from ObjCARCOpts into its own file. 2013-01-29 03:03:03 +00:00
DependencyAnalysis.cpp Kill every call to @clang.arc.use in the ARC contract phase. 2013-03-22 21:38:36 +00:00
DependencyAnalysis.h Extracted ObjCARCContract from ObjCARCOpts into its own file. 2013-01-29 03:03:03 +00:00
LLVMBuild.txt Added missing dashes from header declaration comment. 2013-01-29 04:53:55 +00:00
Makefile
ObjCARC.cpp Make helpers static. Add missing include so LLVMInitializeObjCARCOpts gets C linkage. 2013-02-15 12:30:38 +00:00
ObjCARC.h Changed isNullOrUndef => IsNullOrUndef and isNoopInstruction => IsNoopInstruction so that all helper functions are named similarly in ObjCARC.h. 2013-03-25 09:27:43 +00:00
ObjCARCAliasAnalysis.cpp Sorted includes using utils/sort_includes. 2013-01-29 04:20:52 +00:00
ObjCARCAliasAnalysis.h Added two missing headers from ObjCARCAliasAnalysis.h. 2013-01-29 04:09:24 +00:00
ObjCARCAPElim.cpp Hopefully fix the Windows build failure introduced in r173769 2013-01-29 09:09:27 +00:00
ObjCARCContract.cpp Changed isNullOrUndef => IsNullOrUndef and isNoopInstruction => IsNoopInstruction so that all helper functions are named similarly in ObjCARC.h. 2013-03-25 09:27:43 +00:00
ObjCARCExpand.cpp Sorted includes using utils/sort_includes. 2013-01-29 04:20:52 +00:00
ObjCARCOpts.cpp [ObjCARC] Strength reduce objc_retainBlock -> objc_retain if the objc_retainBlock is optimizable. 2013-03-28 20:11:19 +00:00
ObjCARCUtil.cpp [ObjCARC Annotations] Added support for displaying the state of pointers at the bottom/top of BBs of the ARC dataflow analysis for both bottomup and topdown analyses. 2013-03-26 00:42:09 +00:00
ProvenanceAnalysis.cpp Changed isStoredObjCPointer => IsStoredObjCPointer. No functionality change. 2013-02-12 23:35:08 +00:00
ProvenanceAnalysis.h Fixed some whitespace/80+ violations. Also added a space after a namespace declaration. 2013-01-29 04:58:30 +00:00