summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Hoist the insertVector helper to be a static helper.Chandler Carruth2012-12-171-49/+62
| | | | | | | | | | | | | | | This will allow its use inside of memcpy rewriting as well. This routine is more complex than extractVector, and some of its uses are not 100% where I want them to be so there is still some work to do here. While this can technically change the output in some cases, it shouldn't be a change that matters -- IE, it can leave some dead code lying around that prior versions did not, etc. Yet another step in the refactorings leading up to the solution to the last component of PR14478. llvm-svn: 170328
* Lift the extractVector helper all the way out to a static helper function.Chandler Carruth2012-12-171-30/+32
| | | | | | | | | | | | | | | | | The method helpers all implicitly act upon the alloca, and what we really want is a fully generic helper. Doing memcpy rewrites is more special than all other rewrites because we are at times rewriting instructions which touch pointers *other* than the alloca. As a consequence all of the helpers needed by memcpy rewriting of sub-vector copies will need to be generalized fully. Note that all of these helpers ({insert,extract}{Integer,Vector}) are woefully uncommented. I'm going to go back through and document them once I get the factoring correct. No functionality changed. llvm-svn: 170325
* Factor the vector load rewriting into a more generic form.Chandler Carruth2012-12-171-16/+27
| | | | | | | | | This makes it suitable for use in rewriting memcpy in the presence of subvector memcpy intrinsics. No functionality changed. llvm-svn: 170324
* Fix the first part of PR14478: memset now works.Chandler Carruth2012-12-171-34/+68
| | | | | | | | | | | | | | | | | | | PR14478 highlights a serious problem in SROA that simply wasn't being exercised due to a lack of vector input code mixed with C-library function calls. Part of SROA was written carefully to handle subvector accesses via memset and memcpy, but the rewriter never grew support for this. Fixing it required refactoring the subvector access code in other parts of SROA so it could be shared, and then fixing the splat formation logic and using subvector insertion (this patch). The PR isn't quite fixed yet, as memcpy is still broken in the same way. I'm starting on that series of patches now. Hopefully this will be enough to bring the bullet benchmark back to life with the bb-vectorizer enabled, but that may require fixing memcpy as well. llvm-svn: 170301
* Extract the logic for inserting a subvector into a vector alloca.Chandler Carruth2012-12-171-38/+50
| | | | | | | No functionality changed. Another step of refactoring toward solving PR14487. llvm-svn: 170300
* Lift the integer splat computation into a helper function.Chandler Carruth2012-12-171-11/+28
| | | | | | | | No functionality changed. Refactoring leading up to the fix for PR14478 which requires some significant changes to the memset and memcpy rewriting. llvm-svn: 170299
* Relax an overly aggressive assert to fix PR14572.Chandler Carruth2012-12-151-1/+1
| | | | | | The alloca width is based on the alloc size, not the type size. llvm-svn: 170270
* Revert r170246, "Enable the loop vectorizer by default."NAKAMURA Takumi2012-12-151-1/+1
| | | | llvm-svn: 170267
* Add back FoldOpIntoPhi optimizations with fix. Included test cases to help ↵Michael Ilseman2012-12-141-0/+4
| | | | | | catch these errors and to test the presence of the optimization itself llvm-svn: 170248
* Enable the loop vectorizer by default.Nadav Rotem2012-12-141-1/+1
| | | | llvm-svn: 170246
* rdar://12753946Shuxin Yang2012-12-141-0/+32
| | | | | | Implement rule : "x * (select cond 1.0, 0.0) -> select cond x, 0.0" llvm-svn: 170226
* Fix lint warnings in MemorySanitizer.cpp.Evgeniy Stepanov2012-12-141-9/+12
| | | | llvm-svn: 170203
* [msan] Origin stores and loads do not need explicit alignment.Evgeniy Stepanov2012-12-141-9/+8
| | | | | | Origin address is always 4 byte aligned, and the access type is always i32. llvm-svn: 170199
* [msan] Refactor default shadow propagation and origin tracking.Evgeniy Stepanov2012-12-141-52/+117
| | | | | | | | This change moves the code for default shadow propagaition (handleShadowOr) and origin tracking (setOriginForNaryOp) into a new builder-like class. Also gets rid of handleShadowOrBinary. llvm-svn: 170192
* revert r170166 - disable the loop vectorizer.Nadav Rotem2012-12-141-1/+1
| | | | llvm-svn: 170172
* Enable the loop vectorizer.Nadav Rotem2012-12-141-1/+1
| | | | llvm-svn: 170166
* Disable the loop vectorizer.Nadav Rotem2012-12-141-1/+1
| | | | llvm-svn: 170162
* Enable the Loop Vectorizer by default for O2 and O3. Disable if-conversion ↵Nadav Rotem2012-12-132-2/+2
| | | | | | by default. I plan to revert this patch later today. llvm-svn: 170157
* Revert r170020, "Simplify negated bit test", for now.NAKAMURA Takumi2012-12-131-18/+0
| | | | | | | | | This assumes (1 << n) is always not zero. Consider n is greater than word size. Although I know it is undefined, this transforms undefined behavior hidden. This led clang unexpected behavior with some failures. I will investigate to fix undefined shl in clang. llvm-svn: 170128
* Revert "Restore the PHI optimization I accidently removed" temporarily sinceEric Christopher2012-12-131-4/+0
| | | | | | | | it seems to be breaking self-host for a few people and is PR14592. This reverts commit r170024. llvm-svn: 170106
* Missed these calls from the previous rename somehow.Rafael Espindola2012-12-131-2/+2
| | | | llvm-svn: 170094
* Rename isPowerOfTwo to isKnownToBeAPowerOfTwo.Rafael Espindola2012-12-131-2/+2
| | | | | | | | In a previous thread it was pointed out that isPowerOfTwo is not a very precise name since it can return false for powers of two if it is unable to show that they are powers of two. llvm-svn: 170093
* Pattern matching code for intrinsics.Michael Ilseman2012-12-131-15/+17
| | | | | | Provides m_Argument that allows matching against a CallSite's specified argument. Provides m_Intrinsic pattern that can be templatized over the intrinsic id and bind/match arguments similarly to other pattern matchers. Implementations provided for 0 to 4 arguments, though it's very simple to extend for more. Also provides example template specialization for bswap (m_BSwap) and example of code cleanup for its use. llvm-svn: 170091
* Take into account minimize size attribute in the inliner.Quentin Colombet2012-12-131-2/+4
| | | | | | | | | Better controls the inlining of functions when the caller function has MinSize attribute. Basically, when the caller function has this attribute, we do not "force" the inlining of callee functions carrying the InlineHint attribute (i.e., functions defined with inline keyword) llvm-svn: 170065
* Teach the cost model about the optimization in r169904: Truncation of ↵Nadav Rotem2012-12-132-2/+20
| | | | | | induction variables costs the same as scalar trunc. llvm-svn: 170051
* Typo.Chad Rosier2012-12-131-1/+1
| | | | llvm-svn: 170050
* Restore the PHI optimization I accidently removedMichael Ilseman2012-12-121-0/+4
| | | | llvm-svn: 170024
* Remove trailing whitespaceMichael Ilseman2012-12-121-39/+39
| | | | llvm-svn: 170022
* Simplify negated bit testDavid Majnemer2012-12-121-0/+18
| | | | llvm-svn: 170020
* Fix indentation.Nadav Rotem2012-12-121-4/+3
| | | | llvm-svn: 170005
* LoopVectorizer: Use the "optsize" attribute to decide if we are allowed to ↵Nadav Rotem2012-12-123-8/+13
| | | | | | increase the function size. llvm-svn: 170004
* The TargetData is not used for the isPowerOfTwo determination. It has neverRafael Espindola2012-12-121-3/+2
| | | | | | | | | | been used in the first place. It simply was passed to the function and to the recursive invocations. Simply drop the parameter and update the callers for the new signature. Patch by Saleem Abdulrasool! llvm-svn: 169988
* Improve debug info generated with enabled AddressSanitizer.Alexey Samsonov2012-12-122-0/+39
| | | | | | | | | | | | When ASan replaces <alloca instruction> with <offset into a common large alloca>, it should also patch llvm.dbg.declare calls and replace debug info descriptors to mark that we've replaced alloca with a value that stores an address of the user variable, not the user variable itself. See PR11818 for more context. llvm-svn: 169984
* Fix the ascii drawing that was ruined when I split the H and CPPNadav Rotem2012-12-121-10/+10
| | | | llvm-svn: 169955
* fix a typo.Nadav Rotem2012-12-121-1/+1
| | | | llvm-svn: 169953
* LoopVectorizer: When -Os is used, vectorize only loops that dont require a ↵Nadav Rotem2012-12-124-29/+68
| | | | | | tail loop. There is no testcase because I dont know of a way to initialize the loop vectorizer pass without adding an additional hidden flag. llvm-svn: 169950
* - Fix a problematic way in creating all-the-1 APInt.Shuxin Yang2012-12-121-2/+4
| | | | | | - Propagate "exact" bit of [l|a]shr instruction. llvm-svn: 169942
* Remove redunant optimizations from InstCombine, instead call the appropriate ↵Michael Ilseman2012-12-122-30/+9
| | | | | | functions from SimplifyInstruction llvm-svn: 169941
* PR14574. Fix a bug in the code that calculates the mask the converted PHIs ↵Nadav Rotem2012-12-111-1/+1
| | | | | | in if-conversion. llvm-svn: 169916
* Loop Vectorize: optimize the vectorization of trunc(induction_var). The ↵Nadav Rotem2012-12-111-1/+13
| | | | | | truncation is now done on scalars. llvm-svn: 169904
* Use an ArrayRef instead of a std::vector&.Rafael Espindola2012-12-111-4/+4
| | | | llvm-svn: 169881
* [msan] Use explicitely aligned stores and loads with function argument shadow.Evgeniy Stepanov2012-12-111-8/+13
| | | | | | | | Use explicitely aligned store and load instructions to deal with argument and retval shadow. This matters when an argument's alignment is higher than __msan_param_tls alignment (which is the case with __m128i). llvm-svn: 169859
* Revert EVT->MVT changes, r169836-169851, due to buildbot failures.Patrik Hagglund2012-12-111-1/+1
| | | | llvm-svn: 169854
* Change TargetLowering::getLoadExtAction to take an MVT, instead of EVT.Patrik Hagglund2012-12-111-1/+1
| | | | llvm-svn: 169840
* Fix PR14565. Don't if-convert loops that have switch statements in them.Nadav Rotem2012-12-111-0/+4
| | | | llvm-svn: 169813
* Enable the loop vectorizer only on O2 and above. (Still disabled by default)Nadav Rotem2012-12-101-1/+1
| | | | llvm-svn: 169774
* Split the LoopVectorizer into H and CPP.Nadav Rotem2012-12-102-951/+993
| | | | llvm-svn: 169771
* Don't use a red zone for code coverage if the user specified `-mno-red-zone'.Bill Wendling2012-12-101-4/+17
| | | | | | | | | The `-mno-red-zone' flag wasn't being propagated to the functions that code coverage generates. This allowed some of them to use the red zone when that wasn't allowed. <rdar://problem/12843084> llvm-svn: 169754
* Add support for reverse induction variables. For example:Nadav Rotem2012-12-101-90/+191
| | | | | | | while (i--) sum+=A[i]; llvm-svn: 169752
* Add a new visitor for walking the uses of a pointer value.Chandler Carruth2012-12-101-219/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This visitor provides infrastructure for recursively traversing the use-graph of a pointer-producing instruction like an alloca or a malloc. It maintains a worklist of uses to visit, so it can handle very deep recursions. It automatically looks through instructions which simply translate one pointer to another (bitcasts and GEPs). It tracks the offset relative to the original pointer as long as that offset remains constant and exposes it during the visit as an APInt offset. Finally, it performs conservative escape analysis. However, currently it has some limitations that should be addressed going forward: 1) It doesn't handle vectors of pointers. 2) It doesn't provide a cheaper visitor when the constant offset tracking isn't needed. 3) It doesn't support non-instruction pointer values. The current functionality is exactly what is required to implement the SROA pointer-use visitors in terms of this one, rather than in terms of their own ad-hoc base visitor, which was always very poorly specified. SROA has been converted to use this, and the code there deleted which this utility now provides. Technically speaking, using this new visitor allows SROA to handle a few more cases than it previously did. It is now more aggressive in ignoring chains of instructions which look like they would defeat SROA, but in fact do not because they never result in a read or write of memory. While this is "neat", it shouldn't be interesting for real programs as any such chains should have been removed by others passes long before we get to SROA. As a consequence, I've not added any tests for these features -- it shouldn't be part of SROA's contract to perform such heroics. The goal is to extend the functionality of this visitor going forward, and re-use it from passes like ASan that can benefit from doing a detailed walk of the uses of a pointer. Thanks to Ben Kramer for the code review rounds and lots of help reviewing and debugging this patch. llvm-svn: 169728
OpenPOWER on IntegriCloud