summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
...
* Recommitting r275284: add support to inline __builtin_mempcpyAndrew Kaylor2016-07-291-0/+1
| | | | | | | | Patch by Sunita Marathe Third try, now following fixes to MSan to handle mempcy in such a way that this commit won't break the MSan buildbots. (Thanks, Evegenii!) llvm-svn: 277189
* [ConstnatFolding] Teach the folder how to fold ConstantVectorDavid Majnemer2016-07-291-8/+8
| | | | | | | | | | | 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
* Added ThinLTO inlining statisticsPiotr Padlewski2016-07-292-0/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: copypasta doc of ImportedFunctionsInliningStatistics class \brief Calculate and dump ThinLTO specific inliner stats. The main statistics are: (1) Number of inlined imported functions, (2) Number of imported functions inlined into importing module (indirect), (3) Number of non imported functions inlined into importing module (indirect). The difference between first and the second is that first stat counts all performed inlines on imported functions, but the second one only the functions that have been eventually inlined to a function in the importing module (by a chain of inlines). Because llvm uses bottom-up inliner, it is possible to e.g. import function `A`, `B` and then inline `B` to `A`, and after this `A` might be too big to be inlined into some other function that calls it. It calculates this statistic by building graph, where the nodes are functions, and edges are performed inlines and then by marking the edges starting from not imported function. If `Verbose` is set to true, then it also dumps statistics per each inlined function, sorted by the greatest inlines count like - number of performed inlines - number of performed inlines to importing module Reviewers: eraman, tejohnson, mehdi_amini Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22491 llvm-svn: 277089
* [sanitizer] Simplify and future-proof maybeMarkSanitizerLibraryCallNoBuiltin().Evgeniy Stepanov2016-07-281-17/+6
| | | | | | | | | | | | | | | | | | | | Sanitizers set nobuiltin attribute on certain library functions to avoid a situation where such function is neither instrumented nor intercepted. At the moment the list of interesting functions is hardcoded. This change replaces it with logic based on TargetLibraryInfo::hasOptimizedCodegen and the presense of readnone function attribute (sanitizers are generally interested in memory behavior of library functions). This is expected to be a no-op change: the new logic matches exactly the same set of functions. r276771 (currently reverted) added mempcpy() to the list, breaking MSan tests. With this change, r276771 can be safely re-landed. llvm-svn: 277086
* Add verifyAnalysis for LCSSA.Michael Zolotukhin2016-07-271-0/+5
| | | | | | | | | | | | | | | Summary: LCSSAWrapperPass currently doesn't override verifyAnalysis method, so pass manager doesn't verify LCSSA. This patch adds the method so that we start verifying LCSSA between loop passes. Reviewers: chandlerc, sanjoy, hfinkel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22888 llvm-svn: 276941
* Refactor - CodeExtractor : Move check for valid block to static utilitySean Silva2016-07-271-2/+2
| | | | | | | | | | | This lets you actually check to see if a block is valid before trying to extract. Patch by River Riddle! Differential Revision: https://reviews.llvm.org/D22699 llvm-svn: 276846
* Reverting r276771 due to MSan failures.Andrew Kaylor2016-07-271-1/+0
| | | | llvm-svn: 276824
* [LoopUtils] Sort headersAdam Nemet2016-07-261-3/+4
| | | | llvm-svn: 276776
* 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
* [PM] Port SymbolRewriter to the new PMMichael Kuperstein2016-07-251-22/+33
| | | | | | Differential Revision: https://reviews.llvm.org/D22703 llvm-svn: 276687
* Attempt to pacify windows bots.Michael Kuperstein2016-07-251-13/+13
| | | | llvm-svn: 276672
* Don't use iplist in SymbolRewriter. NFC.Michael Kuperstein2016-07-251-10/+15
| | | | | | | | There didn't appear to be a good reason to use iplist in this case, a regular list of unique_ptr works just as well. Change made in preparation to a new PM port (since iplist is not moveable). llvm-svn: 276668
* [Utils] Simplify combineMetadataDavid Majnemer2016-07-251-3/+3
| | | | | | Use a range-based for loop, no functional change is intended. llvm-svn: 276600
* [Loop Vectorizer] Handling loops FP induction variables.Elena Demikhovsky2016-07-241-12/+106
| | | | | | | | | | | | | | | | Allowed loop vectorization with secondary FP IVs. Like this: float *A; float x = init; for (int i=0; i < N; ++i) { A[i] = x; x -= fp_inc; } The auto-vectorization is possible when the induction binary operator is "fast" or the function has "unsafe" attribute. Differential Revision: https://reviews.llvm.org/D21330 llvm-svn: 276554
* [MSSA] Make EXPENSIVE_CHECKS check more.George Burgess IV2016-07-241-13/+11
| | | | | | | | checkClobberSanity will now be run for all results of `ClobberWalk`, instead of just the crazy phi-optimized ones. This can help us catch cases where our cache is being wonky. llvm-svn: 276553
* [MSSA] Remove useless assert. NFC.George Burgess IV2016-07-241-1/+0
| | | | | | | liveOnEntry is always a MemoryDef; asserting that a MemoryPhi isn't liveOnEntry, while correct, isn't very helpful. :) llvm-svn: 276542
* Avoid using a raw AssumptionCacheTracker in various inliner functions.Sean Silva2016-07-231-5/+5
| | | | | | | | | | 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
* [PM] Port BreakCriticalEdges to the new PM.Wei Mi2016-07-221-2/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D22688 llvm-svn: 276449
* [MSSA] Add an overload for getClobberingMemoryAccess.George Burgess IV2016-07-201-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A seemingly common use for the walker's getClobberingMemoryAccess function is: ``` MemoryAccess *getClobber(MemorySSAWalker *W, MemoryUseOrDef *MUD) { const Instruction *I = MUD->getMemoryInst(); return W->getClobberingMemoryAccess(I); } ``` Which is kind of redundant, since walkers will ultimately query MSSA to find out which MemoryAccess `I` maps to (...which is always `MUD`). So, this patch adds an overload of getClobberingMemoryAccess that accepts MemoryAccesses directly. As a result, the Instruction overload of getClobberingMemoryAccess becomes a lightweight wrapper around our new overload. Additionally, this patch un`virtual`izes the Instruction overload of getClobberingMemoryAccess, since there doesn't seem to be a walker that benefits from that being virtual, and I can't think of how else one would implement it. Happy to make it virtual again if we would benefit from doing so. llvm-svn: 276169
* move decomposeBitTestICmp() to Transforms/Utils; NFCSanjay Patel2016-07-201-0/+44
| | | | | | | | As noted in https://reviews.llvm.org/D22537 , we can use this functionality in visitSelectInstWithICmp() and InstSimplify, but currently we have duplicated code. llvm-svn: 276140
* fix documentation comments; NFCSanjay Patel2016-07-201-32/+0
| | | | llvm-svn: 276135
* Revert "Revert r275883 and r275891. They seem to cause PR28608."Michael Zolotukhin2016-07-202-15/+69
| | | | | | | This reverts commit r276064, and thus reapplies r275891 and r275883 with a fix for PR28608. llvm-svn: 276077
* Revert r275883 and r275891. They seem to cause PR28608.Sean Silva2016-07-192-60/+13
| | | | | | | | | | | | Revert "[LoopSimplify] Update LCSSA after separating nested loops." This reverts commit r275891. Revert "[LCSSA] Post-process PHI-nodes created by SSAUpdate when constructing LCSSA form." This reverts commit r275883. llvm-svn: 276064
* Fix unused variableDaniel Berlin2016-07-191-2/+1
| | | | llvm-svn: 276050
* Make MemorySSA::dominates/locallydominates constant timeDaniel Berlin2016-07-191-16/+36
| | | | | | | | | | | | Summary: Make MemorySSA::dominates/locallydominates constant time Reviewers: george.burgess.iv, gberry Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22527 llvm-svn: 276046
* [MemorySSA] Update to the new shiny walker.George Burgess IV2016-07-191-307/+830
| | | | | | | | | | | | | | | | | | | | | | | | This patch updates MemorySSA's use-optimizing walker to be more accurate and, in some cases, faster. Essentially, this changed our core walking algorithm from a cache-as-you-go DFS to an iteratively expanded DFS, with all of the caching happening at the end. Said expansion happens when we hit a Phi, P; we'll try to do the smallest amount of work possible to see if optimizing above that Phi is legal in the first place. If so, we'll expand the search to see if we can optimize to the next phi, etc. An iteratively expanded DFS lets us potentially quit earlier (because we don't assume that we can optimize above all phis) than our old walker. Additionally, because we don't cache as we go, we can now optimize above loops. As an added bonus, this patch adds a ton of verification (if EXPENSIVE_CHECKS are enabled), so finding bugs is easier. Differential Revision: https://reviews.llvm.org/D21777 llvm-svn: 275940
* [LoopSimplify] Update LCSSA after separating nested loops.Michael Zolotukhin2016-07-181-12/+50
| | | | | | | | | | | | | | | | | | Summary: Usually LCSSA survives this transformation, but in some cases (see attached test) it doesn't: values from the original loop after separating might be used from the outer loop. Before the transformation it was the same loop, so LCSSA phis were not required. This fixes PR28272. Reviewers: sanjoy, hfinkel, chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21665 llvm-svn: 275891
* [LCSSA] Post-process PHI-nodes created by SSAUpdate when constructing LCSSA ↵Michael Zolotukhin2016-07-181-1/+10
| | | | | | | | | | | | | | | | | | form. Summary: SSAUpdate might insert PHI-nodes inside loops, which can break LCSSA form unless we fix it up. This fixes PR28424. Reviewers: sanjoy, chandlerc, hfinkel Subscribers: uabelho, llvm-commits Differential Revision: http://reviews.llvm.org/D21997 llvm-svn: 275883
* Make processInstruction from LCSSA.cpp externally available.Michael Zolotukhin2016-07-151-120/+126
| | | | | | | | | | | | | | | | Summary: When a pass tries to keep LCSSA form it's often convenient to be able to update LCSSA for a set of instructions rather than for the entire loop. This patch makes the processInstruction from LCSSA externally available under a name formLCSSAForInstruction. Reviewers: chandlerc, sanjoy, hfinkel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22378 llvm-svn: 275613
* [AliasAnalysis] Give back AA results for fence instructionsDavid Majnemer2016-07-151-5/+7
| | | | | | | | | | | | | Calling getModRefInfo with a fence resulted in crashes because fences don't have a memory location. Add a new predicate to Instruction called isFenceLike which indicates that the instruction mutates memory but not any single memory location in particular. In practice, it is a proxy for the set of instructions which "mayWriteToMemory" but cannot be used with MemoryLocation::get. This fixes PR28570. llvm-svn: 275581
* Reverting r275284 due to platform-specific test failuresAndrew Kaylor2016-07-131-1/+0
| | | | llvm-svn: 275304
* Fix for Bug 26903, adds support to inline __builtin_mempcpyAndrew Kaylor2016-07-131-0/+1
| | | | | | | | Patch by Sunita Marathe Differential Revision: http://reviews.llvm.org/D21920 llvm-svn: 275284
* [LoopSimplify] Remove a comment which is unlikely to age well.Davide Italiano2016-07-091-4/+0
| | | | | | | Chandler pointed out in his review but I forgot to remove before committing, my bad. llvm-svn: 274963
* [PM] Port LoopSimplify to the new pass manager.Davide Italiano2016-07-092-0/+32
| | | | | | | | | While here move simplifyLoop() function to the new header, as suggested by Chandler in the review. Differential Revision: http://reviews.llvm.org/D21404 llvm-svn: 274959
* Rename LoopAccessAnalysis to LoopAccessLegacyAnalysis /NFCXinliang David Li2016-07-081-3/+3
| | | | llvm-svn: 274927
* [PM] Port InstSimplify to the new pass manager.Davide Italiano2016-07-071-44/+62
| | | | llvm-svn: 274796
* Addressing post-commit comments for not rewriting fputs:Sjoerd Meijer2016-07-071-2/+5
| | | | | | moved the optimise for size check inside function optimizeFPuts. llvm-svn: 274758
* Code size optimisation: don't rewrite fputs to fwrite when optimising for sizeSjoerd Meijer2016-07-071-0/+2
| | | | | | because fwrite requires more arguments and thus extra MOVs are required. llvm-svn: 274753
* [MemorySSA] Reinstate the legacy printer and verifier.Chad Rosier2016-07-062-0/+31
| | | | | | Differential Revision: http://reviews.llvm.org/D22058 llvm-svn: 274679
* Fix handling of forward unreachable but reverse-reachable blocks in ↵Daniel Berlin2016-07-061-2/+16
| | | | | | MemorySSA construction llvm-svn: 274606
* [MSSA] Fix typo. NFC.George Burgess IV2016-07-061-1/+1
| | | | llvm-svn: 274590
* [PM] refactor LoopAccessInfo code part-2Xinliang David Li2016-07-011-3/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D21636 llvm-svn: 274334
* [PM] Normalize FIXMEs for missing PreserveCFG to have the same wording.Michael Kuperstein2016-06-282-7/+2
| | | | llvm-svn: 273974
* Factor out buildMemorySSA from getWalker.Daniel Berlin2016-06-271-8/+11
| | | | | | NFC. llvm-svn: 273901
* [CodeExtractor] Merge DEBUG statements in an attempt to fix the msvcBenjamin Kramer2016-06-261-4/+6
| | | | | | | | | build. There's a known bug in msvc 2013 that fails to compile do-while loops inside of ranged for loops. llvm-svn: 273811
* Apply clang-tidy's modernize-loop-convert to most of lib/Transforms.Benjamin Kramer2016-06-2610-149/+104
| | | | | | Only minor manual fixes. No functionality change intended. llvm-svn: 273808
* Just a small cleanupDavid Majnemer2016-06-251-30/+21
| | | | | | No functional change is intended llvm-svn: 273780
* Revert "[SimplifyCFG] Stop inserting calls to llvm.trap for UB"David Majnemer2016-06-253-25/+41
| | | | | | This reverts commit r273778, it seems to break UBSan :/ llvm-svn: 273779
* [SimplifyCFG] Stop inserting calls to llvm.trap for UBDavid Majnemer2016-06-253-41/+25
| | | | | | | | | | | | | | | | | SimplifyCFG had logic to insert calls to llvm.trap for two very particular IR patterns: stores and invokes of undef/null. While InstCombine canonicalizes certain undefined behavior IR patterns to stores of undef, phase ordering means that this cannot be relied upon in general. There are much better tools than llvm.trap: UBSan and ASan. N.B. I could be argued into reverting this change if a clear argument as to why it is important that we synthesize llvm.trap for stores, I'd be hard pressed to see why it'd be useful for invokes... llvm-svn: 273778
* [SimplifyCFG] Replace calls to null/undef with unreachableDavid Majnemer2016-06-252-1/+11
| | | | | | | Calling null is undefined behavior, a call to undef can be trivially treated as a call to null. llvm-svn: 273776
OpenPOWER on IntegriCloud