summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* [esan] Use ModulePass for EfficiencySanitizerPass.Derek Bruening2016-05-201-9/+17
| | | | | | | | | | | | | | | | | Summary: Uses ModulePass instead of FunctionPass for EfficiencySanitizerPass to better support global variable creation for a forthcoming struct field counter tool. Patch by Qin Zhao. Reviewers: aizatsky Subscribers: llvm-commits, eugenis, vitalybuka, bruening, kcc Differential Revision: http://reviews.llvm.org/D20458 llvm-svn: 270263
* Functions with differing phis should not be merged.Mark Lacey2016-05-201-0/+11
| | | | | | | | | | | Check that the incoming blocks of phi nodes are identical, and block function merging if they are not. rdar://problem/26255167 Differential Revision: http://reviews.llvm.org/D20462 llvm-svn: 270250
* [PM/PartiallyInlineLibCalls] Fix pass dependencies.Davide Italiano2016-05-201-10/+13
| | | | | | Inline getAnalysisUsage() while I'm here. llvm-svn: 270231
* [PartiallyInlineLibCalls] Remove dead includes. NFC.Davide Italiano2016-05-201-2/+0
| | | | llvm-svn: 270228
* [PM/PartiallyInlineLibCalls] Convert to static function in preparation for ↵Davide Italiano2016-05-201-55/+49
| | | | | | porting this pass to the new PM. llvm-svn: 270225
* [SimplifyCFG] eliminate switch cases based on known range of switch conditionSanjay Patel2016-05-201-4/+10
| | | | | | | | | | | | This was noted in PR24766: https://llvm.org/bugs/show_bug.cgi?id=24766#c2 We may not know whether the sign bit(s) are zero or one, but we can still optimize based on knowing that the sign bit is repeated. Differential Revision: http://reviews.llvm.org/D20275 llvm-svn: 270222
* Add const qualifiers to appease bots; NFCSanjoy Das2016-05-191-3/+3
| | | | llvm-svn: 270155
* [GuardWidening] Introduce range check mergingSanjoy Das2016-05-191-0/+244
| | | | | | | | | | | | | | | | | | | | | | Sequences of range checks expressed using guards, like guard((I - 2) u< L) guard((I - 1) u< L) guard((I + 0) u< L) guard((I + 1) u< L) guard((I + 2) u< L) can sometimes be combined into a smaller sequence: guard((I - 2) u< L AND (I + 2) u< L) if we can prove that (I - 2) u< L AND (I + 2) u< L implies all of checks expressed in the previous sequence. This change teaches GuardWidening to do this kind of merging when feasible. llvm-svn: 270151
* [InstCombine] Avoid combining the bitcast of a var that is used as both ↵Guozhi Wei2016-05-191-0/+7
| | | | | | | | | | address and result of load instructions This patch fixes https://llvm.org/bugs/show_bug.cgi?id=27703. If there is a sequence of one or more load instructions, each loaded value is used as address of later load instruction, bitcast is necessary to change the value type, don't optimize it. llvm-svn: 270135
* Recommit r255691 since PR26509 has been fixed.Wei Mi2016-05-191-31/+106
| | | | llvm-svn: 270113
* [SCCP] Prefer class to struct.Davide Italiano2016-05-191-2/+4
| | | | llvm-svn: 270074
* Retry^3 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-192-20/+27
| | | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. - Remove the base ProfError class to work around an MSVC ICE. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 270020
* [GuardWidening] Use getEquivalentICmp to fold constant comparesSanjoy Das2016-05-191-13/+23
| | | | | | | `ConstantRange::getEquivalentICmp` is more general, and better factored. llvm-svn: 270019
* [LowerGuards] Rename variable; NFCSanjoy Das2016-05-181-3/+3
| | | | | | | PredicatePassProbability is a better name for what LikelyBranchWeight was trying to express. llvm-svn: 269999
* New pass: guard wideningSanjoy Das2016-05-183-0/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Implement guard widening in LLVM. Description from GuardWidening.cpp: The semantics of the `@llvm.experimental.guard` intrinsic lets LLVM transform it so that it fails more often that it did before the transform. This optimization is called "widening" and can be used hoist and common runtime checks in situations like these: ``` %cmp0 = 7 u< Length call @llvm.experimental.guard(i1 %cmp0) [ "deopt"(...) ] call @unknown_side_effects() %cmp1 = 9 u< Length call @llvm.experimental.guard(i1 %cmp1) [ "deopt"(...) ] ... ``` to ``` %cmp0 = 9 u< Length call @llvm.experimental.guard(i1 %cmp0) [ "deopt"(...) ] call @unknown_side_effects() ... ``` If `%cmp0` is false, `@llvm.experimental.guard` will "deoptimize" back to a generic implementation of the same function, which will have the correct semantics from that point onward. It is always _legal_ to deoptimize (so replacing `%cmp0` with false is "correct"), though it may not always be profitable to do so. NB! This pass is a work in progress. It hasn't been tuned to be "production ready" yet. It is known to have quadriatic running time and will not scale to large numbers of guards Reviewers: reames, atrick, bogner, apilipenko, nlewycky Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D20143 llvm-svn: 269997
* Follow-up patch of http://reviews.llvm.org/D19948 to handle missing profiles ↵Dehao Chen2016-05-181-18/+32
| | | | | | | | | | | | | | when simplifying CFG. Summary: Set default branch weight to 1:1 if one of the branch has profile missing when simplifying CFG. Reviewers: spatel, davidxl Subscribers: danielcdh, llvm-commits Differential Revision: http://reviews.llvm.org/D20307 llvm-svn: 269995
* [LoopUnrollAnalyzer] Take into account cost of instructions controlling ↵Michael Zolotukhin2016-05-181-0/+1
| | | | | | | | | branches, along with their operands. Previously, we didn't add their and their operands cost, which could've resulted in unrolling loops for no actual benefit. llvm-svn: 269985
* clang-format SimplifyCFG.cpp.Dehao Chen2016-05-181-581/+625
| | | | llvm-svn: 269974
* [PM] Port per-function SCCP to the new pass manager.Davide Italiano2016-05-182-45/+53
| | | | llvm-svn: 269937
* [VectorUtils] Fix nasty use-after-freeJames Molloy2016-05-181-1/+3
| | | | | | | | | | In truncateToMinimalBitwidths() we were RAUW'ing an instruction then erasing it. However, that intruction could be cached in the map we're iterating over. The first check is "I->use_empty()" which in most cases would return true, as the (deleted) object was RAUW'd first so would have zero use count. However in some cases the object could have been polluted or written over and this wouldn't be the case. Also it makes valgrind, asan and traditionalists who don't like their compiler to crash sad. No testcase as there are no externally visible symptoms apart from a crash if the stars align. Fixes PR26509. llvm-svn: 269908
* [PM] Port DSE to the new pass managerJustin Bogner2016-05-172-322/+340
| | | | | | Patch by JakeVanAdrighem. Thanks! llvm-svn: 269847
* minor cleanup /NFCXinliang David Li2016-05-171-4/+2
| | | | llvm-svn: 269839
* [InstCombine] add another test for wrong icmp constant (PR27792)Sanjay Patel2016-05-171-1/+1
| | | | | | It doesn't matter if the comparison is unsigned; the inc/dec is always signed. llvm-svn: 269831
* Simple refactoring /NFCXinliang David Li2016-05-171-8/+15
| | | | llvm-svn: 269829
* [LCSSA] Use llvm::any_of instead of std::size_of.Davide Italiano2016-05-171-3/+2
| | | | | | The API is simpler. Suggested by David Blaikie! llvm-svn: 269800
* [InstCombine] fix constant to be signed for signed comparisonsSanjay Patel2016-05-171-1/+1
| | | | | | | This bug was introduced in r269728 and is the likely cause of many stage 2 ubsan bot failures. I'll add a test in a follow-up commit assuming this fixes things properly. llvm-svn: 269797
* [Guards] Add branch metadata when loweringSanjoy Das2016-05-171-0/+10
| | | | | | | Guards are expected to basically never fail. Reflect this in the branch probabilities in their lowered form. llvm-svn: 269791
* [PM/LCSSA] Fix dependency list. Some passes are preserved, not required.Davide Italiano2016-05-171-2/+0
| | | | llvm-svn: 269768
* [LCSSA] Use any_of() to simplify the code. NFCI.Davide Italiano2016-05-171-9/+5
| | | | llvm-svn: 269767
* [RewriteStatepointsForGC] Remove obsolete assertionIgor Laevsky2016-05-171-8/+0
| | | | | | | | | | This is assertion is no longer necessary since we never record constants in the live set anyway. (They are never recorded in the initial live set, and constant bases are removed near line 2119) Differential Revision: http://reviews.llvm.org/D20293 llvm-svn: 269764
* [InstCombine] Don't crash when trying to take an element of a ConstantExpr.Benjamin Kramer2016-05-171-0/+3
| | | | | | Fixes PR27786. llvm-svn: 269757
* try to avoid unused variable warning in release build; NFCISanjay Patel2016-05-171-1/+2
| | | | llvm-svn: 269729
* [InstCombine] check vector elements before trying to transform LE/GE vector ↵Sanjay Patel2016-05-171-78/+42
| | | | | | | | | | | | | | | | | icmp (PR27756) Fix a bug introduced with rL269426 : [InstCombine] canonicalize* LE/GE vector integer comparisons to LT/GT (PR26701, PR26819) We were assuming that a ConstantDataVector / ConstantVector / ConstantAggregateZero operand of an ICMP was composed of ConstantInt elements, but it might have ConstantExpr or UndefValue elements. Handle those appropriately. Also, refactor this function to join the scalar and vector paths and eliminate the switches. Differential Revision: http://reviews.llvm.org/D20289 llvm-svn: 269728
* Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Vedant Kumar2016-05-162-27/+20
| | | | | | | | This reverts commit r269694. MSVC says: error C2086: 'char llvm::ProfErrorInfoBase<enum llvm::instrprof_error>::ID' : redefinition llvm-svn: 269700
* Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-162-20/+27
| | | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Address undefined-var-template warning. - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269694
* [PM] Port indirect call promotion pass to new pass managerXinliang David Li2016-05-161-0/+9
| | | | llvm-svn: 269660
* [LV] Ensure safe VF for loops with interleaved accessesMatthew Simpson2016-05-161-1/+23
| | | | | | | | | | | | | The selection of the vectorization factor currently doesn't consider interleaved accesses. The vectorization factor is based on the maximum safe dependence distance computed by LAA. However, for loops with interleaved groups, we should instead base the vectorization factor on the maximum safe dependence distance divided by the maximum interleave factor of all the interleaved groups. Interleaved accesses not in a group will be scalarized. Differential Revision: http://reviews.llvm.org/D20241 llvm-svn: 269659
* [PM] RewriterStatepointForGC: add missing dependency.Davide Italiano2016-05-161-0/+1
| | | | llvm-svn: 269624
* Move helper classes into anonymous namespaces. NFC.Benjamin Kramer2016-05-152-1/+3
| | | | llvm-svn: 269591
* [PM/SCCP] Fix pass dependencies.Davide Italiano2016-05-151-1/+4
| | | | | | | | | | | | TargetLibraryInfoWrapperPass is a dependency of SCCP but it's not listed as such. Chandler pointed out this is an easy mistake to make which only surfaces in weird crashes with some flag combinations. This code will go away anyway at some point in the future, but as long as it's (still) exercised, try to make it correct. llvm-svn: 269589
* Rename pass name to prepare to new PM porting /NFCXinliang David Li2016-05-153-11/+13
| | | | llvm-svn: 269586
* [SCCP] Use range-based for loops. NFC.Davide Italiano2016-05-141-10/+10
| | | | llvm-svn: 269578
* Revert "Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""Chandler Carruth2016-05-142-27/+20
| | | | | | | This reverts commit r269491. It triggers warnings with Clang, breaking builds for -Werror users including several build bots. llvm-svn: 269547
* [MSan] [PowerPC] Implement PowerPC64 vararg helper.Marcin Koscielnicki2016-05-131-0/+161
| | | | | | Differential Revision: http://reviews.llvm.org/D20000 llvm-svn: 269518
* [PM] Port LowerAtomic to the new pass manager.Davide Italiano2016-05-132-42/+56
| | | | llvm-svn: 269511
* use 'match' for less indenting; NFCISanjay Patel2016-05-131-21/+20
| | | | llvm-svn: 269494
* Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"Vedant Kumar2016-05-132-20/+27
| | | | | | | | | | | | | | Transition InstrProf and Coverage over to the stricter Error/Expected interface. Changes since the initial commit: - Fix error message printing in llvm-profdata. - Check errors in loadTestingFormat() + annotateAllFunctions(). - Defer error handling in InstrProfIterator to InstrProfReader. Differential Revision: http://reviews.llvm.org/D19901 llvm-svn: 269491
* Revert "Revert "[Unroll] Implement a conservative and monotonically ↵Michael Zolotukhin2016-05-131-13/+178
| | | | | | | | | | increasing cost tracking system during the full unroll heuristic analysis that avoids counting any instruction cost until that instruction becomes "live" through a side-effect or use outside the..."" This reverts commit r269395. Try to reapply with a fix from chapuni. llvm-svn: 269486
* Correct spelling in comment (NFC)Matthew Simpson2016-05-131-1/+1
| | | | llvm-svn: 269482
* use range-loops; NFCISanjay Patel2016-05-131-7/+7
| | | | llvm-svn: 269471
OpenPOWER on IntegriCloud