summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* [ConstantFolding] Fold bitcasts of vectors w/ undef elementsDavid Majnemer2016-07-291-2/+11
| | | | | | | | An undef vector element can be treated as if it had any value. Folding such a vector element to 0 in a bitcast can open up further folding opportunities. llvm-svn: 277104
* [ConstantFolding] Remove an unused ConstantFoldInstOperands overloadDavid Majnemer2016-07-291-14/+5
| | | | | | No functional change is intended. llvm-svn: 277101
* [ConstantFolding] Use ConstantExpr::getWithOperandsDavid Majnemer2016-07-291-0/+3
| | | | | | | | | ConstantExpr::getWithOperands does much of the hard work that ConstantFoldInstOperandsImpl tries to do but more completely. This lets us fold ExtractValue/InsertValue expressions. llvm-svn: 277100
* [ConstnatFolding] Teach the folder how to fold ConstantVectorDavid Majnemer2016-07-292-60/+63
| | | | | | | | | | | A ConstantVector can have ConstantExpr operands and vice versa. However, the folder had no ability to fold ConstantVectors which, in some cases, was an optimization barrier. Instead, rephrase the folder in terms of Constants instead of ConstantExprs and teach callers how to deal with failure. llvm-svn: 277099
* [CFLAA] Check for pointer types in more places.George Burgess IV2016-07-291-2/+4
| | | | | | | | | | | | | | This patch fixes an assertion that fires when we try to add non-pointer Values to the CFLGraph. Centralizing the check for whether something is/isn't a pointer type isn't completely trivial (and, in some cases, would end up being entirely redundant), but it may be beneficial to do so if this trips us up more in the future. Patch by Jia Chen. Differential Revision: https://reviews.llvm.org/D22947 llvm-svn: 277096
* [BPI] Add new LazyBPI analysisAdam Nemet2016-07-284-8/+72
| | | | | | | | | | | | | | | | | | | | | | Summary: The motivation is the same as in D22141: In order to add the hotness attribute to optimization remarks we need BFI to be available in all passes that emit optimization remarks. BFI depends on BPI so unless we make this lazy as well we would still compute BPI unconditionally. The solution is to use the new LazyBPI pass in LazyBFI and only compute BPI when computation of BFI is requested by the client. I extended the laziness test using a LoopDistribute test to also cover BPI. Reviewers: hfinkel, davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22835 llvm-svn: 277083
* [ConstantFolding] Don't bail on folding if ConstantFoldConstantExpression failsDavid Majnemer2016-07-281-19/+23
| | | | | | | | | | | | When folding an expression, we run ConstantFoldConstantExpression on each operand of that expression. However, ConstantFoldConstantExpression can fail and retur nullptr. Previously, we would bail on further refining the expression. Instead, use the original operand and see if we can refine a later operand. llvm-svn: 276959
* [CFLAA] Add getModRefBehavior to CFLAnders.George Burgess IV2016-07-272-8/+124
| | | | | | | | | | | This patch lets CFLAnders respond to mod-ref queries. It also includes a small bugfix to CFLSteens. Patch by Jia Chen. Differential Revision: https://reviews.llvm.org/D22823 llvm-svn: 276939
* [LVI] Use DenseMap::find_as in LazyValueInfo.Justin Lebar2016-07-271-15/+29
| | | | | | | | | | | | | | | | | | | | | | Summary: This lets us avoid creating and destroying a CallbackVH every time we check the cache. This is good for a 2% e2e speedup when compiling one of the large Eigen tests at -O3. FTR, I tried making the ValueCache hashtable one-level -- i.e., mapping a pair (Value*, BasicBlock*) to a lattice value, and that didn't seem to provide any additional improvement. Saving a word in LVILatticeVal by merging the Tag and Val fields also didn't yield a speedup. Reviewers: reames Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21951 llvm-svn: 276926
* test commitMatt Masten2016-07-271-0/+1
| | | | llvm-svn: 276911
* add a verbose mode to Loop->print() to print all the basic blocks of a loopSebastian Pop2016-07-271-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D22817 llvm-svn: 276838
* [ConstantFolding] Correctly handle failures in ↵David Majnemer2016-07-271-4/+13
| | | | | | | | | | | ConstantFoldConstantExpressionImpl Failures in ConstantFoldConstantExpressionImpl were ignored causing crashes down the line. This fixes PR28725. llvm-svn: 276827
* Reverting r276771 due to MSan failures.Andrew Kaylor2016-07-271-1/+0
| | | | llvm-svn: 276824
* Revert r276136 "Use ValueOffsetPair to enhance value reuse during SCEV ↵Hans Wennborg2016-07-262-80/+33
| | | | | | | | | | expansion." It causes Clang tests to fail after Windows self-host (PR28705). (Also reverts follow-up r276139.) llvm-svn: 276822
* [InstSimplify] Cast folding can be made more genericDavid Majnemer2016-07-261-46/+43
| | | | | | Use isEliminableCastPair to determine if a pair of casts are foldable. llvm-svn: 276777
* Re-committing r275284: add support to inline __builtin_mempcpyAndrew Kaylor2016-07-261-0/+1
| | | | | | | | Patch by Sunita Marathe Differential Revision: http://reviews.llvm.org/D21920 llvm-svn: 276771
* Reapply: [InstSimplify] Add support for bitcasts"David Majnemer2016-07-261-0/+29
| | | | | | | This reverts commit r276700 and reapplies r276698. The relevant clang tests have been updated. llvm-svn: 276727
* Revert "[InstSimplify] Add support for bitcasts"David Majnemer2016-07-251-29/+0
| | | | | | | This reverts commit r276698. Clang has tests which rely on the optimizer :( llvm-svn: 276700
* [InstSimplify] Add support for bitcastsDavid Majnemer2016-07-251-0/+29
| | | | | | | BitCasts of BitCasts can be folded away as can BitCasts which don't change the type of the operand. llvm-svn: 276698
* [InstSimplify] Fold trunc([zs]ext(%V)) -> %VDavid Majnemer2016-07-251-1/+7
| | | | | | Truncates can completely cancel out a zext or sext instruction. llvm-svn: 276604
* Trailing whitespace.NAKAMURA Takumi2016-07-251-4/+4
| | | | llvm-svn: 276596
* Avoid using a raw AssumptionCacheTracker in various inliner functions.Sean Silva2016-07-231-29/+29
| | | | | | | | | | This unblocks the new PM part of River's patch in https://reviews.llvm.org/D22706 Conveniently, this same change was needed for D21921 and so these changes are just spun out from there. llvm-svn: 276515
* [LoopUnrollAnalyzer] Handle out of bounds accesses in visitLoadDavid Majnemer2016-07-231-4/+10
| | | | | | | | | | | | While we handed loads past the end of an array, we didn't handle loads _before_ the array. This fixes PR28062. N.B. While the bug in the code is obvious, I am struggling to craft a test case which is reasonable in size. llvm-svn: 276510
* [SCEV] Make isImpliedCondOperandsViaRanges smarterSanjoy Das2016-07-231-11/+1
| | | | | | | | | | | | This change lets us prove things like "{X,+,10} s< 5000" implies "{X+7,+,10} does not sign overflow" It does this by replacing replacing getConstantDifference by computeConstantDifference (which is smarter) in isImpliedCondOperandsViaRanges. llvm-svn: 276505
* [SCEV] Change the interface of computeConstantDifference; NFCSanjoy Das2016-07-231-24/+17
| | | | | | | This is in preparation of s/getConstantDifference/computeConstantDifference/ in a later change. llvm-svn: 276503
* [CFLAA] Add more offset-sensitivity tracking.George Burgess IV2016-07-225-43/+162
| | | | | | | | | | | | | | | | | | | This patch teaches FunctionInfo about offsets. Like the last patch, this one doesn't introduce any visible functionality change (the core algorithm knows nothing about offsets; they're just plumbed through). Tests will come when we start acting differently because of the offsets. Patch by Jia Chen. (N.B. I made a tiny change to Jia's patch to avoid warnings by GCC: I put DenseMapInfo specializations in the `llvm` namespace. Only realized that those appeared when compiling locally. :) ) Differential Revision: https://reviews.llvm.org/D22634 llvm-svn: 276486
* [SCEV] Extract out a helper function; NFCSanjoy Das2016-07-221-7/+14
| | | | | | | The helper will get smarter in a later change, but right now this is just code reorganization. llvm-svn: 276467
* Use INT64_MAX instead of LLONG_MAXReid Kleckner2016-07-221-1/+1
| | | | llvm-svn: 276419
* [InstSimplify] don't crash handling a pointer or aggregate typeSanjay Patel2016-07-211-0/+3
| | | | llvm-svn: 276345
* [InstSimplify] recognize trunc + icmp sgt/slt variants of select ↵Sanjay Patel2016-07-211-7/+33
| | | | | | | | | | | | | | | | | | simplifications (PR28466) rL245171 exposed a hole in InstSimplify that manifested in a strange way in PR28466: https://llvm.org/bugs/show_bug.cgi?id=28466 It's possible to use trunc + icmp sgt/slt in place of an and + icmp eq/ne, so we need to recognize that pattern to eliminate selects that are choosing between some value and some bitmasked version of that value. Note that there is significant room for improvement (refactoring) and enhancement (more patterns, possibly in InstCombine rather than here). Differential Revision: https://reviews.llvm.org/D22537 llvm-svn: 276341
* Fix the clang-cl self-host with VS 2013 headersReid Kleckner2016-07-211-2/+1
| | | | | | | | std::numeric_limits<int64_t>::max() is not constexpr in VC 2013 headers, and Clang complains that it isn't. MSVC 2013 itself is emitting a dynamic initializer for this thing. Instead, use an enum. llvm-svn: 276334
* Normalize file docs. NFC.George Burgess IV2016-07-211-1/+1
| | | | | | | | Having the added `\brief` made doxygen interpret it as the summary for the `llvm` namespace (visible at: http://llvm.org/doxygen/namespaces.html). llvm-svn: 276331
* [DemandedBits] Reduce number of duplicated DenseMap lookups.Benjamin Kramer2016-07-211-5/+4
| | | | | | No functionality change intended. llvm-svn: 276278
* [OptDiag] Missed these when making the IR Value a const pointerAdam Nemet2016-07-211-2/+4
| | | | llvm-svn: 276224
* [OptDiag,LV] Add hotness attribute to applied-optimization remarksAdam Nemet2016-07-211-0/+15
| | | | | | | Test coverage is provided by modifying the function in the FP-math testcase that we are allowed to vectorize. llvm-svn: 276223
* [OptDiag,LV] Add hotness attribute to the derived analysis remarksAdam Nemet2016-07-201-0/+20
| | | | | | | | This includes FPCompute and Aliasing. Testcase is based on no_fpmath.ll. llvm-svn: 276211
* [InstSimplify][InstCombine] don't crash when folding vector selects of icmpSanjay Patel2016-07-201-1/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D22602 llvm-svn: 276209
* [CFLAA] Add offset tracking in CFLGraph.George Burgess IV2016-07-201-13/+122
| | | | | | | | | | | | | | | | (Also, refactor our constexpr handling to be less insane). This patch lets us track field offsets in the CFL Graph, which is the first step to making CFLAA field/offset sensitive. Woohoo! Note that this patch shouldn't visibly change our behavior (since we make no use of the offsets we're now tracking), so we can't quite add tests for this yet. Patch by Jia Chen. Differential Revision: https://reviews.llvm.org/D22598 llvm-svn: 276201
* [OptDiag,LV] Add hotness attribute to analysis remarksAdam Nemet2016-07-202-7/+22
| | | | | | | | The earlier change added hotness attribute to missed-optimization remarks. This follows up with the analysis remarks (the ones explaining the reason for the missed optimization). llvm-svn: 276192
* [OptDiag] Take the IR Value as a const pointerAdam Nemet2016-07-201-2/+3
| | | | | | | | This helps because LoopAccessReport is passed around as a const reference and we derive the basic block passed as the Value parameter from the instruction in LoopAccessReport. llvm-svn: 276191
* [OptDiag] Wrap a long lineAdam Nemet2016-07-201-1/+2
| | | | llvm-svn: 276190
* Use ValueOffsetPair to enhance value reuse during SCEV expansion.Wei Mi2016-07-202-33/+80
| | | | | | | | | | | | | | | | | | | | | | | In D12090, the ExprValueMap was added to reuse existing value during SCEV expansion. However, const folding and sext/zext distribution can make the reuse still difficult. A simplified case is: suppose we know S1 expands to V1 in ExprValueMap, and S1 = S2 + C_a S3 = S2 + C_b where C_a and C_b are different SCEVConstants. Then we'd like to expand S3 as V1 - C_a + C_b instead of expanding S2 literally. It is helpful when S2 is a complex SCEV expr and S2 has no entry in ExprValueMap, which is usually caused by the fact that S3 is generated from S1 after const folding. In order to do that, we represent ExprValueMap as a mapping from SCEV to ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} into the ExprValueMap when we create SCEV for V1. When S3 is expanded, it will first expand S2 to V1 - C_a because of S2->{V1, C_a} in the map, then expand S3 to V1 - C_a + C_b. Differential Revision: https://reviews.llvm.org/D21313 llvm-svn: 276136
* [PM] Port LoopUnroll.Sean Silva2016-07-191-0/+7
| | | | | | | | | We just set PreserveLCSSA to always true since we don't have an analogous method `mustPreserveAnalysisID(LCSSA)`. Also port LoopInfo verifier pass to test LoopUnrollPass. llvm-svn: 276063
* Attempt to appease MSVC buildbots.George Burgess IV2016-07-191-8/+10
| | | | | | Broken by r276026. llvm-svn: 276032
* [CFLAA] Add some interproc. analysis to CFLAnders.George Burgess IV2016-07-192-8/+188
| | | | | | | | | | | This patch adds function summary support to CFLAnders. It also comes with a lot of tests! Woohoo! Patch by Jia Chen. Differential Revision: https://reviews.llvm.org/D22450 llvm-svn: 276026
* [CFLAA] Teach CFLAnders to distinguish reads from writes.George Burgess IV2016-07-191-50/+95
| | | | | | | | | | | | | | | | | | | | | | | This patch adds more specific edges to CFLAndersAliasAnalysis. The goal of these edges is to give us more information about *how* two values that MayAlias alias. With this, we can now tell cases like a = b; // ergo, a may alias b apart from a = c; b = c; // so, a may alias b, but only because they were both assigned to c. ...And others. Patch by Jia Chen. Differential Revision: https://reviews.llvm.org/D22429 llvm-svn: 276023
* [RegionPass] Some minor cleanupsDavid Majnemer2016-07-191-4/+2
| | | | | | No functional change is intended. llvm-svn: 276000
* [LoopPass] Some minor cleanupsDavid Majnemer2016-07-191-7/+5
| | | | | | No functional change is intended. llvm-svn: 275999
* [X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using ↵Simon Pilgrim2016-07-191-9/+10
| | | | | | | | | | | | | | | | | | generic IR D20859 and D20860 attempted to replace the SSE (V)CVTTPS2DQ and VCVTTPD2DQ truncating conversions with generic IR instead. It turns out that the behaviour of these intrinsics is different enough from generic IR that this will cause problems, INF/NAN/out of range values are guaranteed to result in a 0x80000000 value - which plays havoc with constant folding which converts them to either zero or UNDEF. This is also an issue with the scalar implementations (which were already generic IR and what I was trying to match). This patch changes both scalar and packed versions back to using x86-specific builtins. It also deals with the other scalar conversion cases that are runtime rounding mode dependent and can have similar issues with constant folding. A companion clang patch is at D22105 Differential Revision: https://reviews.llvm.org/D22106 llvm-svn: 275981
* refactor SimplifySelectInst; NFCISanjay Patel2016-07-181-97/+115
| | | | llvm-svn: 275911
OpenPOWER on IntegriCloud