summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Avoid overly large SmallPtrSet/SmallSetMatthias Braun2016-01-307-8/+8
| | | | | | | These sets perform linear searching in small mode so it is never a good idea to use SmallSize/N bigger than 32. llvm-svn: 259283
* function names start with a lower case letter ; NFCSanjay Patel2016-01-291-25/+25
| | | | llvm-svn: 259264
* fix formatting; NFCSanjay Patel2016-01-291-4/+8
| | | | llvm-svn: 259262
* Fix typo in LoopSimplifyCFGFiona Glaser2016-01-291-1/+1
| | | | llvm-svn: 259261
* Add LoopSimplifyCFG passFiona Glaser2016-01-293-0/+117
| | | | | | | | | | | | | | | | | | | | | Loop transformations can sometimes fail because the loop, while in valid rotated LCSSA form, is not in a canonical CFG form. This is an extremely simple pass that just merges obviously redundant blocks, which can be used to fix some known failure cases. In the future, it may be enhanced with more cases (and have code shared with SimplifyCFG). This allows us to run LoopSimplifyCFG -> LoopRotate -> LoopUnroll, so that SimplifyCFG cleans up the loop before Rotate tries to run. Not currently used in the pass manager, since this pass doesn't do anything unless you can hook it up in an LPM with other loop passes. It'll be added once Chandler cleans up things to allow this. Tested in a custom pipeline out of tree to confirm it works in practice (in addition to the included trivial test). llvm-svn: 259256
* [InstCombine] avoid an insertelement transformation that induces the ↵Sanjay Patel2016-01-291-1/+17
| | | | | | | | | | | opposite extractelement fold (PR26354) We would infinite loop because we created a shufflevector that was wider than needed and then failed to combine that with the insertelement. When subsequently visiting the extractelement from that shuffle, we see that it's unnecessary, delete it, and trigger another visit to the insertelement. llvm-svn: 259236
* Fix the buildDavid Majnemer2016-01-291-1/+1
| | | | llvm-svn: 259215
* [SLP] Fix printing of debug statement (NFC)Matthew Simpson2016-01-291-1/+1
| | | | llvm-svn: 259212
* [RS4GC] Address post-commit review on r259208 from DavidSanjoy Das2016-01-291-8/+5
| | | | | | NFC llvm-svn: 259211
* [RS4GC] Remove unnecessary const_cast; NFCSanjoy Das2016-01-291-1/+1
| | | | | | | GCRelocateInst::getDerivedPtr already returns a non-const llvm::Value pointer. llvm-svn: 259209
* [RS4GC] Minor local cleanup to StabilizeOrder; NFCSanjoy Das2016-01-291-21/+20
| | | | | | | | | - Locally declare struct, and call it BaseDerivedPair - Use a lambda to compare, instead of a singleton with uninitialized fields - Add a constructor to BaseDerivedPair and use SmallVector::emplace_back llvm-svn: 259208
* Revert "Reapply commit r258404 with fix"David Majnemer2016-01-291-226/+11
| | | | | | This reverts commit r258929, it caused PR26364. llvm-svn: 259148
* [GVN] Add clarifying assert [NFCI]Philip Reames2016-01-291-0/+5
| | | | | | Just adding an assert which makes invariants between AnalyzeLoadsFromClobberingLoads and GetLoadValueForLoad slightly more clear. llvm-svn: 259145
* [RS4GC] Minor cleanups enabled by the previous change; NFCSanjoy Das2016-01-291-14/+6
| | | | llvm-svn: 259133
* [RS4GC] Delete code that is dead due to r259129; NFCSanjoy Das2016-01-291-83/+36
| | | | llvm-svn: 259132
* [RS4GC] Clamp UseDeoptBundles to true and update testsSanjoy Das2016-01-291-2/+2
| | | | | | | | | | | | | | | | The full diff for the test directory may be hard to read because of the filename clash; so here's all that happened as far as the tests are concerned: ``` cd test/Transforms/RewriteStatepointsForGC git rm *ll git mv deopt-bundles/* ./ rmdir deopt-bundles find . -name '*.ll' | xargs gsed -i 's/-rs4gc-use-deopt-bundles //g' ``` llvm-svn: 259129
* [PlaceSafepoints] Use DEBUG() instead of TraceLSPSanjoy Das2016-01-281-11/+3
| | | | | | DEBUG() is the more idiomatic LLVM style. llvm-svn: 259121
* [PlaceSafepoints] Misc. minor cleanups; NFCSanjoy Das2016-01-281-111/+89
| | | | | | | | | | | | These changes are aimed at bringing PlaceSafepoints up to code with the LLVM coding guidelines: - Fix variable naming - Use DenseSet instead of std::set - Remove dead code - Minor local code simplifications llvm-svn: 259112
* [PlaceSafepoints] Remvoe unused headers, and sort #includes; NFCSanjoy Das2016-01-281-19/+4
| | | | llvm-svn: 259111
* [PlaceSafepoints] Eliminate dead code; NFCSanjoy Das2016-01-281-238/+0
| | | | | | | Now that NoStatepoints is a constant `true`, we can get rid of a bunch of dead code. llvm-svn: 259110
* [PlaceSafepoints] Clamp NoStatepoints to trueSanjoy Das2016-01-281-4/+1
| | | | | | | | | This change permanently clamps -spp-no-statepoints to true (the code deletion will come later). Tests that specifically tested PlaceSafepoint's ability to wrap calls in gc.statepoint have been moved to RS4GC's test suite. llvm-svn: 259096
* [SplitModule] In split module utility we should never separate alias with ↵Sergei Larin2016-01-281-0/+7
| | | | | | | | | | | | its aliasee. Summary: When splitting module with preserving locals, we currently do not handle case of global alias being separated with its aliasee. Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16585 llvm-svn: 259075
* [LICM] Keep metadata on control equivalent hoistsSanjoy Das2016-01-281-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If the instruction we're hoisting out of a loop into its preheader is guaranteed to have executed in the loop, then the metadata associated with the instruction (e.g. !range or !dereferenceable) is valid in the preheader. This is because once we're in the preheader, we know we're eventually going to reach the location the metadata was valid at. This change makes LICM smarter around this, and helps it recognize cases like these: ``` do { int a = *ptr; !range !0 ... } while (i++ < N); ``` to ``` int a = *ptr; !range !0 do { ... } while (i++ < N); ``` Earlier we'd drop the `!range` metadata after hoisting the load from `ptr`. Reviewers: igor-laevsky Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D16669 llvm-svn: 259053
* Minor code formatting cleanup. NFC.Junmo Park2016-01-281-1/+1
| | | | llvm-svn: 259010
* less indenting; NFCISanjay Patel2016-01-281-107/+109
| | | | llvm-svn: 259002
* [SimplifyCFG] limit recursion depth when speculating instructions (PR26308)Sanjay Patel2016-01-271-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix for: https://llvm.org/bugs/show_bug.cgi?id=26308 With the switch to using the TTI cost model in: http://reviews.llvm.org/rL228826 ...it became possible to hit a zero-cost cycle of instructions (gep -> phi -> gep...), so we need a cap for the recursion in DominatesMergePoint(). A recursion depth parameter was already added for a different reason in: http://reviews.llvm.org/rL255660 ...so we can just set a limit for it. I pulled "10" out of the air and made it an independent parameter that we can play with. It might be higher than it needs to be given the currently low default value of PHINodeFoldingThreshold (2). That's the starting cost value that we enter the recursion with, and most instructions have cost set to TCC_Basic (1), so I don't think we're going to speculate more than 2 instructions with the current parameters. As noted in the review and the TODO comment, we can do better than just limiting recursion depth. Differential Revision: http://reviews.llvm.org/D16637 llvm-svn: 258971
* Add support for objc_unsafeClaimAutoreleasedReturnValue to theJohn McCall2016-01-271-16/+16
| | | | | | | | | | | | | | | | ObjC ARC Optimizer. The main implication of this is: 1. Ensuring that we treat it conservatively in terms of optimization. 2. We put the ASM marker on it so that the runtime can recognize objc_unsafeClaimAutoreleasedReturnValue from releaseRV. <rdar://problem/21567064> Patch by Michael Gottesman! llvm-svn: 258970
* Make more headers self-contained.Benjamin Kramer2016-01-271-0/+1
| | | | | | A lot of this comes from the new complete type requirement of DenseMap. llvm-svn: 258956
* [IndVars] Hoist DataLayout load out of loop; NFCSanjoy Das2016-01-271-2/+2
| | | | llvm-svn: 258946
* [IndVars] Use isSCEVable; NFCSanjoy Das2016-01-271-2/+1
| | | | llvm-svn: 258945
* [IndVars] Use range-for; NFCSanjoy Das2016-01-271-3/+1
| | | | llvm-svn: 258944
* Move SafeStack to CodeGen.Benjamin Kramer2016-01-273-762/+0
| | | | | | | It depends on the target machinery, that's not available for instrumentation passes. llvm-svn: 258942
* Make some headers self-contained, remove unused includes that violate layering.Benjamin Kramer2016-01-271-1/+0
| | | | llvm-svn: 258937
* Reapply commit r258404 with fixMatthew Simpson2016-01-271-11/+226
| | | | | | | | | | | | | | This patch is the second attempt to reapply commit r258404. There was bug in the initial patch and subsequent fix (mentioned below). The initial patch caused an assertion because we were computing smaller type sizes for instructions that cannot be demoted. The fix first determines the instructions that will be demoted, and then applies the smaller type size to only those instructions. This should fix PR26239 and PR26307. llvm-svn: 258929
* [IndVarSimplify] Rewrite loop exit values with their initial values from ↵Chen Li2016-01-271-0/+80
| | | | | | | | | | | | | | | | | | | | | | loop preheader Summary: This is a revised version of D13974, and the following quoted summary are from D13974 "This patch adds support to check if a loop has loop invariant conditions which lead to loop exits. If so, we know that if the exit path is taken, it is at the first loop iteration. If there is an induction variable used in that exit path whose value has not been updated, it will keep its initial value passing from loop preheader. We can therefore rewrite the exit value with its initial value. This will help remove phis created by LCSSA and enable other optimizations like loop unswitch." D13974 was committed but failed one lnt test. The bug was that we only checked the condition from loop exit's incoming block was a loop invariant. But there could be another condition from loop header to that incoming block not being a loop invariant. This would produce miscompiled code. This patch fixes the issue by checking if the incoming block is loop header, and if not, don't perform the rewrite. The could be further improved by recursively checking all conditions leading to loop exit block, but I'd like to check in this simple version first and improve it with future patches. Reviewers: sanjoy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16570 llvm-svn: 258912
* [SLPVectorizer] Swap the checking order of isCommutative and isConsecutiveAccessHaicheng Wu2016-01-271-4/+4
| | | | | | NFC llvm-svn: 258909
* Revert "Revert "[SimplifyCFG] allow speculation of exactly one expensive ↵David Majnemer2016-01-271-4/+19
| | | | | | | | | instruction (PR24818)"" This reverts commit r258903 which reverted r255660. r258903 was an accidental commit and should not have been committed. llvm-svn: 258905
* [SimplifyCFG] Don't mistake icmp of and for a tree of comparisonsDavid Majnemer2016-01-271-2/+3
| | | | | | | | | | | | | | | | SimplifyCFG tries to turn complex branch conditions into a switch. Some of it's logic attempts to reason about bitwise arithmetic produced by InstCombine. InstCombine can turn things like (X == 2) || (X == 3) into (X & 1) == 2 and so SimplifyCFG tries to detect when this occurs so that it can produce a switch instruction. However, the legality checking was not sufficient to determine whether or not this had occured. Correctly check this case by requiring that the right-hand side of the comparison be a power of two. This fixes PR26323. llvm-svn: 258904
* Revert "[SimplifyCFG] allow speculation of exactly one expensive instruction ↵David Majnemer2016-01-271-19/+4
| | | | | | | | (PR24818)" This reverts commit r255660. llvm-svn: 258903
* [GVN] Split AvailableValueInBlock into two parts [NFC]Philip Reames2016-01-261-29/+69
| | | | | | | | AvailableValue is the part that represents the potential rematerialization. AvailableValueInBlock is simply a pair of an AvailableValue and a BB which we might materialize it in. This is motivated by http://reviews.llvm.org/D16608. The intent is that we'll have a single function which handles the local case which both local and non-local will use to identify available values. Once that's done, the local case can rematerialize at the use site and the non-local case can do the SSA construction as it does currently. llvm-svn: 258882
* Remove autoconf supportChris Bieneman2016-01-269-149/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; ↵Eugene Zelenko2016-01-263-5/+5
| | | | | | | | other minor fixes. Differential revision: reviews.llvm.org/D16568 llvm-svn: 258831
* Reassociate: Reprocess RedoInsts after each instAditya Nandakumar2016-01-261-28/+39
| | | | | | | | | | Previously the RedoInsts was processed at the end of the block. However it was possible that it left behind some instructions that were not canonicalized. This should guarantee that any previous instruction in the basic block is canonicalized before we process a new instruction. llvm-svn: 258830
* [LibCallSimplifier] fold memset(malloc(x), 0, x) --> calloc(1, x)Sanjay Patel2016-01-261-0/+81
| | | | | | | | | | | | | This is a step towards solving PR25892: https://llvm.org/bugs/show_bug.cgi?id=25892 It won't handle the reported case. As noted by the 'TODO' comments in the patch, we need to relax the hasOneUse() constraint and also match patterns that include memset_chk() and the llvm.memset() intrinsic in addition to memset(). Differential Revision: http://reviews.llvm.org/D16337 llvm-svn: 258816
* Revert "Reapply commit r258404 with fix"Matthew Simpson2016-01-261-226/+11
| | | | | | | | This commit exposes a crash in computeKnownBits on the Chromium buildbots. Reverting to investigate. Reference: https://llvm.org/bugs/show_bug.cgi?id=26307 llvm-svn: 258812
* [LIR] Add support for structs and hand unrolled loopsHaicheng Wu2016-01-262-124/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a recommit of r258620 which causes PR26293. The original message: Now LIR can turn following codes into memset: typedef struct foo { int a; int b; } foo_t; void bar(foo_t *f, unsigned n) { for (unsigned i = 0; i < n; ++i) { f[i].a = 0; f[i].b = 0; } } void test(foo_t *f, unsigned n) { for (unsigned i = 0; i < n; i += 2) { f[i] = 0; f[i+1] = 0; } } llvm-svn: 258777
* [GVN] Rearrange code to make local vs non-local cases more obvious [NFCI]Philip Reames2016-01-251-13/+18
| | | | llvm-svn: 258747
* [cfi] Cross-DSO CFI diagnostic mode (LLVM part).Evgeniy Stepanov2016-01-251-15/+14
| | | | | | | | * __cfi_check gets a 3rd argument: ubsan handler data * Instead of trapping on failure, call __cfi_check_fail which must be present in the module (generated in the frontend). llvm-svn: 258746
* [GVN] Factor out common code [NFCI]Philip Reames2016-01-251-40/+21
| | | | | | We had the same code duplicated for each type of Def. We also have the entire block duplicated between the local and non-local case, but let's start with local cleanup. llvm-svn: 258740
* Enable loopreroll to rerool loop with pointer induction variable.Lawrence Hu2016-01-251-50/+123
| | | | | | | | | | | | | | Example: while (buf !=end ) { S += buf[0]; S += buf[1]; buf +=2; }; Differential Revision: http://reviews.llvm.org/D13151 llvm-svn: 258709
OpenPOWER on IntegriCloud