summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* [LIR] Strengthen the check for recurrence variable in popcnt/CTLZ.Davide Italiano2017-05-231-0/+35
| | | | | | | Fixes PR33114. Differential Revision: https://reviews.llvm.org/D33420 llvm-svn: 303700
* [InstSimplify] Add more tests for undef inputs and multiplying by 0 for the ↵Craig Topper2017-05-231-0/+92
| | | | | | add/sub/mul with overflow intrinsics. NFC llvm-svn: 303671
* [InstSimplify] auto-generate test checks. NFCCraig Topper2017-05-231-33/+80
| | | | llvm-svn: 303664
* [InstCombine] auto-generate test checks; NFCSanjay Patel2017-05-231-19/+18
| | | | llvm-svn: 303663
* [InstCombine] allow icmp-xor folds for vectors (PR33138)Sanjay Patel2017-05-231-12/+4
| | | | | | | | | This fixes the first part of: https://bugs.llvm.org/show_bug.cgi?id=33138 More work is needed for the bitcasted variant. llvm-svn: 303660
* [InstCombine] Use update_test_checks to regenerate the ctpop test. NFCCraig Topper2017-05-231-9/+18
| | | | llvm-svn: 303659
* [InstCombine] add icmp-xor tests to show vector neglect; NFCSanjay Patel2017-05-232-87/+197
| | | | | | | | | | Also, rename the tests and the file, add comments, and add more tests because there are no existing tests for some of these folds. These patterns are particularly important for crippled vector ISAs that have limited compare predicates (PR33138). llvm-svn: 303652
* [JumpThreading] Safely replace uses of conditionAnna Thomas2017-05-233-52/+184
| | | | | | | | | | | | | | | | | | | | | | This patch builds over https://reviews.llvm.org/rL303349 and replaces the use of the condition only if it is safe to do so. We should not blindly RAUW the condition if experimental.guard or assume is a use of that condition. This is because LVI may have used the guard/assume to identify the value of the condition, and RUAWing will fold the guard/assume and uses before the guards/assumes. Reviewers: sanjoy, reames, trentxintong, mkazantsev Reviewed by: sanjoy, reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33257 llvm-svn: 303633
* [LV] Report multiple reasons for not vectorizing under allowExtraAnalysisAyal Zaks2017-05-231-16/+108
| | | | | | | | | | | | | | | | | | | | The default behavior of -Rpass-analysis=loop-vectorizer is to report only the first reason encountered for not vectorizing, if one is found, at which time the vectorizer aborts its handling of the loop. This patch allows multiple reasons for not vectorizing to be identified and reported, at the potential expense of additional compile-time, under allowExtraAnalysis which can currently be turned on by Clang's -fsave-optimization-record and opt's -pass-remarks-missed. Removed from LoopVectorizationLegality::canVectorize() the redundant checking and reporting if we CantComputeNumberOfIterations, as LAI::canAnalyzeLoop() also does that. This redundancy is caught by a lit test once multiple reasons are reported. Patch initially developed by Dror Barak. Differential Revision: https://reviews.llvm.org/D33396 llvm-svn: 303613
* InstructionSimplify: don't speculate about Constants changing.Tim Northover2017-05-221-0/+39
| | | | | | | | | | When presented with an icmp/select pair, we can end up asking what would happen if we replaced one constant with another in an instruction. This is a mistake, while non-constant Values could become a constant, constants cannot change and trying to do so can lead to completely invalid IR (a GEP referencing a non-existant field in the original case). llvm-svn: 303580
* Fix update VP metadata after inlining for instrumentation PGOTeresa Johnson2017-05-222-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With instrumentation profiling, when updating the VP metadata after an inline, VP metadata on the inlined copy was inadvertantly having all counts zeroed out. This was causing indirect calls from code inlined during the call step to be marked as cold in the ThinLTO summaries and not imported. The CallerBFI needs to be passed down so that the CallSiteCount can be computed from the profile summary info. With Sample PGO this was working since the count is extracted from the branch weight metadata on the call being inlined (even before we stopped looking at metadata for non-sample PGO in r302844 this largely wasn't working for instrumentation PGO since only promoted indirect calls would be getting inlined and have the metadata). Added an instrumentation PGO test and renamed the sample PGO test. Reviewers: danielcdh, eraman Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D33389 llvm-svn: 303574
* NewGVN: Fix PR 33116, the memoryphi version of bug 32838.Daniel Berlin2017-05-211-0/+39
| | | | llvm-svn: 303521
* [NewGVN] Actually check the NewGVN output.Davide Italiano2017-05-211-0/+30
| | | | | | Apparently I messed up squashing two consecutive commits. llvm-svn: 303516
* [NewGVN] Add a test for non most dominating leader.Davide Italiano2017-05-211-0/+34
| | | | | | | | Taken from PR32845. Dan removed the most dominating leader check in r303443, but we check this test anyway to make sure things don't regress. llvm-svn: 303515
* [InstCombine] Take in account the size in sext->lshr->trunc patterns.Davide Italiano2017-05-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we end up miscompiling, transforming: define i8 @tinky() { %sext = sext i1 1 to i16 %hibit = lshr i16 %sext, 15 %tr = trunc i16 %hibit to i8 ret i8 %tr } into: %sext = sext i1 1 to i8 ret i8 %sext and the first get folded to ret i8 1, while the second gets folded to ret i8 -1. Eventually we should get rid of this transform entirely, but for now, this at least fixes a know correctness bug. Differential Revision: https://reviews.llvm.org/D33338 llvm-svn: 303513
* [InstCombine] add tests for potential (lshr(sext X), C) folds; NFCSanjay Patel2017-05-211-0/+72
| | | | | | | | | As discussed in: https://reviews.llvm.org/D33338 ...we may be able to remove a wider pattern match by doing these more basic canonicalizations. llvm-svn: 303504
* Revert "Add pthread_self function prototype and make it speculatable."Xin Tong2017-05-211-38/+0
| | | | | | | | This reverts commit 143d7445b5dfa2f6d6c45bdbe0433d9fc531be21. Build breaking llvm-svn: 303496
* Add pthread_self function prototype and make it speculatable.Xin Tong2017-05-201-0/+38
| | | | | | | | | | | | | | Summary: This allows pthread_self to be pulled out of a loop by LICM. Reviewers: hfinkel, arsenm, davide Reviewed By: davide Subscribers: davide, wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D32782 llvm-svn: 303495
* [NewGVN] Create a StoreExpression instead of a VariableExpression.Davide Italiano2017-05-201-0/+26
| | | | | | | | | | | | | In the case where we have an operand defined by a lod of the same memory location. Historically this was a VariableExpression because we wanted to make sure they ended up in the same class, but if we create the right expression, they end up in the same class anyway. Fixes PR32897. Thanks to Dan for the detailed discussion and the fix suggestion. llvm-svn: 303475
* SimplifyLibCalls: Optimize wcslenMatthias Braun2017-05-194-0/+415
| | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the strlen optimization code to work for both strlen and wcslen. This especially helps with programs in the wild where people pass L"string"s to const std::wstring& function parameters and the wstring constructor gets inlined. This also fixes a lingerind API problem/bug in getConstantStringInfo() where zeroinitializers would always give you an empty string (without a length) back regardless of the actual length of the initializer which did not work well in the TrimAtNul==false causing the PR mentioned below. Note that the fixed getConstantStringInfo() needed fixes to SelectionDAG memcpy lowering and may lead to some cases for out-of-bounds zeroinitializer accesses not getting optimized anymore. So some code with UB may produce out of bound memory reads now instead of just producing zeros. The refactoring "accidentally" fixes http://llvm.org/PR32124 Differential Revision: https://reviews.llvm.org/D32839 llvm-svn: 303461
* [safestack] Disable stack coloring by default.Evgeniy Stepanov2017-05-194-6/+6
| | | | | | Workaround for apparent miscompilation of PR32143. llvm-svn: 303456
* NewGVN: Fix PR32838.Daniel Berlin2017-05-191-0/+157
| | | | | | | | | | This is a complicated bug involving two issues: 1. What do we do with phi nodes when we prove all arguments are not live? 2. When is it safe to use value leaders to determine if we can ignore an argumnet? llvm-svn: 303453
* [InstCombine] *Actually* commit the test showing the miscompile.Davide Italiano2017-05-191-1/+13
| | | | | | Clarify a comment while I'm here. llvm-svn: 303447
* [InstCombine] Add tests to demonstrate the miscompile in PR33078.Davide Italiano2017-05-191-0/+39
| | | | llvm-svn: 303445
* Last of the major pieces to NewGVN - yay!Daniel Berlin2017-05-192-10/+425
| | | | | | | | | | | | | | | | | | | | | | Summary: NewGVN: Handle equivalence between phi of ops and op of phis. This makes our GVN mostly-complete. It would be complete, modulo some deliberate choices we make. This means it detects roughly all herband equivalences in polynomial time, including cases notoriously hard for other GVN's to detect. It also detects a very large swath of the cases we currently rely on instcombine to detect that involve folding upwards through phis. Fixes PR 31125, 31463, PR 31868 Reviewers: davide Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D32151 llvm-svn: 303444
* [NewGVN] Delete the old store when we find congruent to a load.Davide Italiano2017-05-191-0/+59
| | | | | | | (or non-store, more in general). Fixes PR33086. Caught by the store verifier. llvm-svn: 303406
* [NewGVN] Break infinite recursion in singleReachablePHIPath().Davide Italiano2017-05-181-0/+54
| | | | | | | | | | | | We can have cycles between PHIs and this causes singleReachablePhi() to call itself indefintely (until we run out of stack). The proper solution would be that of computing SCCs, but it's not worth for now, so just keep a visited set and give up when we find a cycle. Thanks to Dan for the discussion/help with this. Fixes PR33014. llvm-svn: 303393
* [InstCombine] add more tests for xor-of-icmps; NFCSanjay Patel2017-05-181-0/+30
| | | | llvm-svn: 303387
* [NewGVN] Replace predicate info leftovers.Davide Italiano2017-05-181-0/+24
| | | | | | | This time with an additional fix, i.e. we remove the dead @llvm.ssa.copy instruction. llvm-svn: 303385
* [InstSimplify] Make m_Not work for xor -1, XCraig Topper2017-05-181-0/+8
| | | | | | | | Currently m_Not only works the canonical xor X, -1 form that InstCombine produces. InstSimplify can't rely on this canonicalization. Differential Revision: https://reviews.llvm.org/D33331 llvm-svn: 303379
* [InstSimplify] Add test cases for missing fold (A & B) | ~(A ^ B) -> ~(A ^ B).Craig Topper2017-05-181-0/+68
| | | | llvm-svn: 303367
* [InstCombine] move test and use better checks; NFCSanjay Patel2017-05-182-10/+17
| | | | | | Previously, this test was checking for 'or i1', but that was actually matched by 'xor i1'. llvm-svn: 303364
* [LSR] Call canonicalize after we generate a new Formula in ↵Wei Mi2017-05-181-0/+36
| | | | | | | | | | | | | | GenerateTruncates. Fix PR33077. The testcase in PR33077 generates a LSR Use Formula with two SCEVAddRecExprs for the same loop. Such uncommon formula will become non-canonical after GenerateTruncates adds sign extension to the ScaledReg of the Formula, and it will break the assertion that every Formula to be inserted is canonical. The fix is to call canonicalize for the raw Formula generated by GenerateTruncates before inserting it. llvm-svn: 303361
* [JumpThreading] Dont RAUW condition incorrectlyAnna Thomas2017-05-183-2/+140
| | | | | | | | | | | | | | | | | | | Summary: We have a bug when RAUWing the condition if experimental.guard or assumes is a use of that condition. This is because LazyValueInfo may have used the guards/assumes to identify the value of the condition at the end of the block. RAUW replaces the uses at the guard/assume as well as uses before the guard/assume. Both of these are incorrect. For now, disable RAUW for conditions and fix the logic as a next step: https://reviews.llvm.org/D33257 Reviewers: sanjoy, reames, trentxintong Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33279 llvm-svn: 303349
* Update three tests I missed in r302979 and r302990Justin Bogner2017-05-183-0/+2
| | | | llvm-svn: 303319
* [InstCombine] add test for xor-of-icmps; NFCSanjay Patel2017-05-171-2/+15
| | | | | | This is another form of the problem discussed in D32143. llvm-svn: 303315
* [InstCombine] handle icmp i1 X, C early to avoid creating an unknown patternSanjay Patel2017-05-171-4/+2
| | | | | | | | | | | The missing optimization for xor-of-icmps still needs to be added, but by being more efficient (not generating unnecessary logic ops with constants) we avoid the bug. See discussion in post-commit comments: https://reviews.llvm.org/D32143 llvm-svn: 303312
* [InstCombine] add test for missing icmp bool fold; NFCSanjay Patel2017-05-171-10/+26
| | | | llvm-svn: 303310
* [InstSimplify] handle all icmp i1 X, C in one place; NFCISanjay Patel2017-05-171-0/+171
| | | | | | | | | | | | | | We already handled all of the new tests identically, but several of those went through a lot of unnecessary processing before getting folded. Another motivation for grouping these cases together is that InstCombine needs a similar fold. Currently, it handles the 'not' cases inefficiently which can lead to bugs as described in the post-commit comments of: https://reviews.llvm.org/D32143 llvm-svn: 303295
* [InstCombine] add isCanonicalPredicate() helper function and use it; NFCISanjay Patel2017-05-171-13/+429
| | | | | | | | | | | | | | | | | | | | There should be a slight efficiency improvement from handling icmp/fcmp with one matcher and reducing duplicated code. The larger motivation is that there are questions about how predicate canonicalization is handled, and the refactoring should make it easier if we want to change any of that behavior. 1. As noted in the code comment, we've chosen 3 of the 16 FCMP preds as not canonical. Why those 3? It goes back to rL32751 from what I can tell, but I'm not sure if there's a justification for that rule. 2. We currently do not canonicalize integer select conditions. Should we use the same rule that applies to branches for selects? 3. We currently do canonicalize some FP select conditions, and those rules would conflict with the rule shown here. Should one or both be changed? No-functional-change-intended, but adding tests anyway because there's no coverage for most of the predicates. Differential Revision: https://reviews.llvm.org/D33247 llvm-svn: 303261
* [coroutines] Handle spills before catchswitchGor Nishanov2017-05-171-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | If we need to spill the result of the PHI instruction, we insert the spill after all of the PHIs and EHPads, however, in a catchswitch block there is no room to insert the spill. Make room by splitting away catchswitch into a separate block. Before the fix: catch.dispatch: %val = phi i32 [ 1, %if.then ], [ 2, %if.else ] %switch = catchswitch within none [label %catch] unwind label %cleanuppad After: catch.dispatch: %val = phi i32 [ 1, %if.then ], [ 2, %if.else ] %tok = cleanuppad within none [] ; spill goes here cleanupret from %tok unwind label %catch.dispatch.switch catch.dispatch.switch: %switch = catchswitch within none [label %catch] unwind label %cleanuppad https://reviews.llvm.org/D31846 llvm-svn: 303232
* [NewGVN] Re-enable test now that the nondeterminism has been fixed.Davide Italiano2017-05-161-1/+0
| | | | llvm-svn: 303217
* llvm/test/Transforms/InstCombine/debuginfo-skip.ll REQUIRES +asserts.NAKAMURA Takumi2017-05-161-0/+1
| | | | llvm-svn: 303216
* [InstSimplify] add folds for constant mask of value shifted by constantSanjay Patel2017-05-161-8/+4
| | | | | | | | | | | | | | | | | We would eventually catch these via demanded bits and computing known bits in InstCombine, but I think it's better to handle the simple cases as soon as possible as a matter of efficiency. This fold allows further simplifications based on distributed ops transforms. eg: %a = lshr i8 %x, 7 %b = or i8 %a, 2 %c = and i8 %b, 1 InstSimplify can directly fold this now: %a = lshr i8 %x, 7 Differential Revision: https://reviews.llvm.org/D33221 llvm-svn: 303213
* Re-commit r302678, fixing PR33053.Amara Emerson2017-05-163-55/+67
| | | | | | | The issue was that the AArch64 TTI hook allowed unpacked integer cmp reductions which didn't have a lowering. llvm-svn: 303211
* [Inliner] Do not mix callsite and callee hotness based updates.Easwaran Raman2017-05-161-5/+5
| | | | | | | | | | Update threshold based on callee's hotness only when BFI is not available. Otherwise use only callsite's hotness. This makes it easier to reason about hotness related threshold updates. Differential revision: https://reviews.llvm.org/D33157 llvm-svn: 303210
* [InstCombine] auto-generate better checks; NFCSanjay Patel2017-05-161-40/+55
| | | | llvm-svn: 303203
* In debug builds non-trivial amount of time is spent in InstCombine processingDmitry Mikulin2017-05-161-0/+43
| | | | | | @llvm.dbg.* calls in visitCallInst(). They can be safely ignored. llvm-svn: 303202
* [InstCombine] add motivational comment for tests; NFCSanjay Patel2017-05-161-0/+5
| | | | | | | | | | | | | | | | | | | The referenced tests are derived from: https://bugs.llvm.org/show_bug.cgi?id=32791 and: https://reviews.llvm.org/D33172 The motivation for including negative tests may not be clear, so I'm adding an explanatory comment here. In the post-commit thread for r303133: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170515/453793.html ...it was mentioned that we don't want to add redundant tests. This is a valid point. But in this case, we have a patch under review (D33172) that demonstrates that no existing regression tests are affected by a proposed code change, but these are. Therefore, I think these tests have value not visible in any existing regression tests regardless of whether they show a transform. Differential Revision: https://reviews.llvm.org/D33242 llvm-svn: 303185
* Revert 303174, 303176, and 303178Matthew Simpson2017-05-161-35/+0
| | | | | | These commits are breaking the bots. Reverting to investigate. llvm-svn: 303182
OpenPOWER on IntegriCloud