summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* 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
* GVN-hoist: move check before mutating the IRSebastian Pop2016-07-221-6/+8
| | | | llvm-svn: 276368
* GVN-hoist: add missing check for all GEP operands availableSebastian Pop2016-07-211-0/+3
| | | | llvm-svn: 276364
* GVH-hoist: only clone GEPs (PR28606)Sebastian Pop2016-07-211-14/+7
| | | | | | | | | Do not clone stored values unless they are GEPs that are special cased to avoid hoisting them without hoisting their associated ld/st. Differential revision: https://reviews.llvm.org/D22652 llvm-svn: 276358
* [PM] Port NaryReassociate to the new PMWei Mi2016-07-212-112/+76
| | | | | | Differential Revision: https://reviews.llvm.org/D22648 llvm-svn: 276349
* [OptDiag,LDist] Convert remaining opt remarks to use the new APIAdam Nemet2016-07-211-6/+5
| | | | llvm-svn: 276340
* [IndVars] Reflow oddly formatted condition; NFCSanjoy Das2016-07-211-2/+2
| | | | llvm-svn: 276319
* [GVNHoist] Preserve optimization hints which agreeDavid Majnemer2016-07-211-3/+17
| | | | | | | If we have optimization hints with agree with each other along different paths, preserve them. llvm-svn: 276248
* [GVNHoist] Don't wrongly preserve TBAADavid Majnemer2016-07-211-0/+12
| | | | | | | We hoisted loads/stores without taking into account which can cause miscompiles. llvm-svn: 276240
* [MergedLoadStoreMotion] Remove out of date commentDavid Majnemer2016-07-211-1/+0
| | | | llvm-svn: 276239
* [GVNHoist] Don't hoist PHI nodesDavid Majnemer2016-07-201-4/+8
| | | | | | | | | We hoisted PHIs without respecting their special insertion point in the block, leading to verfier errors. This fixes PR28626. llvm-svn: 276181
* [SCCP] Zap multiple return values.Davide Italiano2016-07-201-9/+41
| | | | | | | | | We can replace the return values with undef if we replaced all the call uses with a constant/undef. Differential Revision: https://reviews.llvm.org/D22336 llvm-svn: 276174
* [PM] Port LoopUnroll.Sean Silva2016-07-191-0/+33
| | | | | | | | | 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
* Make GVN Hoisting obey optnone/bisect.Paul Robinson2016-07-191-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D22545 llvm-svn: 276048
* [SCCP] Improve assert messages. NFCI.Davide Italiano2016-07-191-4/+6
| | | | | | | I've been hitting those already while working on SCCP and I think it's be useful to provide a more explanatory diagnostic. llvm-svn: 276007
* [DSE] Add additional debug output. NFC.Chad Rosier2016-07-191-0/+2
| | | | llvm-svn: 276005
* [DSE] Add additional debug output. NFC.Chad Rosier2016-07-191-0/+3
| | | | llvm-svn: 275991
* [LoopReroll] Reroll loops with unordered atomic memory accessesSanjoy Das2016-07-191-7/+7
| | | | | | | | | | Reviewers: hfinkel, jfb, reames Subscribers: mcrosier, mzolotukhin, llvm-commits Differential Revision: https://reviews.llvm.org/D22385 llvm-svn: 275932
* [PM] Convert Loop Strength Reduce pass to new PMDehao Chen2016-07-181-24/+44
| | | | | | | | | | | | Summary: Convert Loop String Reduce pass to new PM Reviewers: davidxl, silvas Subscribers: junbuml, sanjoy, mzolotukhin, llvm-commits Differential Revision: https://reviews.llvm.org/D22468 llvm-svn: 275919
* [GVNHoist] Remove a home-grown version of replaceUsesOfWithDavid Majnemer2016-07-181-15/+2
| | | | | | | | | replaceUsesOfWith will, on average, consider fewer values when trying to do the replacement. No functional change is intended. llvm-svn: 275884
* Fix -Wmicrosoft-enum-value in GVNHoist.cppReid Kleckner2016-07-181-1/+1
| | | | llvm-svn: 275879
* [LoopDist] Port to new PMAdam Nemet2016-07-182-34/+76
| | | | | | | | | | | | | | | | | | | | | | Summary: The direct motivation for the port is to ensure that the OptRemarkEmitter tests work with the new PM. This remains a function pass because we not only create multiple loops but could also version the original loop. In the test I need to invoke opt with -passes='require<aa>,loop-distribute'. LoopDistribute does not directly depend on AA however LAA does. LAA uses getCachedResult so I *think* we need manually pull in 'aa'. Reviewers: davidxl, silvas Subscribers: sanjoy, llvm-commits, mzolotukhin Differential Revision: https://reviews.llvm.org/D22437 llvm-svn: 275811
* [OptRemarkEmitter] Port to new PMAdam Nemet2016-07-181-3/+3
| | | | | | | | | | | | | | | | | | | | Summary: The main goal is to able to start using the new OptRemarkEmitter analysis from the LoopVectorizer. Since the vectorizer was recently converted to the new PM, it makes sense to convert this analysis as well. This pass is currently tested through the LoopDistribution pass, so I am also porting LoopDistribution to get coverage for this analysis with the new PM. Reviewers: davidxl, silvas Subscribers: llvm-commits, mzolotukhin Differential Revision: https://reviews.llvm.org/D22436 llvm-svn: 275810
* Revert "r275571 [DSE]Enhance shorthening MemIntrinsic based on OverlapIntervals"Alexander Kornienko2016-07-181-134/+50
| | | | | | Causes https://llvm.org/bugs/show_bug.cgi?id=28588 llvm-svn: 275801
* [GVNHoist] Change the key for VNtoInsns to a pairDavid Majnemer2016-07-181-9/+13
| | | | | | | | | | | | | | | | | | | | | While debugging GVNHoist, I found it confusing that the entries in a VNtoInsns were not always value numbers. They _usually_ were except for StoreInst in which case they were a hash of two different value numbers. This leads to two observations: - It is more difficult to debug things when the semantic contents of VNtoInsns changes over time. - Using a single value number is not much cheaper, the value of VNtoInsns is a SmallVector. - It is not immediately clear what the algorithm would do if there were hash collisions in the StoreInst case. Using a DenseMap of std::pair sidesteps all of this. N.B. The changes in the test were due their sensitivity to the iteration order of VNtoInsns which has changed. llvm-svn: 275761
* [GVNHoist] Sink HoistedCtr into GVNHoistDavid Majnemer2016-07-181-3/+3
| | | | | | | HoistedCtr cannot be a mutated global variable, that will open us up to races between threads compiling code in parallel. llvm-svn: 275744
* [GVNHoist] Some small cleanupsDavid Majnemer2016-07-181-26/+22
| | | | | | | No functional change is intended, just trying to clean things up a little. llvm-svn: 275743
* [PM] Convert IVUsers analysis to new pass manager.Dehao Chen2016-07-161-4/+4
| | | | | | | | | | | | Summary: Convert IVUsers analysis to new pass manager. Reviewers: davidxl, silvas Subscribers: junbuml, sanjoy, llvm-commits, mzolotukhin Differential Revision: https://reviews.llvm.org/D22434 llvm-svn: 275698
* StructurizeCFG: Fix inverting constantexpr conditionsMatt Arsenault2016-07-151-8/+2
| | | | llvm-svn: 275626
* [SCCP] Merge two conditions into one. NFCI.Davide Italiano2016-07-151-3/+1
| | | | llvm-svn: 275593
* [OptRemark,LDist] RFC: Add hotness attributeAdam Nemet2016-07-151-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first set of changes implementing the RFC from http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 This is a cross-sectional patch; rather than implementing the hotness attribute for all optimization remarks and all passes in a patch set, it implements it for the 'missed-optimization' remark for Loop Distribution. My goal is to shake out the design issues before scaling it up to other types and passes. Hotness is computed as an integer as the multiplication of the block frequency with the function entry count. It's only printed in opt currently since clang prints the diagnostic fields directly. E.g.: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info (hotness: 300) A new API added is similar to emitOptimizationRemarkMissed. The difference is that it additionally takes a code region that the diagnostic corresponds to. From this, hotness is computed using BFI. The new API is exposed via an analysis pass so that it can be made dependent on LazyBFI. (Thanks to Hal for the analysis pass idea.) This feature can all be enabled by setDiagnosticHotnessRequested in the LLVM context. If this is off, LazyBFI is not calculated (D22141) so there should be no overhead. A new command-line option is added to turn this on in opt. My plan is to switch all user of emitOptimizationRemark* to use this module instead. Reviewers: hfinkel Subscribers: rcox2, mzolotukhin, llvm-commits Differential Revision: http://reviews.llvm.org/D21771 llvm-svn: 275583
* [PM] Convert LoopInstSimplify Pass to new PMDehao Chen2016-07-152-61/+89
| | | | | | | | | | | | Summary: Convert LoopInstSimplify to new PM. Unfortunately there is no exisiting unittest for this pass. Reviewers: davidxl, silvas Subscribers: silvas, llvm-commits, mzolotukhin Differential Revision: https://reviews.llvm.org/D22280 llvm-svn: 275576
* [DSE]Enhance shorthening MemIntrinsic based on OverlapIntervalsJun Bum Lim2016-07-151-50/+134
| | | | | | | | | | | | | | 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. Reviewers: hfinkel, eeckstein, mcrosier Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D21909 llvm-svn: 275571
* code hoisting pass based on GVNSebastian Pop2016-07-153-0/+829
| | | | | | | | | | | | | This pass hoists duplicated computations in the program. The primary goal of gvn-hoist is to reduce the size of functions before inline heuristics to reduce the total cost of function inlining. Pass written by Sebastian Pop, Aditya Kumar, Xiaoyu Hu, and Brian Rzycki. Important algorithmic contributions by Daniel Berlin under the form of reviews. Differential Revision: http://reviews.llvm.org/D19338 llvm-svn: 275561
* [LoopDist] Fix typo in diagnosticAdam Nemet2016-07-141-1/+1
| | | | llvm-svn: 275495
OpenPOWER on IntegriCloud