summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[PowerPC] LSR tunings for PowerPC"Stefan Pintilie2018-03-091-57/+0
| | | | | | | | Revert the rest of the LST tune commit. It seems that the LSR tune commit breaks internal tests. Reverting the commit. llvm-svn: 327143
* Revert "[PowerPC] Move test to correct location."Stefan Pintilie2018-03-091-0/+57
| | | | | | Revert part of the LSR tune commit. llvm-svn: 327142
* Revert "[ThinLTO] Keep available_externally symbols live"Eric Christopher2018-03-092-25/+0
| | | | | | This reverts commit r327041 and the followup attempts at fixing the testcase as they're still failing. llvm-svn: 327094
* LowerDbgDeclare: ignore dbg.declares for allocas with volatile accessAdrian Prantl2018-03-091-3/+5
| | | | | | | | | | | There is no point in lowering a dbg.declare describing an alloca that has volatile loads or stores as users, since the alloca cannot be elided. Lowering the dbg.declare will result in larger debug info that may also have worse coverage than just describing the alloca. rdar://problem/34496278 llvm-svn: 327092
* [Reassociate] fix test to be independent of FP undefSanjay Patel2018-03-081-14/+17
| | | | llvm-svn: 327071
* [ConstantFold] fp_binop undef, undef --> undefSanjay Patel2018-03-084-13/+15
| | | | | | | | | | | | | | | | | These are uncontroversial and independent of a proposed LangRef edits (D44216). I tried to fix tests that would fold away: rL327004 rL327028 rL327030 rL327034 I'm not sure if the Reassociate tests are meaningless yet, but they probably will be as we add more folds, so if anyone has suggestions or wants to fix those, please do. Differential Revision: https://reviews.llvm.org/D44258 llvm-svn: 327058
* Specify that test from r327041 requires assertsVlad Tsyrklevich2018-03-081-0/+1
| | | | llvm-svn: 327051
* Fix test failure introduced in r327041Vlad Tsyrklevich2018-03-081-1/+1
| | | | | | | The "Assertion: `...' failed" error message format is not identical across platforms. llvm-svn: 327047
* [ThinLTO] Keep available_externally symbols liveVlad Tsyrklevich2018-03-082-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change fixes PR36483. The bug was originally introduced by a change that marked non-prevailing symbols dead. This broke LowerTypeTests handling of available_externally functions, which are non-prevailing. LowerTypeTests uses liveness information to avoid emitting thunks for unused functions. Marking available_externally functions dead is incorrect, the functions are used though the function definitions are not. This change keeps them live, and lets the EliminateAvailableExternally/GlobalDCE passes remove them later instead. I've also enabled EliminateAvailableExternally for all optimization levels, I believe it being disabled for O1 was an oversight. Reviewers: pcc, tejohnson Reviewed By: tejohnson Subscribers: grimar, mehdi_amini, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D43690 llvm-svn: 327041
* [InstCombine] add min/max tests with not ops; NFCSanjay Patel2018-03-081-44/+108
| | | | | | | | | | These are based on: https://bugs.llvm.org/show_bug.cgi?id=35875 It's not clear if/how instcombine can reduce these, but we should have the tests here either way to document current behavior. llvm-svn: 327039
* [StructurizeCFG] fix test to be independent of FP undefSanjay Patel2018-03-081-5/+7
| | | | llvm-svn: 327028
* [StructurizeCFG] auto-generate full checks; NFCSanjay Patel2018-03-081-3/+22
| | | | | | Not sure what the intent of this test is, but this will change when we fix FP undef constant folding. llvm-svn: 327022
* [InstCombine] regenerate checks; NFCSanjay Patel2018-03-081-23/+33
| | | | | | | We may not need any of these tests after rL327012, but leaving them here for now until that's confirmed. llvm-svn: 327014
* [InstSimplify] add more tests for FP undef; NFCSanjay Patel2018-03-081-0/+376
| | | | llvm-svn: 327012
* [InstCombine, NewGVN] remove FP undef from testsSanjay Patel2018-03-082-3/+3
| | | | | | | | I'm trying to preserve the intent of these tests by using non-undef operands; if we fix FP undef folding these tests will not pass. llvm-svn: 327004
* [PowerPC] Move test to correct location.Stefan Pintilie2018-03-071-57/+0
| | | | | | | Test was added in r326906 to an incorrect location. Moving the test to PPC CodeGen directory as the test is PPC specific. llvm-svn: 326923
* Re-land: Teach CorrelatedValuePropagation to reduce the width of udiv/urem ↵Justin Lebar2018-03-072-0/+196
| | | | | | | | | | | | | | | instructions. Summary: If the operands of a udiv/urem can be proved to fit within a smaller power-of-two-sized type, reduce the width of the udiv/urem. Backed out for failing an assert in clang bootstrap builds. Re-landing with a fix for handling non-power-of-two inputs (e.g. udiv i24). Original Differential Revision: https://reviews.llvm.org/D44102 llvm-svn: 326908
* [PowerPC] LSR tunings for PowerPCStefan Pintilie2018-03-071-0/+57
| | | | | | | | | The purpose of this patch is to have LSR generate better code on Power. This is done by overriding isLSRCostLess. Differential Revision: https://reviews.llvm.org/D40855 llvm-svn: 326906
* Revert rL326898: "Teach CorrelatedValuePropagation to reduce the width of ↵Justin Lebar2018-03-072-190/+0
| | | | | | | | | | udiv/urem instructions." Breaks bootstrap builds: clang built with this patch asserts while building MCDwarf.cpp: Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed. llvm-svn: 326900
* Teach CorrelatedValuePropagation to reduce the width of udiv/urem instructions.Justin Lebar2018-03-072-0/+190
| | | | | | | | | | | | | | Summary: If the operands of a udiv/urem can be proved to fit within a smaller power-of-two-sized type, reduce the width of the udiv/urem. Reviewers: spatel, sanjoy Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D44102 llvm-svn: 326898
* [LoadStoreVectorizer] Differentiate between <1 x T> and TSven van Haastregt2018-03-071-0/+14
| | | | | | | | | | | The LoadStoreVectorizer thought that <1 x T> and T were the same types when merging stores, leading to a crash later. Patch by Erik Hogeman. Differential Revision: https://reviews.llvm.org/D44014 llvm-svn: 326884
* Add early exit on reassociation of 0 expression.Evgeny Stupachenko2018-03-071-0/+19
| | | | | | | | | | | | | | Summary: Before the patch a try to reassociate ((v * 16) * 0) * 1 fall into infinite loop Reviewers: pankajchawla Differential Revision: http://reviews.llvm.org/D41467 From: Evgeny Stupachenko <evstupac@gmail.com> <evgeny.v.stupachenko@intel.com> llvm-svn: 326861
* DA: remove uses of GEP, only ask SCEVSebastian Pop2018-03-0618-595/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's been quite some time the Dependence Analysis (DA) is broken, as it uses the GEP representation to "identify" multi-dimensional arrays. It even wrongly detects multi-dimensional arrays in single nested loops: from test/Analysis/DependenceAnalysis/Coupled.ll, example @couple6 ;; for (long int i = 0; i < 50; i++) { ;; A[i][3*i - 6] = i; ;; *B++ = A[i][i]; DA used to detect two subscripts, which makes no sense in the LLVM IR or in C/C++ semantics, as there are no guarantees as in Fortran of subscripts not overlapping into a next array dimension: maximum nesting levels = 1 SrcPtrSCEV = %A DstPtrSCEV = %A using GEPs subscript 0 src = {0,+,1}<nuw><nsw><%for.body> dst = {0,+,1}<nuw><nsw><%for.body> class = 1 loops = {1} subscript 1 src = {-6,+,3}<nsw><%for.body> dst = {0,+,1}<nuw><nsw><%for.body> class = 1 loops = {1} Separable = {} Coupled = {1} With the current patch, DA will correctly work on only one dimension: maximum nesting levels = 1 SrcSCEV = {(-2424 + %A)<nsw>,+,1212}<%for.body> DstSCEV = {%A,+,404}<%for.body> subscript 0 src = {(-2424 + %A)<nsw>,+,1212}<%for.body> dst = {%A,+,404}<%for.body> class = 1 loops = {1} Separable = {0} Coupled = {} This change removes all uses of GEP from DA, and we now only rely on the SCEV representation. The patch does not turn on -da-delinearize by default, and so the DA analysis will be more conservative in the case of multi-dimensional memory accesses in nested loops. I disabled some interchange tests, as the DA is not able to disambiguate the dependence anymore. To make DA stronger, we may need to compute a bound on the number of iterations based on the access functions and array dimensions. The patch cleans up all the CHECKs in test/Transforms/LoopInterchange/*.ll to avoid checking for snippets of LLVM IR: this form of checking is very hard to maintain. Instead, we now check for output of the pass that are more meaningful than dozens of lines of LLVM IR. Some tests now require -debug messages and thus only enabled with asserts. Patch written by Sebastian Pop and Aditya Kumar. Differential Revision: https://reviews.llvm.org/D35430 llvm-svn: 326837
* [PatternMatch] define m_Not using m_Xor and cst_pred_tySanjay Patel2018-03-062-14/+7
| | | | | | | | | | | | | Using cst_pred_ty in the definition allows us to match vectors with undef elements. This is a continuation of an effort to make all pattern matchers allow undef elements in vectors: rL325437 rL325466 D43792 Differential Revision: https://reviews.llvm.org/D44076 llvm-svn: 326823
* [CallSiteSplitting] Do not crash when BB's terminator changes.Florian Hahn2018-03-061-0/+90
| | | | | | | | | | | | | | | Change doCallSiteSplitting to iterate until we reach the terminator instruction. tryToSplitCallSite can replace BB's terminator in case BB is a successor of itself. Then IE will be invalidated and we also have to check the current terminator. Reviewers: junbuml, davidxl, davide, fhahn Reviewed By: fhahn, junbuml Differential Revision: https://reviews.llvm.org/D43824 llvm-svn: 326793
* [RewriteStatepoints] Fix stale parse pointsDaniel Neilson2018-03-053-10/+52
| | | | | | | | | | | | | | | | | | | | | | | | Summary: RewriteStatepointsForGC collects parse points for further processing. During the collection if a callsite is found in an unreachable block (DominatorTree::isReachableFromEntry()) then all unreachable blocks are removed by removeUnreachableBlocks(). Some of the removed blocks could have been reachable according to DominatorTree::isReachableFromEntry(). In this case the collected parse points became stale and resulted in a crash when accessed. The fix is to unconditionally canonicalize the IR to removeUnreachableBlocks and then collect the parse points. The added test crashes with the old version and passes with this patch. Patch by Yevgeny Rouban! Reviewed by: Anna Differential Revision: https://reviews.llvm.org/D43929 llvm-svn: 326748
* [SLP] Additional tests for stores vectorization, NFC.Alexey Bataev2018-03-051-0/+179
| | | | llvm-svn: 326740
* [InstCombine] Don't blow up in foldICmpWithCastAndCast on vector icmp ↵Daniel Neilson2018-03-051-0/+12
| | | | | | | | | | | | | | | | | | | | | | | instructions. Summary: Presently, InstCombiner::foldICmpWithCastAndCast() implicitly assumes that it is only invoked with icmp instructions of integer type. If that assumption is broken, and it is called with an icmp of vector type, then it fails (asserts/crashes). This patch addresses the deficiency. It allows it to simplify icmp (ptrtoint x), (ptrtoint/c) of vector type into a compare of the inputs, much as is done when the type is integer. Reviewers: apilipenko, fedor.sergeev, mkazantsev, anna Reviewed By: anna Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44063 llvm-svn: 326730
* [InstCombine] Add constant vector support to getMinimumFPType for visitFPTrunc.Craig Topper2018-03-051-8/+19
| | | | | | | | This patch teaches getMinimumFPType to support shrinking a vector of ConstantFPs. This should improve our ability to combine vector fptrunc with fp binops. Differential Revision: https://reviews.llvm.org/D43774 llvm-svn: 326729
* [IPSCCP] Add getCompare which returns either true, false, undef or null.Florian Hahn2018-03-051-0/+26
| | | | | | | | | | | | | | | getCompare returns true, false or undef constants if the comparison can be evaluated, or nullptr if it cannot. This is in line with what ConstantExpr::getCompare returns. It also allows us to use ConstantExpr::getCompare for comparing constants. Reviewers: davide, mssimpso, dberlin, anna Reviewed By: davide Differential Revision: https://reviews.llvm.org/D43761 llvm-svn: 326720
* [MergeICmp] We can discard initial blocks that do other workXin Tong2018-03-051-0/+64
| | | | | | | | | | | | | | | | Summary: We can discard initial blocks that do other work We do not need to limit ourselves to just the first block in the chain. Reviewers: courbet, davide Reviewed By: courbet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44029 llvm-svn: 326698
* [CallSiteSplitting] properly split musttail callsFedor Indutny2018-03-031-0/+75
| | | | | | | | | | | | | | | | | | | | Summary: `musttail` calls can't be naively splitted. The split blocks must include not only the call instruction itself, but also (optional) `bitcast` and `return` instructions that follow it. Clone `bitcast` and `ret`, place them into the split blocks, and remove the tail block when done. Reviewers: junbuml, mcrosier, davidxl, davide, fhahn Reviewed By: fhahn Subscribers: JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D43729 llvm-svn: 326666
* [InstCombine] add test for vectors with undef elts; NFCSanjay Patel2018-03-031-1/+14
| | | | llvm-svn: 326661
* [InstCombine] (~X) - (~Y) --> Y - XSanjay Patel2018-03-031-4/+2
| | | | llvm-svn: 326660
* [InstCombine] add tests for notnotsub; NFCSanjay Patel2018-03-031-0/+36
| | | | | | | As shown in D44043, we may need this fold in the backend, but it's also missing in the IR optimizer. llvm-svn: 326659
* [ThinLTO] Revert r325320: Import global variablesChandler Carruth2018-03-022-12/+3
| | | | | | | | | | | | | | This caused some links to fail with ThinLTO due to missing symbols as well as causing some binaries to have failures at runtime. We're working with the author to get a test case, but want to get the tree green again. Further, it appears to introduce a data race. While the test usage of threads was disabled in r325361 & r325362, that isn't an acceptable fix. I've reverted both of these as well. This code needs to be thread safe. Test cases for this are already on the original commit thread. llvm-svn: 326638
* [InstCombine] partly fix FMF for fmul+log2 foldSanjay Patel2018-03-021-6/+6
| | | | | | | | | | The code was checking that all of the instructions in the sequence are 'fast', but that's not necessary. The final multiply is all that we need to check (tests adjusted). The fmul doesn't need to be fully 'fast' either, but that can be another patch. llvm-svn: 326608
* [InstCombine] add tests for rL169025; NFCSanjay Patel2018-03-021-0/+32
| | | | | | | | This narrow fold was added with no motivation or test cases a bit over 5 years ago. Removing a constant operand is a good canonicalization? We should handle Y*2.0 too then? llvm-svn: 326606
* [InstCombine] Allow fptrunc (fpext X)) to be reduced to a single fpext/ftruncCraig Topper2018-03-022-18/+9
| | | | | | | | | | If we are only truncating bits from the extend we should be able to just use a smaller extend. If we are truncating more than the extend we should be able to just use a fptrunc since the presense of the fpextend shouldn't affect rounding. Differential Revision: https://reviews.llvm.org/D43970 llvm-svn: 326595
* LoopUnroll: respect pragma unroll when AllowRemainder is disabledYaxun Liu2018-03-022-26/+133
| | | | | | | | | | | | | Currently when AllowRemainder is disabled, pragma unroll count is not respected even though there is no remainder. This bug causes a loop fully unrolled in many cases even though the user specifies a unroll count. Especially it affects OpenCL/CUDA since in many cases a loop contains convergent instructions and currently AllowRemainder is disabled for such loops. Differential Revision: https://reviews.llvm.org/D43826 llvm-svn: 326585
* [MergeICmps] Revert accidentally submitted failing test case.Clement Courbet2018-03-021-160/+0
| | | | | | Reverts r326574. llvm-svn: 326582
* [MergeIcmps] Add the test case from PR36557.Clement Courbet2018-03-021-0/+160
| | | | | | | | | | Summary: See PR36557. Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44009 llvm-svn: 326574
* [InstCombine] Add more test case to fpextend.ll.Craig Topper2018-03-021-0/+186
| | | | | | This includes the test cases from D43970 and additional tests for combining (fptrunc (binop (fpext), (fpext))) where the pre-extended types don't match the trunc and therefore can't be completely removed. llvm-svn: 326528
* [ArgumentPromotion] don't break musttail invariant PR36543Fedor Indutny2018-03-021-0/+45
| | | | | | | | | | | | | | | | Summary: Do not break musttail invariant by promoting arguments of musttail callee or caller. Reviewers: sanjoy, dberlin, hfinkel, george.burgess.iv, fhahn, rnk Reviewed By: rnk Subscribers: rnk, llvm-commits Differential Revision: https://reviews.llvm.org/D43926 llvm-svn: 326521
* [InstCombine] Simplify test cases by removing loads/stores that aren't ↵Craig Topper2018-03-021-72/+40
| | | | | | | | required for what is being tested. The loads and stores were getting the data and storing the results. There's no reason we can't just use function arguments and return. llvm-svn: 326515
* [InstCombine] allow fmul fold with less than 'fast'Sanjay Patel2018-03-022-13/+14
| | | | | | | | | | | | | | | | | | This is a retry of r326502 with updates to the reassociate test file that I missed the first time. @test15_reassoc in the supposed -reassociate test file (except that it tests 2 other passes too...) shows that there's no clear responsiblity for reassociation transforms. Instcombine now gets that case, but only because the constant values are identical. Otherwise, it would still miss that pattern. Reassociate doesn't get that case because it hasn't been updated to use less than 'fast' FMF. llvm-svn: 326513
* [Reassociate] regenerate checks; NFCSanjay Patel2018-03-011-61/+62
| | | | llvm-svn: 326511
* revert r326502: [InstCombine] allow fmul fold with less than 'fast'Sanjay Patel2018-03-011-13/+11
| | | | | | | | I forgot that I added tests for 'reassoc' to -reassociate, but suprisingly that file calls -instcombine too, so it is affected. I'll update that file and try again. llvm-svn: 326510
* [InstCombine] allow fmul fold with less than 'fast'Sanjay Patel2018-03-011-11/+13
| | | | llvm-svn: 326502
* [InstCombine] Auto-generate complete checks. NFCCraig Topper2018-03-011-141/+246
| | | | llvm-svn: 326474
OpenPOWER on IntegriCloud