summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Begin fleshing out an interface in TTI for modelling the costs ofChandler Carruth2013-01-221-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | generic function calls and intrinsics. This is somewhat overlapping with an existing intrinsic cost method, but that one seems targetted at vector intrinsics. I'll merge them or separate their names and use cases in a separate commit. This sinks the test of 'callIsSmall' down into TTI where targets can control it. The whole thing feels very hack-ish to me though. I've left a FIXME comment about the fundamental design problem this presents. It isn't yet clear to me what the users of this function *really* care about. I'll have to do more analysis to figure that out. Putting this here at least provides it access to proper analysis pass tools and other such. It also allows us to more cleanly implement the baseline cost interfaces in TTI. With this commit, it is now theoretically possible to simplify much of the inline cost analysis's handling of calls by calling through to this interface. That conversion will have to happen in subsequent commits as it requires more extensive restructuring of the inline cost analysis. The CodeMetrics class is now really only in the business of running over a block of code and aggregating the metrics on that block of code, with the actual cost evaluation done entirely in terms of TTI. llvm-svn: 173148
* Have AttributeSet::getRetAttributes() return an AttributeSet instead of ↵Bill Wendling2013-01-213-18/+24
| | | | | | | | | Attribute. This further restricts the use of the Attribute class to the Attribute family of classes. llvm-svn: 173098
* Make AttributeSet::getFnAttributes() return an AttributeSet instead of an ↵Bill Wendling2013-01-213-20/+23
| | | | | | | | | Attribute. This is more code to isolate the use of the Attribute class to that of just holding one attribute instead of a collection of attributes. llvm-svn: 173094
* Transform (sub 0, (zext bool to A)) to (sext bool to A) andPaul Redmond2013-01-211-0/+10
| | | | | | | | | (sub 0, (sext bool to A)) to (zext bool to A). Patch by Muhammad Ahmad Reviewed by Duncan Sands llvm-svn: 173093
* Fix a comment. Induction vars dont need to start at zero.Nadav Rotem2013-01-211-1/+1
| | | | llvm-svn: 173061
* 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
* Make the inline cost a proper analysis pass. This remains essentiallyChandler Carruth2013-01-212-21/+30
| | | | | | | | | | | | | | | | a dynamic analysis done on each call to the routine. However, now it can use the standard pass infrastructure to reference other analyses, instead of a silly setter method. This will become more interesting as I teach it about more analysis passes. This updates the two inliner passes to use the inline cost analysis. Doing so highlights how utterly redundant these two passes are. Either we should find a cheaper way to do always inlining, or we should merge the two and just fiddle with the thresholds to get the desired behavior. I'm leaning increasingly toward the latter as it would also remove the Inliner sub-class split. llvm-svn: 173030
* Formatting and comment fixes to the always inliner.Chandler Carruth2013-01-211-25/+28
| | | | | | Formatting fixes brought to you by clang-format. llvm-svn: 173029
* Clean up the formatting and doxygen for the simple inliner a bit. NoChandler Carruth2013-01-211-18/+29
| | | | | | functionality changed. llvm-svn: 173028
* LoopVectorize: Fix a C++11 incompatibility.Benjamin Kramer2013-01-201-1/+1
| | | | llvm-svn: 172990
* Fix a build error.Nadav Rotem2013-01-201-2/+3
| | | | llvm-svn: 172971
* LoopVectorizer: Implement a new heuristics for selecting the unroll factor.Nadav Rotem2013-01-201-22/+65
| | | | | | | We ignore the cpu frontend and focus on pipeline utilization. We do this because we don't have a good way to estimate the loop body size at the IR level. llvm-svn: 172964
* LoopVectorizer: Emit memory checks into their own basic block.Benjamin Kramer2013-01-191-33/+53
| | | | | | | | | | | | | | This separates the check for "too few elements to run the vector loop" from the "memory overlap" check, giving a lot nicer code and allowing to skip the memory checks when we're not going to execute the vector code anyways. We still leave the decision of whether to emit the memory checks as branches or setccs, but it seems to be doing a good job. If ugly code pops up we may want to emit them as separate blocks too. Small speedup on MultiSource/Benchmarks/MallocBench/espresso. Most of this is legwork to allow multiple bypass blocks while updating PHIs, dominators and loop info. llvm-svn: 172902
* Sort all of the includes. Several files got checked in with mis-sortedChandler Carruth2013-01-194-4/+3
| | | | | | includes. llvm-svn: 172891
* 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-184-23/+17
| | | | | | | Further encapsulation of the Attribute object. Don't allow direct access to the Attribute object as an aggregate. llvm-svn: 172853
* Push some more methods down to hide the use of the Attribute class.Bill Wendling2013-01-184-9/+7
| | | | | | | | Because the Attribute class is going to stop representing a collection of attributes, limit the use of it as an aggregate in favor of using AttributeSet. This replaces some of the uses for querying the function attributes. llvm-svn: 172844
* Silence GCC warning about dropping off a non-void function.Benjamin Kramer2013-01-181-0/+1
| | | | llvm-svn: 172839
* 80 columnsAlexey Samsonov2013-01-181-1/+2
| | | | llvm-svn: 172813
* Move Blacklist.h to include/ to enable use from clang.Will Dietz2013-01-185-70/+13
| | | | llvm-svn: 172806
* Check for less than 0 in shuffle mask instead of -1. It's more consistent ↵Craig Topper2013-01-181-1/+1
| | | | | | with other code related to shuffles and easier to implement in compiled code. llvm-svn: 172788
* Remove trailing whitespace. Remove new lines between closing brace and 'else'Craig Topper2013-01-181-7/+5
| | | | llvm-svn: 172784
* 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
* ASan: add optional 'zero-based shadow' option to ASan passes. Always tell ↵Alexey Samsonov2013-01-171-35/+39
| | | | | | the values of shadow scale and offset to the runtime llvm-svn: 172709
* ASan: wrap mapping scale and offset in a struct and make it a member of ASan ↵Alexey Samsonov2013-01-161-51/+78
| | | | | | passes. Add test for non-default mapping scale and offset. No functionality change llvm-svn: 172610
* [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
* Teach InstCombine to optimize extract of a value from a vector add operation ↵Nadav Rotem2013-01-151-0/+9
| | | | | | with a constant zero. llvm-svn: 172576
* 1. Hoist minus sign as high as possible in an attempt to revealShuxin Yang2013-01-151-31/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | some optimization opportunities (in the enclosing supper-expressions). rule 1. (-0.0 - X ) * Y => -0.0 - (X * Y) if expression "-0.0 - X" has only one reference. rule 2. (0.0 - X ) * Y => -0.0 - (X * Y) if expression "0.0 - X" has only one reference, and the instruction is marked "noSignedZero". 2. Eliminate negation (The compiler was already able to handle these opt if the 0.0s are replaced with -0.0.) rule 3: (0.0 - X) * (0.0 - Y) => X * Y rule 4: (0.0 - X) * C => X * -C if the expr is flagged "noSignedZero". 3. Rule 5: (X*Y) * X => (X*X) * Y if X!=Y and the expression is flagged with "UnsafeAlgebra". The purpose of this transformation is two-fold: a) to form a power expression (of X). b) potentially shorten the critical path: After transformation, the latency of the instruction Y is amortized by the expression of X*X, and therefore Y is in a "less critical" position compared to what it was before the transformation. 4. Remove the InstCombine code about simplifiying "X * select". The reasons are following: a) The "select" is somewhat architecture-dependent, therefore the higher level optimizers are not able to precisely predict if the simplification really yields any performance improvement or not. b) The "select" operator is bit complicate, and tends to obscure optimization opportunities. It is btter to keep it as low as possible in expr tree, and let CodeGen to tackle the optimization. llvm-svn: 172551
* LoopVectorizer cost model. Honor the user command line flag that selects the ↵Nadav Rotem2013-01-151-1/+1
| | | | | | vectorization factor even if the target machine does not have any vector registers. llvm-svn: 172544
* [msan] Fix handling of equality comparison of pointer vectors.Evgeniy Stepanov2013-01-151-6/+9
| | | | | | Also improve test coveration of the handling of relational comparisons. llvm-svn: 172539
* Remove trailing spaces.Jakub Staszak2013-01-143-78/+78
| | | | llvm-svn: 172489
* This change is to implement following rules under the condition C_A and/or C_RShuxin Yang2013-01-141-8/+127
| | | | | | | | | | | | | | | | | | | | | --------------------------------------------------------------------------- C_A: reassociation is allowed C_R: reciprocal of a constant C is appropriate, which means - 1/C is exact, or - reciprocal is allowed and 1/C is neither a special value nor a denormal. ----------------------------------------------------------------------------- rule1: (X/C1) / C2 => X / (C2*C1) (if C_A) => X * (1/(C2*C1)) (if C_A && C_R) rule 2: X*C1 / C2 => X * (C1/C2) if C_A rule 3: (X/Y)/Z = > X/(Y*Z) (if C_A && at least one of Y and Z is symbolic value) rule 4: Z/(X/Y) = > (Z*Y)/X (similar to rule3) rule 5: C1/(X*C2) => (C1/C2) / X (if C_A) rule 6: C1/(X/C2) => (C1*C2) / X (if C_A) rule 7: C1/(C2/X) => (C1/C2) * X (if C_A) llvm-svn: 172488
* Fix Casting BugDavid Greene2013-01-141-1/+3
| | | | | | Add a const version of getFpValPtr to avoid a cast-away-const warning. llvm-svn: 172467
* Fix typo in comment.Nick Lewycky2013-01-141-1/+1
| | | | llvm-svn: 172460
* 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
* Remove redundant 'llvm::' qualificationsDmitri Gribenko2013-01-131-1/+1
| | | | llvm-svn: 172358
* Fix PR14547. Handle induction variables of small sizes smaller than i32 (i8 ↵Nadav Rotem2013-01-131-0/+3
| | | | | | and i16). llvm-svn: 172348
* [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
* GlobalOpt: Avoid jump on uninitialized value.Benjamin Kramer2013-01-121-1/+1
| | | | | | Found by valgrind. llvm-svn: 172318
* 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
OpenPOWER on IntegriCloud