summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* InstCombine rule to fold truncs whose value is availableAnna Thomas2016-07-081-16/+27
| | | | | | | | | | | | | We can fold truncs whose operand feeds from a load, if the trunc value is available through a prior load/store. This change is from: http://reviews.llvm.org/D21246, which folded the trunc but missed the bitcast or ptrtoint/inttoptr required in the RAUW call, when the load type didnt match the prior load/store type. Differential Revision: http://reviews.llvm.org/D21791 llvm-svn: 274853
* fix formatting; NFCSanjay Patel2016-07-071-16/+15
| | | | llvm-svn: 274765
* [LCG] Hoist the definitions of the stream operator friends to be inlineChandler Carruth2016-07-071-42/+0
| | | | | | | | | | | friend definitions. Based on the experiments Sean Silva and Reid did, this seems the safest course of action and also will work around a questionable warning provided by GCC6 on the old form of the code. Thanks for Davide pointing out the issue and other suggesting ways to fix. llvm-svn: 274740
* [LoopAccessAnalysis] Fix an integer overflowDavid Majnemer2016-07-071-22/+22
| | | | | | | | | We were inappropriately using 32-bit types to account for quantities that can be far larger. Fixed in PR28443. llvm-svn: 274737
* [PM] Avoid getResult on a higher level in LoopAccessAnalysisSean Silva2016-07-071-7/+15
| | | | | | | Note that require<domtree> and require<loops> aren't needed because they come in implicitly via the loop pass manager. llvm-svn: 274712
* [CFLAA] Split out more things from CFLSteens. NFC.George Burgess IV2016-07-066-196/+322
| | | | | | | | | | | "More things" = StratifiedAttrs and various bits like interprocedural summaries. Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21964 llvm-svn: 274592
* [CFLAA] Split the CFL graph out from CFLSteens. NFC.George Burgess IV2016-07-064-122/+157
| | | | | | | | Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21963 llvm-svn: 274591
* [CFLAA] Split into Anders+Steens analysis.George Burgess IV2016-07-065-57/+131
| | | | | | | | | | | | | | | | | | | | | StratifiedSets (as implemented) is very fast, but its accuracy is also limited. If we take a more aggressive andersens-like approach, we can be way more accurate, but we'll also end up being slower. So, we've decided to split CFLAA into CFLSteensAA and CFLAndersAA. Long-term, we want to end up in a place where CFLSteens is queried first; if it can provide an answer, great (since queries are basically map lookups). Otherwise, we'll fall back to CFLAnders, BasicAA, etc. This patch splits everything out so we can try to do something like that when we get a reasonable CFLAnders implementation. Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21910 llvm-svn: 274589
* Add writeonly IR attributeNicolai Haehnle2016-07-042-22/+15
| | | | | | | | | | | | | | | | | Summary: This complements the earlier addition of IntrWriteMem and IntrWriteArgMem LLVM intrinsic properties, see D18291. Also start using the attribute for memset, memcpy, and memmove intrinsics, and remove their special-casing in BasicAliasAnalysis. Reviewers: reames, joker.eph Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D18714 llvm-svn: 274485
* Reformat blank lines.NAKAMURA Takumi2016-07-041-9/+8
| | | | llvm-svn: 274481
* Reformat comment lines.NAKAMURA Takumi2016-07-041-8/+8
| | | | llvm-svn: 274480
* Untabify.NAKAMURA Takumi2016-07-042-2/+2
| | | | llvm-svn: 274479
* Reformat.NAKAMURA Takumi2016-07-041-28/+25
| | | | llvm-svn: 274478
* Remove dead TLI arg of isKnownNonNull and propagate deadness. NFC.Sean Silva2016-07-023-26/+21
| | | | | | | | | | | | | | This actually uncovered a surprisingly large chain of ultimately unused TLI args. From what I can gather, this argument is a remnant of when isKnownNonNull would look at the TLI directly. The current approach seems to be that InferFunctionAttrs runs early in the pipeline and uses TLI to annotate the TLI-dependent non-null information as return attributes. This also removes the dependence of functionattrs on TLI altogether. llvm-svn: 274455
* [PM] Port LoopAccessInfo analysis to new PMXinliang David Li2016-07-021-0/+28
| | | | | | | It is implemented as a LoopAnalysis pass as discussed and agreed upon. llvm-svn: 274452
* Use arrays or initializer lists to feed ArrayRefs instead of SmallVector ↵Benjamin Kramer2016-07-021-6/+2
| | | | | | | | where possible. No functionality change intended. llvm-svn: 274431
* [PM] refactor LoopAccessInfo code part-2Xinliang David Li2016-07-011-15/+15
| | | | | | Differential Revision: http://reviews.llvm.org/D21636 llvm-svn: 274334
* [LAA] Fix alphabetical sorting of headers. NFCAdam Nemet2016-07-011-1/+1
| | | | llvm-svn: 274302
* SLPVectorizer: Move propagateMetadata to VectorUtilsMatt Arsenault2016-06-301-0/+41
| | | | | | | | This will be re-used by the LoadStoreVectorizer. Fix handling of range metadata and testcase by Justin Lebar. llvm-svn: 274281
* [SCEV] Compute max be count from shift operator only if all else failsSanjoy Das2016-06-301-6/+9
| | | | | | | In particular, check to see if we can compute a precise trip count by exhaustively simulating the loop first. llvm-svn: 274199
* [CFLAA] Add support for ModRef queries.George Burgess IV2016-06-301-0/+71
| | | | | | | | | | | | This patch makes CFLAA answer some ModRef queries. Because we don't distinguish between reading/writing when making StratifiedSets, we're unable to offer any of the readonly-related answers. Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21858 llvm-svn: 274197
* Reverted patch 273864Elena Demikhovsky2016-06-291-4/+4
| | | | llvm-svn: 274115
* Revert "[ValueTracking] Teach computeKnownBits for PHI nodes to compute sign ↵Craig Topper2016-06-291-12/+0
| | | | | | | | bit for a recurrence with a NSW addition." This is breaking an optimizaton remark test in clang. I've identified a couple fixes for that, but want to understand it better before I commit to anything. llvm-svn: 274102
* [ValueTracking] Teach computeKnownBits for PHI nodes to compute sign bit for ↵Craig Topper2016-06-291-0/+12
| | | | | | | | | | | | a recurrence with a NSW addition. If a operation for a recurrence is an addition with no signed wrap and both input sign bits are 0, then the result sign bit must also be 0. Similar for the negative case. I found this deficiency while playing around with a loop in the x86 backend that contained a signed division that could be optimized into an unsigned division if we could prove both inputs were positive. One of them being the loop induction variable. With this patch we can perform the conversion for this case. One of the test cases here is a contrived variation of the loop I was looking at. Differential revision: http://reviews.llvm.org/D21493 llvm-svn: 274098
* Typos. NFC.Chad Rosier2016-06-281-3/+3
| | | | llvm-svn: 274038
* [BFI/MBFI]: cfg graph view with color scheme Xinliang David Li2016-06-281-2/+21
| | | | | | | | | | This patch enhances dot graph viewer to show hot regions with hot bbs/edges displayed in red. The ratio of the bb freq to the max freq of the function needs to be no less than the value specified by view-hot-freq-percent option. The default value is 10 (i.e. 10%). llvm-svn: 273996
* [BFI]: enhance BFI graph dumpXinliang David Li2016-06-281-13/+20
| | | | | | | | | MBFI supports profile count dumping and function name based filtering. Add these two feature to BFI as well. The filtering option is shared between BFI and MBFI: -view-bfi-func-name=.. llvm-svn: 273992
* [BFI]: graph viewer code refactoring Xinliang David Li2016-06-281-30/+18
| | | | | | | | | | | BFI and MBFI's dot traits class share most of the code and all future enhancement. This patch extracts common implementation into base class BFIDOTGraphTraitsBase. This patch also enables BFI graph to show branch probability on edges as MBFI does before. llvm-svn: 273990
* [PM] Improve the debugging and logging facilities of the CGSCC bits ofChandler Carruth2016-06-271-0/+53
| | | | | | | | | | | | | the new pass manager. This adds operator<< overloads for the various bits of the LazyCallGraph, dump methods for use from the debugger, and debug logging using them to the CGSCC pass manager. Having this was essential for debugging the call graph update patch, and I've extracted what I could from that patch here to minimize the delta. llvm-svn: 273961
* [CFLAA] Make MSVC happy. NFC.George Burgess IV2016-06-271-1/+3
| | | | | | | | Apparently, MSVC complains if there's an implicit conversion from `unsigned` to `unsigned long long`, if the `unsigned` is the result of a bit shift. llvm-svn: 273955
* Fix size computation of array allocation in inline cost analysisEaswaran Raman2016-06-271-3/+4
| | | | | | Differential revision: http://reviews.llvm.org/D21690 llvm-svn: 273952
* [CFLAA] Use unsigned numbers for bit-shifts.George Burgess IV2016-06-271-1/+1
| | | | | | | | | This uses `1U` instead of `1ULL` because StratifiedAttrs is a 32-bit bitset. Thanks to Hans-Bernhard Broker for bringing this up. llvm-svn: 273902
* Fixed consecutive memory access detection in Loop Vectorizer.Elena Demikhovsky2016-06-271-4/+4
| | | | | | | | | | | | | | | | It did not handle correctly cases without GEP. The following loop wasn't vectorized: for (int i=0; i<len; i++) *to++ = *from++; I use getPtrStride() to find Stride for memory access and return 0 is the Stride is not 1 or -1. Re-commit rL273257 - revision: http://reviews.llvm.org/D20789 llvm-svn: 273864
* [ConstantFolding] Fix bitcast vector of i1.Igor Breger2016-06-271-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D21735 llvm-svn: 273845
* Apply clang-tidy's modernize-loop-convert to lib/Analysis.Benjamin Kramer2016-06-2618-117/+99
| | | | | | Only minor manual fixes. No functionality change intended. llvm-svn: 273816
* [InstSimplify] Replace calls to null with undefDavid Majnemer2016-06-251-1/+2
| | | | | | | Calling null is undefined behavior, we can simplify the resulting value to undef. llvm-svn: 273777
* IR: Introduce llvm.type.checked.load intrinsic.Peter Collingbourne2016-06-251-4/+40
| | | | | | | | | | | | | | | | This intrinsic safely loads a function pointer from a virtual table pointer using type metadata. This intrinsic is used to implement control flow integrity in conjunction with virtual call optimization. The virtual call optimization pass will optimize away llvm.type.checked.load intrinsics associated with devirtualized calls, thereby removing the type check in cases where it is not needed to enforce the control flow integrity constraint. This patch also introduces the capability to copy type metadata between global variables, and teaches the virtual call optimization pass to do so. Differential Revision: http://reviews.llvm.org/D21121 llvm-svn: 273756
* Fix documentation for FindAvailableLoadedValue.Eli Friedman2016-06-241-19/+0
| | | | llvm-svn: 273734
* IR: New representation for CFI and virtual call optimization pass metadata.Peter Collingbourne2016-06-242-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bitset metadata currently used in LLVM has a few problems: 1. It has the wrong name. The name "bitset" refers to an implementation detail of one use of the metadata (i.e. its original use case, CFI). This makes it harder to understand, as the name makes no sense in the context of virtual call optimization. 2. It is represented using a global named metadata node, rather than being directly associated with a global. This makes it harder to manipulate the metadata when rebuilding global variables, summarise it as part of ThinLTO and drop unused metadata when associated globals are dropped. For this reason, CFI does not currently work correctly when both CFI and vcall opt are enabled, as vcall opt needs to rebuild vtable globals, and fails to associate metadata with the rebuilt globals. As I understand it, the same problem could also affect ASan, which rebuilds globals with a red zone. This patch solves both of those problems in the following way: 1. Rename the metadata to "type metadata". This new name reflects how the metadata is currently being used (i.e. to represent type information for CFI and vtable opt). The new name is reflected in the name for the associated intrinsic (llvm.type.test) and pass (LowerTypeTests). 2. Attach metadata directly to the globals that it pertains to, rather than using the "llvm.bitsets" global metadata node as we are doing now. This is done using the newly introduced capability to attach metadata to global variables (r271348 and r271358). See also: http://lists.llvm.org/pipermail/llvm-dev/2016-June/100462.html Differential Revision: http://reviews.llvm.org/D21053 llvm-svn: 273729
* Revert "InstCombine rule to fold trunc when value available"Reid Kleckner2016-06-241-62/+20
| | | | | | | | | | | | This reverts commit r273608. Broke building code with sanitizers, where apparently these kinds of loads, casts, and truncations are common: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24502 http://crbug.com/623099 llvm-svn: 273703
* Attempt to fix MSVC breakage caused by r273636.George Burgess IV2016-06-241-9/+13
| | | | | | Apparently earlier versions of MSVC don't have constexpr bitset ctors. llvm-svn: 273637
* [CFLAA] Propagate StratifiedAttrs in interproc. analysis.George Burgess IV2016-06-242-54/+122
| | | | | | | | | | | | | | | | | This patch also has a refactor that kills StratifiedAttr, and leaves us with StratifiedAttrs, because having both was mildly redundant. This patch makes us correctly handle stratified attributes when doing interprocedural analysis. It also adds another attribute, AttrCaller, which acts like AttrUnknown. We can filter out AttrCaller values when during interprocedural analysis, since the caller should have information about what arguments it's passing to its callee. Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21645 llvm-svn: 273636
* Attempt #2 to unbreak bots broken by r273596.George Burgess IV2016-06-232-4/+4
| | | | | | | | Some of the bots running GCC 4.7 seem to be having trouble with lambdas that explicitly capture `this`. Relevant-looking bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53137 llvm-svn: 273613
* InstCombine rule to fold trunc when value availableAnna Thomas2016-06-231-20/+62
| | | | | | | | | | | | | | Summary: This instcombine rule folds away trunc operations that have value available from a prior load or store. This kind of code can be generated as a result of GVN widening the load or from source code as well. Reviewers: reames, majnemer, sanjoy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21246 llvm-svn: 273608
* Attempt to fix breakage caused by r273596.George Burgess IV2016-06-231-3/+3
| | | | llvm-svn: 273601
* [CFLAA] Use better interprocedural function summaries.George Burgess IV2016-06-232-92/+130
| | | | | | | | | | | | | Previously, we just unified any arguments that seemed to be related to each other. With this patch, we now respect dereference levels, etc. which should make us substantially more accurate. Proper handling of StratifiedAttrs will be done in a later patch. Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21536 llvm-svn: 273596
* [ValueTracking] simplify logic in ComputeNumSignBits (NFCI)Sanjay Patel2016-06-231-16/+9
| | | | | | | | | | | This was noted in http://reviews.llvm.org/D21610 . The previous code predated the use of APInt ( http://reviews.llvm.org/rL47654 ), so it had to account for the fixed width of uint64_t. Now that we're using the variable width APInt, we can remove some complexity. llvm-svn: 273584
* [LoopUnrollAnalyzer] Fix a bug in UnrolledInstAnalyzer::visitLoad.Michael Zolotukhin2016-06-231-1/+1
| | | | | | | | | | | When simplifying a load we need to make sure that the type of the simplified value matches the type of the instruction we're processing. In theory, we can handle casts here as we deal with constant data, but since it's not implemented at the moment, we at least need to bail out. This fixes PR28262. llvm-svn: 273562
* [PM]: LoopAccessInfo simple refactoringXinliang David Li2016-06-221-22/+24
| | | | | | | To make definition of mov ctors easier. Differential Revision: http://reviews.llvm.org/D21563 llvm-svn: 273506
* [ValueTracking] improve ComputeNumSignBits for vector constantsSanjay Patel2016-06-221-4/+33
| | | | | | | | | | | This is similar to the computeKnownBits improvement in rL268479. There's probably more we can do for vector logic instructions, but this should let us see non-splat constant masking ops that can become vector selects instead of and/andn/or sequences. Differential Revision: http://reviews.llvm.org/D21610 llvm-svn: 273459
OpenPOWER on IntegriCloud