summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* Switch CodeMetrics itself over to use TTI to determine if an instructionChandler Carruth2013-01-213-9/+21
| | | | | | | | | | | | is free. The whole CodeMetrics API should probably be reworked more, but this is enough to allow deleting the duplicate code there for computing whether an instruction is free. All of the passes using this have been updated to pull in TTI and hand it to the CodeMetrics stuff. Further, a dead CodeMetrics API (analyzeFunction) is nuked for lack of users. llvm-svn: 173036
* Improved comment.Michael Gottesman2013-01-181-2/+5
| | | | llvm-svn: 172864
* Fixed typo in comment.Michael Gottesman2013-01-181-2/+2
| | | | llvm-svn: 172863
* Use AttributeSet accessor methods instead of Attribute accessor methods.Bill Wendling2013-01-181-6/+6
| | | | | | | Further encapsulation of the Attribute object. Don't allow direct access to the Attribute object as an aggregate. llvm-svn: 172853
* Silence GCC warning about dropping off a non-void function.Benjamin Kramer2013-01-181-0/+1
| | | | llvm-svn: 172839
* Fixed 80+ violation.Michael Gottesman2013-01-181-2/+2
| | | | llvm-svn: 172782
* Added missing const from my last commit.Michael Gottesman2013-01-171-1/+1
| | | | llvm-svn: 172736
* [ObjCARC] Implemented operator<< for InstructionClass and changed a ↵Michael Gottesman2013-01-171-3/+56
| | | | | | ``Visited'' Debug message to use it. llvm-svn: 172735
* [ObjCARC] Turn off ignoring unwind edges in ObjCARC when ↵Michael Gottesman2013-01-161-33/+0
| | | | | | | | | | | | | -fno-objc-arc-exception is enabled due to it's affect on correctness. Specifically according to the semantics of ARC -fno-objc-arc-exception simply states that it is expected that the unwind path out of a call *MAY* not release objects. Thus we can have the situation where a release gets moved into a catch block which we ignore when we remove a retain/release pair resulting in (even though we assume the program is exiting anyways) the cleanup code path potentially blowing up before program exit. llvm-svn: 172599
* Changed SmallPtrSet.count guard + SmallPtrSet.insert to just SmallPtrSet.insert.Michael Gottesman2013-01-141-2/+1
| | | | llvm-svn: 172452
* Fixed some 80+ violations.Michael Gottesman2013-01-141-14/+18
| | | | llvm-svn: 172374
* Updated the documentation in ObjCARC.cpp to fit the style guide better (i.e. ↵Michael Gottesman2013-01-141-232/+259
| | | | | | use doxygen). Still some work to do though. llvm-svn: 172371
* Fixed an infinite loop in the block escape in analysis in ObjCARC caused by ↵Michael Gottesman2013-01-131-3/+14
| | | | | | | | 2x blocks each assigned a value via a phi-node causing each to depend on the other. A test case is provided as well. llvm-svn: 172368
* [ObjCARC] Even more debug messages!Michael Gottesman2013-01-131-1/+17
| | | | llvm-svn: 172347
* [ObjCARC] More debug messages.Michael Gottesman2013-01-131-4/+29
| | | | llvm-svn: 172346
* Fix an editor goof in r171738 that Bill spotted. He may even have a testChandler Carruth2013-01-121-1/+1
| | | | | | | | case, but looking at the diff this was an obviously unintended change. Thanks for the careful review Bill! =] llvm-svn: 172336
* Fixed debug message in ObjCARC.Michael Gottesman2013-01-121-2/+2
| | | | llvm-svn: 172299
* Fixed a few debug messages in ObjCARC and added one.Michael Gottesman2013-01-121-3/+5
| | | | llvm-svn: 172298
* Fixed bug in ObjCARC where we were changing a call from objc_autoreleaseRV ↵Michael Gottesman2013-01-121-3/+6
| | | | | | => objc_autorelease but were not updating the InstructionClass to IC_Autorelease. llvm-svn: 172288
* Fixed a bug where we were tail calling objc_autorelease causing an object to ↵Michael Gottesman2013-01-121-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not be placed into an autorelease pool. The reason that this occurs is that tail calling objc_autorelease eventually tail calls -[NSObject autorelease] which supports fast autorelease. This can cause us to violate the semantic gaurantees of __autoreleasing variables that assignment to an __autoreleasing variables always yields an object that is placed into the innermost autorelease pool. The fix included in this patch works by: 1. In the peephole optimization function OptimizeIndividualFunctions, always remove tail call from objc_autorelease. 2. Whenever we convert to/from an objc_autorelease, set/unset the tail call keyword as appropriate. *NOTE* I also handled the case where objc_autorelease is converted in OptimizeReturns to an autoreleaseRV which still violates the ARC semantics. I will be removing that in a later patch and I wanted to make sure that the tree is in a consistent state vis-a-vis ARC always. Additionally some test cases are provided and all tests that have tail call marked objc_autorelease keywords have been modified so that tail call has been removed. *NOTE* One test fails due to a separate bug that I am going to commit soon. Thus I marked the check line TMP: instead of CHECK: so make check does not fail. llvm-svn: 172287
* PR14904: Segmentation fault running pass 'Recognize loop idioms'Shuxin Yang2013-01-101-1/+1
| | | | | | | | The root cause is mistakenly taking for granted that "dyn_cast<Instruction>(a-Value)" return a non-NULL instruction. llvm-svn: 172145
* [ObjCARC Debug Message] Added debug message when we convert an autorelease ↵Michael Gottesman2013-01-101-0/+6
| | | | | | into an autoreleaseRV. llvm-svn: 172034
* [ObjCARC Debug Messages] This is a squashed commit of 3x debug message ↵Michael Gottesman2013-01-091-0/+24
| | | | | | | | | | commits ala echristo's suggestion. 1. Added debug messages when in OptimizeIndividualCalls we move calls into predecessors and then erase the original call. 2. Added debug messages when in the process of moving calls in ObjCARCOpt::MoveCalls we create new RR and delete old RR. 3. Added a debug message when we visit a specific retain instruction in ObjCARCOpt::PerformCodePlacement. llvm-svn: 171988
* LICM: Hoist insertvalue/extractvalue out of loops.Benjamin Kramer2013-01-091-7/+6
| | | | | | Fixes PR14854. llvm-svn: 171984
* Fixed EOL whitespace.Michael Gottesman2013-01-071-29/+29
| | | | llvm-svn: 171791
* Sink AddrMode back into TargetLowering, removing one of the mostChandler Carruth2013-01-071-1/+1
| | | | | | | | | peculiar headers under include/llvm. This struct still doesn't make a lot of sense, but it makes more sense down in TargetLowering than it did before. llvm-svn: 171739
* Remove LSR's use of the random AddrMode struct. These variables wereChandler Carruth2013-01-071-68/+76
| | | | | | | | | | | | already in a class, just inline the four of them. I suspect that this class could be simplified some to not always keep distinct variables for these things, but it wasn't clear to me how given the usage so I opted for a trivial and mechanical translation. This removes one of the two remaining users of a header in include/llvm which does nothing more than define a 4 member struct. llvm-svn: 171738
* Switch the SCEV expander and LoopStrengthReduce to useChandler Carruth2013-01-071-161/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TargetTransformInfo rather than TargetLowering, removing one of the primary instances of the layering violation of Transforms depending directly on Target. This is a really big deal because LSR used to be a "special" pass that could only be tested fully using llc and by looking at the full output of it. It also couldn't run with any other loop passes because it had to be created by the backend. No longer is this true. LSR is now just a normal pass and we should probably lift the creation of LSR out of lib/CodeGen/Passes.cpp and into the PassManagerBuilder. =] I've not done this, or updated all of the tests to use opt and a triple, because I suspect someone more familiar with LSR would do a better job. This change should be essentially without functional impact for normal compilations, and only change behvaior of targetless compilations. The conversion required changing all of the LSR code to refer to the TTI interfaces, which fortunately are very similar to TargetLowering's interfaces. However, it also allowed us to *always* expect to have some implementation around. I've pushed that simplification through the pass, and leveraged it to simplify code somewhat. It required some test updates for one of two things: either we used to skip some checks altogether but now we get the default "no" answer for them, or we used to have no information about the target and now we do have some. I've also started the process of removing AddrMode, as the TTI interface doesn't use it any longer. In some cases this simplifies code, and in others it adds some complexity, but I think it's not a bad tradeoff even there. Subsequent patches will try to clean this up even further and use other (more appropriate) abstractions. Yet again, almost all of the formatting changes brought to you by clang-format. =] llvm-svn: 171735
* Make the MergeGlobals pass correctly handle the address space qualifiers of ↵Silviu Baranga2013-01-071-11/+24
| | | | | | the global variables. We partition the set of globals by their address space, and apply the same the trasnformation as before to merge them. llvm-svn: 171730
* Switch LoopIdiom pass to directly require target transform information.Chandler Carruth2013-01-071-3/+3
| | | | | | | | I'm sorry for duplicating bad style here, but I wanted to keep consistency. I've pinged the code review thread where this style was reviewed and changes were requested. llvm-svn: 171714
* Make SimplifyCFG simply depend upon TargetTransformInfo and pass itChandler Carruth2013-01-071-9/+15
| | | | | | | | | | | | | through as a reference rather than a pointer. There is always *some* implementation of this available, so this simplifies code by not having to test for whether it is available or not. Further, it turns out there were piles of places where SimplifyCFG was recursing and not passing down either TD or TTI. These are fixed to be more pedantically consistent even though I don't have any particular cases where it would matter. llvm-svn: 171691
* Make the popcnt support enums and methods have more clear names andChandler Carruth2013-01-071-1/+1
| | | | | | | follow the conding conventions regarding enumerating a set of "kinds" of things. llvm-svn: 171687
* Move TargetTransformInfo to live under the Analysis library. This noChandler Carruth2013-01-072-2/+2
| | | | | | | longer would violate any dependency layering and it is in fact an analysis. =] llvm-svn: 171686
* [ObjCARC Debug Message] - Added debug message when fuse a retain/autorelease ↵Michael Gottesman2013-01-071-2/+10
| | | | | | pair in ObjCARCContract::ContractAutorelease. llvm-svn: 171679
* [ObjCARC Debug Message] - Added debug message when we zap a matching ↵Michael Gottesman2013-01-071-0/+3
| | | | | | retain/autorelease pair in ObjCARCOpt::OptimizeReturns. llvm-svn: 171678
* [ObjCARC Debug Message] - Added debug message when we erase ARC calls with ↵Michael Gottesman2013-01-071-0/+2
| | | | | | null since they are no-ops. llvm-svn: 171677
* [ObjCARC Debug Message] - Added debug message when we add a nounwind keyword ↵Michael Gottesman2013-01-061-0/+2
| | | | | | to a function which can not throw. llvm-svn: 171676
* [ObjCARC Debug Message] - Added debug message when we add a tail keyword to ↵Michael Gottesman2013-01-061-0/+3
| | | | | | a function which can never be passed stack args. llvm-svn: 171675
* [ObjCARC Debug Messages] - Added missing newline.Michael Gottesman2013-01-061-1/+1
| | | | llvm-svn: 171674
* Added debug statement to ObjCARC when we replace objc_autorelease(x) with ↵Michael Gottesman2013-01-061-0/+8
| | | | | | objc_release(x) when x is otherwise unused. llvm-svn: 171673
* Added 2x Debug statements to ObjCARC that log when we handle the two ↵Michael Gottesman2013-01-061-2/+16
| | | | | | | | undefined pointer-to-weak-pointer is NULL cases by replacing the given call inst with an undefined value. The reason that there are two cases is that the first case handles the unary cases and the second the binary cases. llvm-svn: 171672
* Added debug message in ObjCARC when we remove a no-op cast which has only ↵Michael Gottesman2013-01-061-0/+2
| | | | | | special semantic meaning in the frontend and thus in the optimizer can be deleted. llvm-svn: 171670
* Added debug message to ObjCARC when we transform an ↵Michael Gottesman2013-01-061-0/+12
| | | | | | objc_autoreleaseReturnValue => objc_autorelease due to its operand not being used as a return value. llvm-svn: 171669
* Fix a crash in LSR replaceCongruentIVs.Andrew Trick2013-01-061-1/+1
| | | | | | | Indirect branch in the preheader crashes replaceCongruentIVs. Fixes rdar://12910141. llvm-svn: 171653
* Added debug message to ObjCARC when we transform ↵Michael Gottesman2013-01-051-0/+11
| | | | | | objc_retainAutorelasedReturnValue => objc_retain since the operand to said function is not a return value. llvm-svn: 171629
* Added debug message for ObjCARC when we zap an ↵Michael Gottesman2013-01-051-0/+5
| | | | | | objc_autoreleaseReturnValue/objc_retainAutoreleasedValue pair. llvm-svn: 171628
* switch from pointer equality comparison to MDNode::getMostGenericTBAA Chris Lattner2013-01-051-3/+5
| | | | | | when merging two TBAA tags, pointed out by Nuno. llvm-svn: 171627
* Switch LoopIdiomRecognize to directly use the TargetTransformInfoChandler Carruth2013-01-051-11/+9
| | | | | | interface rather than the ScalarTargetTransformInterface. llvm-svn: 171616
* Sink the AddressingModeMatcher helper class into an anonymous namespaceChandler Carruth2013-01-051-1/+623
| | | | | | | | | | | | next to its only user. This helper relies on TargetLowering information that shouldn't be generally used throughout the Transfoms library, and so it made little sense as a generic utility. This also consolidates the file where we need to remove the remaining uses of TargetLowering in favor of the IR-layer abstract interface in TargetTransformInfo. llvm-svn: 171590
* Added DEBUG message to ObjCARC when we optimize objc_retain => ↵Michael Gottesman2013-01-041-0/+10
| | | | | | objc_retainAutorelasedReturnValue. llvm-svn: 171535
OpenPOWER on IntegriCloud