summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* [IndVarSimplify] Eliminate zext of a signed IV when the IV is known to be ↵Andrew Kaylor2016-08-101-2/+7
| | | | | | | | | | non-negative Patch by Li Huang Differential Revision: https://reviews.llvm.org/D18867 llvm-svn: 278269
* Teach CorrelatedValuePropagation to mark adds as no wrapArtur Pilipenko2016-08-101-0/+57
| | | | | | | | | | | | This is a resubmission of previously reverted r277592. It was hitting overly strong assertion in getConstantRange which was relaxed in r278217. Use LVI to prove that adds do not wrap. The change is motivated by https://llvm.org/bugs/show_bug.cgi?id=28620 bug and it's the first step to fix that problem. Reviewed By: sanjoy Differential Revision: http://reviews.llvm.org/D23059 llvm-svn: 278220
* Fix the runtime error caused by "Use ValueOffsetPair to enhance value reuse ↵Wei Mi2016-08-091-1/+1
| | | | | | | | | | | | | | during SCEV expansion". The patch is to fix the bug in PR28705. It was caused by setting wrong return value for SCEVExpander::findExistingExpansion. The return values of findExistingExpansion have different meanings when the function is used in different ways so it is easy to make mistake. The fix creates two new interfaces to replace SCEVExpander::findExistingExpansion, and specifies where each interface is expected to be used. Differential Revision: https://reviews.llvm.org/D22942 llvm-svn: 278161
* [EarlyCSE] Teach about CSE'ing over invariant.start intrinsicsAnna Thomas2016-08-091-0/+13
| | | | | | | | | | | | | | Summary: Teach EarlyCSE about invariant.start intrinsic. Specifically, we can perform store-load, load-load forwarding over this call. Reviewers: majnemer, reames, dberlin, sanjoy Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23268 llvm-svn: 278153
* Consistently use LoopAnalysisManagerSean Silva2016-08-099-9/+9
| | | | | | | | | | | | | | | | | One exception here is LoopInfo which must forward-declare it (because the typedef is in LoopPassManager.h which depends on LoopInfo). Also, some includes for LoopPassManager.h were needed since that file provides the typedef. Besides a general consistently benefit, the extra layer of indirection allows the mechanical part of https://reviews.llvm.org/D23256 that requires touching every transformation and analysis to be factored out cleanly. Thanks to David for the suggestion. llvm-svn: 278079
* Consistently use ModuleAnalysisManagerSean Silva2016-08-091-1/+1
| | | | | | | | | | | Besides a general consistently benefit, the extra layer of indirection allows the mechanical part of https://reviews.llvm.org/D23256 that requires touching every transformation and analysis to be factored out cleanly. Thanks to David for the suggestion. llvm-svn: 278078
* Consistently use FunctionAnalysisManagerSean Silva2016-08-0912-12/+12
| | | | | | | | | | | Besides a general consistently benefit, the extra layer of indirection allows the mechanical part of https://reviews.llvm.org/D23256 that requires touching every transformation and analysis to be factored out cleanly. Thanks to David for the suggestion. llvm-svn: 278077
* Add some comments linking back to PR28400.Sean Silva2016-08-082-0/+8
| | | | | | Thanks to Mehdi for the suggestion! llvm-svn: 277984
* [PM] More workaround for PR28400Sean Silva2016-08-082-0/+2
| | | | llvm-svn: 277982
* [JumpThreading] Fix handling of aliasing metadata.Eli Friedman2016-08-081-6/+16
| | | | | | | | | | | | | | | | | | Summary: The correctness fix here is that when we CSE a load with another load, we need to combine the metadata on the two loads. This matches the behavior of other passes, like instcombine and GVN. There's also a minor optimization improvement here: for load PRE, the aliasing metadata on the inserted load should be the same as the metadata on the original load. Not sure why the old code was throwing it away. Issue found by inspection. Differential Revision: http://reviews.llvm.org/D21460 llvm-svn: 277977
* [SROA] Fix crash with lifetime intrinsic partially covering alloca.Eli Friedman2016-08-081-1/+7
| | | | | | | | | | | | | Summary: PromoteMemToReg looks specifically for the pattern bitcast+lifetime.start (or a bitcast-equivalent GEP); any offset will lead to an assertion failure. Fixes https://llvm.org/bugs/show_bug.cgi?id=27999 . Differential Revision: https://reviews.llvm.org/D22737 llvm-svn: 277969
* [LoadCombine] Simplify code with a brace init. NFC.Benjamin Kramer2016-08-061-4/+1
| | | | llvm-svn: 277921
* [IRCE] Remove unused headers; NFCSanjoy Das2016-08-061-7/+0
| | | | llvm-svn: 277892
* [IRCE] Preserve loop-simplify formSanjoy Das2016-08-061-0/+2
| | | | | | | | Fixes PR28764. Right now there is no way to test this, but (as mentioned on the PR) with Michael Zolotukhin's yet to be checked in LoopSimplify verfier, 8 of the llvm-lit tests for IRCE crash. llvm-svn: 277891
* [ADCE] Refactoring for new functionality (NFC)David Callahan2016-08-051-46/+84
| | | | | | | | | | | | | | Summary: This is another refactoring to break up the one function into three logical components functions. Another non-functional change before we start added in features. Reviewers: nadav, mehdi_amini, majnemer Subscribers: twoh, freik, llvm-commits Differential Revision: https://reviews.llvm.org/D23102 llvm-svn: 277855
* GVN-hoist: fix early exit logicSebastian Pop2016-08-041-4/+11
| | | | | | | | | | The patch splits a complex && if condition into easier to read and understand logic. That wrong early exit condition was letting some instructions with not all operands available pass through when HoistingGeps was true. Differential Revision: https://reviews.llvm.org/D23174 llvm-svn: 277785
* GVNHoist: Don't hoist convergent callsMatt Arsenault2016-08-041-0/+4
| | | | llvm-svn: 277767
* GVN-hoist: limit the length of dependent instructionsSebastian Pop2016-08-031-0/+10
| | | | | | | | | | Limit the number of times the while(1) loop is executed. With this restriction the number of hoisted instructions does not change in a significant way on the test-suite. Differential Revision: https://reviews.llvm.org/D23028 llvm-svn: 277651
* GVN-hoist: compute DFS numbers onceSebastian Pop2016-08-031-12/+22
| | | | | | | | | With this patch we compute the DFS numbers of instructions only once and update them during the code generation when an instruction gets hoisted. Differential Revision: https://reviews.llvm.org/D23021 llvm-svn: 277650
* GVN-hoist: compute MSSA once per function (PR28670)Sebastian Pop2016-08-031-12/+49
| | | | | | | | With this patch we compute the MemorySSA once and update it in the code generator. Differential Revision: https://reviews.llvm.org/D22966 llvm-svn: 277649
* Revert "Teach CorrelatedValuePropagation to mark adds as no wrap"Renato Golin2016-08-031-57/+0
| | | | | | This reverts commit r277592, trying to fix the AArch64 42VMA buildbot. llvm-svn: 277607
* Teach CorrelatedValuePropagation to mark adds as no wrapArtur Pilipenko2016-08-031-0/+57
| | | | | | | | | | Use LVI to prove that adds do not wrap. The change is motivated by https://llvm.org/bugs/show_bug.cgi?id=28620 bug and it's the first step to fix that problem. Reviewed By: sanjoy Differential Revision: http://reviews.llvm.org/D23059 llvm-svn: 277592
* [ADCE] Refactor anticipating new functionality (NFC)David Callahan2016-08-031-17/+34
| | | | | | | | | | | | | | | | | Summary: This is the first refactoring before adding new functionality. Add a class wrapper for the functions and container for state associated with the transformation. No functional change Reviewers: majnemer, nadav, mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23065 llvm-svn: 277565
* [IRCE] Rename variable; NFCSanjoy Das2016-08-021-6/+6
| | | | | | There is nothing "Original" about "OriginalLoopInfo". llvm-svn: 277506
* [IRCE] Preserve DomTree and LCSSASanjoy Das2016-08-021-5/+11
| | | | | | | This changes IRCE to "preserve" LCSSA and DomTree by recomputing them. It still does not preserve LoopSimplify. llvm-svn: 277505
* [PM] Port SpeculativeExecution to the new PMMichael Kuperstein2016-08-012-40/+58
| | | | | | Differential Revision: https://reviews.llvm.org/D23033 llvm-svn: 277393
* [LoopUnroll] Include hotness of region in opt remarkAdam Nemet2016-07-291-22/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LoopUnroll is a loop pass, so the analysis of OptimizationRemarkEmitter is added to the common function analysis passes that loop passes depend on. The BFI and indirectly BPI used in this pass is computed lazily so no overhead should be observed unless -pass-remarks-with-hotness is used. This is how the patch affects the O3 pipeline: Dominator Tree Construction Natural Loop Information Canonicalize natural loops Loop-Closed SSA Form Pass Basic Alias Analysis (stateless AA impl) Function Alias Analysis Results Scalar Evolution Analysis + Lazy Branch Probability Analysis + Lazy Block Frequency Analysis + Optimization Remark Emitter Loop Pass Manager Rotate Loops Loop Invariant Code Motion Unswitch loops Simplify the CFG Dominator Tree Construction Basic Alias Analysis (stateless AA impl) Function Alias Analysis Results Combine redundant instructions Natural Loop Information Canonicalize natural loops Loop-Closed SSA Form Pass Scalar Evolution Analysis + Lazy Branch Probability Analysis + Lazy Block Frequency Analysis + Optimization Remark Emitter Loop Pass Manager Induction Variable Simplification Recognize loop idioms Delete dead loops Unroll loops ... llvm-svn: 277203
* [EarlyCSE] Correctly handle simplified, but live, instructionsDavid Majnemer2016-07-291-2/+4
| | | | | | | | | Some instructions may have their uses replaced with a symbolic constant. However, the instruction may still have side effects which percludes it from being removed from the function. EarlyCSE treated such an instruction as if it were removed, resulting in PR28763. llvm-svn: 277114
* [ConstnatFolding] Teach the folder how to fold ConstantVectorDavid Majnemer2016-07-291-6/+9
| | | | | | | | | | | 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
* [PM] Port LowerGuardIntrinsic to the new PM.Michael Kuperstein2016-07-282-9/+23
| | | | llvm-svn: 277057
* [DSE] Fix bug in updating MadeChange flagJun Bum Lim2016-07-271-2/+2
| | | | | | | | | | | | Summary: The MadeChange flag should be ORed to keep the previous result. Reviewers: mcrosier Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D22873 llvm-svn: 276894
* [GVNHoist] Fix typo in assert.George Burgess IV2016-07-271-1/+1
| | | | | | This fixes PR28730. llvm-svn: 276844
* GVN-hoist: improve code generation for recursive GEPsSebastian Pop2016-07-271-42/+82
| | | | | | | | | | | | | | | | | | | When loading or storing in a field of a struct like "a.b.c", GVN is able to detect the equivalent expressions, and GVN-hoist would fail in the code generation. This is because the GEPs are not hoisted as scalar operations to avoid moving the GEPs too far from their ld/st instruction when the ld/st is not movable. So we end up having to generate code for the GEP of a ld/st when we move the ld/st. In the case of a GEP referring to another GEP as in "a.b.c" we need to code generate all the GEPs necessary to make all the operands available at the new location for the ld/st. With this patch we recursively walk through the GEP operands checking whether all operands are available, and in the case of a GEP operand, it recursively makes all its operands available. Code generation happens from the inner GEPs out until reaching the GEP that appears as an operand of the ld/st. Differential Revision: https://reviews.llvm.org/D22599 llvm-svn: 276841
* GVN-hoist: use DFS numbers instead of walking the instruction streamSebastian Pop2016-07-271-10/+3
| | | | | | | | | The patch replaces a function that walks the IR with a call to firstInBB() that uses the DFS numbering. NFC. Differential Revision: https://reviews.llvm.org/D22809 llvm-svn: 276840
* GVN-hoist: use a DFS numbering of instructions (PR28670)Sebastian Pop2016-07-261-31/+26
| | | | | | | | | | | Instead of DFS numbering basic blocks we now DFS number instructions that avoids the costly operation of which instruction comes first in a basic block. Patch mostly written by Daniel Berlin. Differential Revision: https://reviews.llvm.org/D22777 llvm-svn: 276714
* GVN-hoist: limit hoisting depth (PR28670)Sebastian Pop2016-07-261-0/+11
| | | | | | | | | | This patch adds an option to specify the maximum depth in a BB at which to consider hoisting instructions. Hoisting instructions from a deeper level is not profitable as it increases register pressure and compilation time. Differential Revision: https://reviews.llvm.org/D22772 llvm-svn: 276713
* Scalarizer: Support scalarizing intrinsicsMatt Arsenault2016-07-251-0/+79
| | | | llvm-svn: 276681
* Revert NewGVN N^2 behavior patchDaniel Berlin2016-07-251-22/+19
| | | | llvm-svn: 276670
* NFC: Make a few asserts in GVNHoist do the same thing, but cheaper.Daniel Berlin2016-07-251-4/+8
| | | | llvm-svn: 276662
* Fix N^2 instruction ordering comparisons in GVNHoist.Daniel Berlin2016-07-251-19/+18
| | | | | | This fixes GVNHoist's portion of PR28670. llvm-svn: 276658
* NFC: Refactor GVNHoist class so not everything is publicDaniel Berlin2016-07-251-37/+36
| | | | llvm-svn: 276657
* [GVNHoist] Merge metadata on hoisted instructions less conservativelyDavid Majnemer2016-07-251-7/+17
| | | | | | | We can combine metadata from multiple instructions intelligently for certain metadata nodes. llvm-svn: 276602
* [GVNHoist] Properly merge alignments when hoistingDavid Majnemer2016-07-251-4/+14
| | | | | | | | | If we two loads of two different alignments, we must use the minimum of the two alignments when hoisting. Same deal for stores. For allocas, use the maximum of the two allocas. llvm-svn: 276601
* [Loop Vectorizer] Handling loops FP induction variables.Elena Demikhovsky2016-07-241-1/+1
| | | | | | | | | | | | | | | | 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
* [LoopDataPrefetch] Fix unused variable in release buildAdam Nemet2016-07-221-2/+1
| | | | llvm-svn: 276491
* [LoopDataPrefetch] Include hotness of region in opt remarkAdam Nemet2016-07-221-4/+6
| | | | llvm-svn: 276488
* [LoopDataPrefetch] Sort headersAdam Nemet2016-07-221-1/+1
| | | | llvm-svn: 276487
* Recommit - [DSE]Enhance shorthening MemIntrinsic based on OverlapIntervalsJun Bum Lim2016-07-221-62/+151
| | | | | | | | | | | Recommiting r275571 after fixing crash reported in PR28270. Now we erase elements of IOL in deleteDeadInstruction(). Original Summary: This change use the overlap interval map built from partial overwrite tracking to perform shortening MemIntrinsics. Add test cases which was missing opportunities before. llvm-svn: 276452
* Don't remove side effecting instructions due to ConstantFoldInstructionDavid Majnemer2016-07-223-5/+11
| | | | | | | | | Just because we can constant fold the result of an instruction does not imply that we can delete the instruction. It may have side effects. This fixes PR28655. llvm-svn: 276389
* [IRCE] Add an option to skip profitability checksSanjoy Das2016-07-221-2/+7
| | | | | | | | If `-irce-skip-profitability-checks` is passed in, IRCE will kick in in all cases where it is legal for it to kick in. This flag is intended to help diagnose and analyse performance issues. llvm-svn: 276372
OpenPOWER on IntegriCloud