summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Revert "InstCombine: Reduce trunc (shl x, K) width."Matt Arsenault2016-06-171-24/+5
| | | | | | | | This reverts commit r272987. This might be causing crashes on some bots. llvm-svn: 272990
* [esan|cfrag] Add the struct field size array in StructInfoQin Zhao2016-06-171-2/+13
| | | | | | | | | | | | | | | Summary: Adds the struct field size array in struct StructInfo. Updates test struct_field_count_basic.ll. Reviewers: aizatsky Subscribers: vitalybuka, zhaoqin, kcc, eugenis, bruening, llvm-commits Differential Revision: http://reviews.llvm.org/D21341 llvm-svn: 272989
* InstCombine: Reduce trunc (shl x, K) width.Matt Arsenault2016-06-171-5/+24
| | | | llvm-svn: 272987
* [RS4GC] Pass CallSite by value instead of const ref; NFCSanjoy Das2016-06-171-11/+10
| | | | | | That's the idiomatic LLVM pattern. llvm-svn: 272981
* [PM] Remove support for omitting the AnalysisManager argument to newChandler Carruth2016-06-1711-15/+25
| | | | | | | | | | | | | | | | | | | | pass manager passes' `run` methods. This removes a bunch of SFINAE goop from the pass manager and just requires pass authors to accept `AnalysisManager<IRUnitT> &` as a dead argument. This is a small price to pay for the simplicity of the system as a whole, despite the noise that changing it causes at this stage. This will also helpfull allow us to make the signature of the run methods much more flexible for different kinds af passes to support things like intelligently updating the pass's progression over IR units. While this touches many, many, files, the changes are really boring. Mostly made with the help of my trusty perl one liners. Thanks to Sean and Hal for bouncing ideas for this with me in IRC. llvm-svn: 272978
* Use m_APInt in SimplifyCFGChuang-Yu Cheng2016-06-171-5/+5
| | | | | | | | | | | Switch from m_Constant to m_APInt per David's request. NFC. Author: Thomas Jablin (tjablin) Reviewers: majnemer cycheng http://reviews.llvm.org/D21440 llvm-svn: 272977
* [LV] Move management of symbolic strides to LAA. NFCIAdam Nemet2016-06-162-60/+10
| | | | | | | | | | | | | | | | | | | This is still NFCI, so the list of clients that allow symbolic stride speculation does not change (yes: LV and LoopVersioningLICM, no: LLE, LDist). However since the symbolic strides are now managed by LAA rather than passed by client a new bool parameter is used to enable symbolic stride speculation. The existing test Transforms/LoopVectorize/version-mem-access.ll checks that stride speculation is performed for LV. The previously added test Transforms/LoopLoadElim/symbolic-stride.ll ensures that no speculation is performed for LLE. The next patch will change the functionality and turn on symbolic stride speculation in all of LAA's clients and remove the bool parameter. llvm-svn: 272970
* [safestack] Fixup llvm.dbg.value when rewriting unsafe allocas.Evgeniy Stepanov2016-06-161-19/+73
| | | | | | | | | When moving unsafe allocas to the unsafe stack, dbg.declare intrinsics are updated to refer to the new location. This change does the same to dbg.value intrinsics. llvm-svn: 272968
* [LV] Make getSymbolicStrides return a pointer rather than a reference. NFCAdam Nemet2016-06-161-5/+5
| | | | | | | | | | | | | | | Turns out SymbolicStrides is actually used in canVectorizeWithIfConvert before it gets set up in canVectorizeMemory. This works fine as long as SymbolicStrides resides in LV since we just have an empty map. Based on this the conclusion is made that there are no symbolic strides which is conservatively correct. However once SymbolicStrides becomes part of LAI, LAI is nullptr at this point so we need to differentiate the uninitialized state by returning a nullptr for SymbolicStrides. llvm-svn: 272966
* [EarlyCSE] Minor cosmetic NFC changesSanjoy Das2016-06-161-2/+2
| | | | | | | - Avoid implicit conversion from pointer to bool - Add a comment when passing in a boolean value llvm-svn: 272955
* [EarlyCSE] Fold invariant loadsSanjoy Das2016-06-161-8/+22
| | | | | | | | Redundant invariant loads can be CSE'ed with very little extra effort over what early-cse already tracks, so it looks reasonable to make early-cse handle this case. llvm-svn: 272954
* [PM] Revert the port of MergeLoadStoreMotion to the new pass manager.Davide Italiano2016-06-162-128/+132
| | | | | | | | Daniel Berlin expressed some real concerns about the port and proposed and alternative approach. I'll revert this for now while working on a new patch, which I hope to put up for review shortly. Sorry for the churn. llvm-svn: 272925
* [DSE] Minor style cleanup. NFC.Chad Rosier2016-06-161-12/+5
| | | | llvm-svn: 272922
* Revert r272891 "[JumpThreading] Prevent dangling pointer problems in ↵Igor Laevsky2016-06-162-17/+5
| | | | | | | | BranchProbabilityInfo" It was causing failures in Profile-i386 and Profile-x86_64 tests. llvm-svn: 272912
* [JumpThreading] Prevent dangling pointer problems in BranchProbabilityInfoIgor Laevsky2016-06-162-5/+17
| | | | | | | | | We should update results of the BranchProbabilityInfo after removing block in JumpThreading. Otherwise we will get dangling pointer inside BranchProbabilityInfo cache. Differential Revision: http://reviews.llvm.org/D20957 llvm-svn: 272891
* PR27938: Don't remove valid DebugLoc in ScalarizerPatrik Hagglund2016-06-161-1/+2
| | | | | | | | | | | | | | | | | Added checks to make sure the Scalarizer::transferMetadata() don't remove valid debug locations from instructions. This is important as the verifier pass require that e.g. inlinable callsites have a valid debug location. https://llvm.org/bugs/show_bug.cgi?id=27938 Patch by Karl-Johan Karlsson Reviewers: dblaikie Differential Revision: http://reviews.llvm.org/D20807 llvm-svn: 272884
* [LAA] Default getInfo to not speculate symbolic strides. NFCAdam Nemet2016-06-163-3/+3
| | | | | | | Soon we won't be passing Strides to getInfo and then we'll have fewer call sites to update. llvm-svn: 272878
* Attempt to define friend function more portably.Sean Silva2016-06-161-16/+5
| | | | | | Patch written by Reid. I verified it locally with clang. llvm-svn: 272875
* SimplifyCFG is able to detect the pattern:Chuang-Yu Cheng2016-06-161-4/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (i == 5334 || i == 5335) to: ((i & -2) == 5334) This transformation has some incorrect side conditions. Specifically, the transformation is only applied when the right-hand side constant (5334 in the example) is a power of two not equal and not equal to the negated mask. These side conditions were added in r258904 to fix PR26323. The correct side condition is that: ((Constant & Mask) == Constant)[(5334 & -2) == 5334]. It's a little bit hard to see why these transformations are correct and what the side conditions ought to be. Here is a CVC3 program to verify them for 64-bit values: ONE : BITVECTOR(64) = BVZEROEXTEND(0bin1, 63); x : BITVECTOR(64); y : BITVECTOR(64); z : BITVECTOR(64); mask : BITVECTOR(64) = BVSHL(ONE, z); QUERY( (y & ~mask = y) => ((x & ~mask = y) <=> (x = y OR x = (y | mask))) ); Please note that each pattern must be a dual implication (<--> or iff). One directional implication can create spurious matches. If the implication is only one-way, an unsatisfiable condition on the left side can imply a satisfiable condition on the right side. Dual implication ensures that satisfiable conditions are transformed to other satisfiable conditions and unsatisfiable conditions are transformed to other unsatisfiable conditions. Here is a concrete example of a unsatisfiable condition on the left implying a satisfiable condition on the right: mask = (1 << z) (x & ~mask) == y --> (x == y || x == (y | mask)) Substituting y = 3, z = 0 yields: (x & -2) == 3 --> (x == 3 || x == 2) The version of this code before r258904 had no side-conditions and incorrectly justified itself in comments through one-directional implication. Thanks to Chandler for the suggestion! Author: Thomas Jablin (tjablin) Reviewers: chandlerc majnemer hfinkel cycheng http://reviews.llvm.org/D21417 llvm-svn: 272873
* [InstCombine] Don't widen metadata on store-to-load forwardingEli Friedman2016-06-161-2/+4
| | | | | | | | | | | | | The original check for load CSE or store-to-load forwarding is wrong when the forwarded stored value happened to be a load. Ref https://github.com/JuliaLang/julia/issues/16894 Differential Revision: http://reviews.llvm.org/D21271 Patch by Yichao Yu! llvm-svn: 272868
* [IR] [DAE] Copy comdats during DAE, and don't copy comdats in ↵Justin Lebar2016-06-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | GlobalObject::copyAttributesFrom. Summary: This reverts the changes to Globals.cpp and IRMover.cpp in "[IR] Copy comdats in GlobalObject::copyAttributesFrom" (D20631, rL270743). The DeadArgElim test is left unchanged, and we change DAE to explicitly copy comdats. The reverted change breaks copyAttributesFrom when the destination lives in a different module from the source. The decision in D21255 was to revert this patch and handle comdat copying separately from copyAttributesFrom. Reviewers: majnemer, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21403 llvm-svn: 272855
* [LV] Make the new getter return a const reference. NFCAdam Nemet2016-06-151-1/+3
| | | | | | | | | LoopVectorizationLegality holds a constant reference to LAI, so this will have to be const as well. Also added missed function comment. llvm-svn: 272851
* Address review feedbacks of AddDiscriminator changeXinliang David Li2016-06-151-4/+6
| | | | llvm-svn: 272850
* [DSE] Hoist a redundant check to simplify logic. NFC.Chad Rosier2016-06-151-12/+5
| | | | llvm-svn: 272849
* [PM] Port Add discriminator pass to new PMXinliang David Li2016-06-152-9/+23
| | | | llvm-svn: 272847
* Typo. NFC.Chad Rosier2016-06-151-1/+1
| | | | llvm-svn: 272846
* [PM] Remove unneded doFinalization() override from LoopVersioningLICM.Davide Italiano2016-06-151-4/+0
| | | | llvm-svn: 272842
* [LoopSimplify] Analyses do not need to be member variables.Davide Italiano2016-06-151-9/+6
| | | | | | In preparation for porting this pass to the new PM. llvm-svn: 272818
* [LV] Add getter function for LoopVectorizationLegality::Strides. NFCAdam Nemet2016-06-151-6/+8
| | | | | | This should help moving Strides to LAA later. llvm-svn: 272796
* [LV] Remove more unused functions. NFCAdam Nemet2016-06-151-4/+0
| | | | | | LoopVectorizationLegality::strides_begin/end are also unused. llvm-svn: 272781
* [LV] Remove unused function. NFCAdam Nemet2016-06-151-1/+0
| | | | | | LoopVectorizationLegality::mustCheckStrides is unused. llvm-svn: 272780
* Work around MSVC "friend" semantics.Sean Silva2016-06-151-0/+2
| | | | | | | | | | | | The error on clang-x86-win2008-selfhost is: C:\buildbot\slave-config\clang-x86-win2008-selfhost\llvm\lib\Transforms\Vectorize\SLPVectorizer.cpp(955) : error C2248: 'llvm::slpvectorizer::BoUpSLP::ScheduleData' : cannot access private struct declared in class 'llvm::slpvectorizer::BoUpSLP' C:\buildbot\slave-config\clang-x86-win2008-selfhost\llvm\lib\Transforms\Vectorize\SLPVectorizer.cpp(608) : see declaration of 'llvm::slpvectorizer::BoUpSLP::ScheduleData' C:\buildbot\slave-config\clang-x86-win2008-selfhost\llvm\lib\Transforms\Vectorize\SLPVectorizer.cpp(337) : see declaration of 'llvm::slpvectorizer::BoUpSLP' I reproduced this locally with both MSVC 2013 and MSVC 2015. llvm-svn: 272772
* Speculative buildbot fix.Sean Silva2016-06-151-0/+5
| | | | | | | | | | | | | | This wasn't failing for me with clang as the compiler. I think GCC may disagree with clang about whether a friend declaration introduces a declaration in the enclosing namespace (or something). Example error: /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:950:77: error: ‘llvm::raw_ostream& llvm::slpvectorizer::operator<<(llvm::raw_ostream&, const llvm::slpvectorizer::BoUpSLP::ScheduleData&)’ should have been declared inside ‘llvm::slpvectorizer’ const BoUpSLP::ScheduleData &SD) { ^ llvm-svn: 272767
* [PM] Port SLPVectorizer to the new PMSean Silva2016-06-151-138/+113
| | | | | | | | | | | This uses the "runImpl" approach to share code with the old PM. Porting to the new PM meant abandoning the anonymous namespace enclosing most of SLPVectorizer.cpp which is a bit of a bummer (but not a big deal compared to having to pull the pass class into a header which the new PM requires since it calls the constructor directly). llvm-svn: 272766
* [PM] Port AlignmentFromAssumptions to the new PM.Sean Silva2016-06-151-21/+36
| | | | | | This uses the "runImpl" pattern to share code between the old and new PM. llvm-svn: 272757
* Recommit [LV] Enable vectorization of loops where the IV has an external useMichael Kuperstein2016-06-151-26/+92
| | | | | | | | | | | | | r272715 broke libcxx because it did not correctly handle cases where the last iteration of one IV is the second-to-last iteration of another. Original commit message: Vectorizing loops with "escaping" IVs has been disabled since r190790, due to PR17179. This re-enables it, with support for external use of both "post-increment" (last iteration) and "pre-increment" (second-to-last iteration) IVs. llvm-svn: 272742
* [LoopUnroll] Don't crash trying to unroll loop with EH pad exitDavid Majnemer2016-06-151-0/+5
| | | | | | | | | | | | | | We do not support splitting cleanuppad or catchswitches. This is problematic for passes which assume that a loop is in loop simplify form (the loop would have a dedicated exit block instead of sharing it). While it isn't great that we don't support this for cleanups, we still cannot make loop-simplify form an assertable precondition because indirectbr will also disable these sorts of CFG cleanups. This fixes PR28132. llvm-svn: 272739
* Remove the ScalarReplAggregates passDavid Majnemer2016-06-155-2641/+7
| | | | | | | | | | Nearly all the changes to this pass have been done while maintaining and updating other parts of LLVM. LLVM has had another pass, SROA, which has superseded ScalarReplAggregates for quite some time. Differential Revision: http://reviews.llvm.org/D21316 llvm-svn: 272737
* Reverting r272715 since it broke libcxx.Michael Kuperstein2016-06-141-80/+26
| | | | llvm-svn: 272730
* [PM] Port WholeProgramDevirt to the new pass manager.Davide Italiano2016-06-141-0/+6
| | | | llvm-svn: 272721
* [LV] Enable vectorization of loops where the IV has an external useMichael Kuperstein2016-06-141-26/+80
| | | | | | | | | | | Vectorizing loops with "escaping" IVs has been disabled since r190790, due to PR17179. This re-enables it, with support for external use of both "post-increment" (last iteration) and "pre-increment" (second-to-last iteration) IVs. Differential Revision: http://reviews.llvm.org/D21048 llvm-svn: 272715
* [MemorySSA] Set CFGOnly correctly for MemorySSAWrapperPassGeoff Berry2016-06-141-2/+3
| | | | | | | | Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D21344 llvm-svn: 272712
* IR: Introduce local_unnamed_addr attribute.Peter Collingbourne2016-06-1411-26/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a local_unnamed_addr attribute is attached to a global, the address is known to be insignificant within the module. It is distinct from the existing unnamed_addr attribute in that it only describes a local property of the module rather than a global property of the symbol. This attribute is intended to be used by the code generator and LTO to allow the linker to decide whether the global needs to be in the symbol table. It is possible to exclude a global from the symbol table if three things are true: - This attribute is present on every instance of the global (which means that the normal rule that the global must have a unique address can be broken without being observable by the program by performing comparisons against the global's address) - The global has linkonce_odr linkage (which means that each linkage unit must have its own copy of the global if it requires one, and the copy in each linkage unit must be the same) - It is a constant or a function (which means that the program cannot observe that the unique-address rule has been broken by writing to the global) Although this attribute could in principle be computed from the module contents, LTO clients (i.e. linkers) will normally need to be able to compute this property as part of symbol resolution, and it would be inefficient to materialize every module just to compute it. See: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/356401.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356738.html for earlier discussion. Part of the fix for PR27553. Differential Revision: http://reviews.llvm.org/D20348 llvm-svn: 272709
* LoopRotate: restructure code to simplify functionsSebastian Pop2016-06-141-41/+59
| | | | | | | | | | | | We move the loop rotate functions in a separate class to avoid passing multiple parameters to each function. This cleanup will help with further development of loop rotation. NFC. Patch written by Aditya Kumar and Sebastian Pop. Differential Revision: http://reviews.llvm.org/D21311 llvm-svn: 272672
* [MergedLoadStoreMotion] Before quering AA verify the loads are the same.Chad Rosier2016-06-141-1/+1
| | | | | | | Basicaa stats show the number of queries in Spec2k6 are reduced by 4540 or ~.67% overall. llvm-svn: 272661
* [LoopVer] Remove an assert that's redundant now. NFCAdam Nemet2016-06-141-4/+1
| | | | | | | | Ensuring that the PHI are all single-operand is not performed in the second pass added by the previous pass. This removes the assert from the first pass. llvm-svn: 272650
* [LoopVer] Update all existing PHIs in the exit blockAdam Nemet2016-06-141-6/+18
| | | | | | | | | | | | | | | | | | | | | | We only used to add the edge from the cloned loop to PHIs that corresponded to values defined by the loop. We need to do this for all PHIs obviously since we need a PHI operand for each incoming edge. This includes things like PHIs with a constant value or with values defined before the original loop (see the testcases). After the patch the PHIs are added to the exit block in two passes. In the first pass we ensure there is a single-operand (LCSSA) PHI for each value defined by the loop. In the second pass we loop through each (single-operand) PHI and add the value for the edge from the cloned loop. If the value is defined in the loop we'll use the cloned instruction from the cloned loop. Fixes PR28037 llvm-svn: 272649
* [PM] Port Mem2Reg to the new pass manager.Davide Italiano2016-06-142-51/+67
| | | | llvm-svn: 272630
* [PM] Port MemCpyOpt to the new PM.Sean Silva2016-06-142-57/+97
| | | | | | | | | The need for all these Lookup* functions is just because of calls to getAnalysis inside methods (i.e. not at the top level) of the runOnFunction method. They should be straightforward to clean up when the old PM is gone. llvm-svn: 272615
* [PM/MergedLoadStoreMotion] Preserve analyses more aggressively.Davide Italiano2016-06-141-1/+6
| | | | llvm-svn: 272611
OpenPOWER on IntegriCloud