summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/NewGVN
Commit message (Collapse)AuthorAgeFilesLines
...
* NewGVN: Instead of changeToUnreachable, insert an instruction SimplifyCFG ↵Daniel Berlin2017-01-302-0/+2
| | | | | | will turn into unreachable when it runs llvm-svn: 293515
* Update pr31758.ll for unreachable revertDaniel Berlin2017-01-301-1/+1
| | | | llvm-svn: 293502
* Revert "NewGVN: Make unreachable blocks be marked with unreachable"Daniel Berlin2017-01-302-20/+20
| | | | | | | | | This reverts commit r293196 Besides making things look nicer, ATM, we'd like to preserve analysis more than we'd like to destroy the CFG. We'll probably revisit in the future llvm-svn: 293501
* NewGVN: Add basic dead and redundant store eliminationDaniel Berlin2017-01-272-1/+126
| | | | | | | | | | | | | | | | | | | | Summary: This adds basic dead and redundant store elimination to NewGVN. Unlike our current DSE, it will happily do cross-block DSE if it meets our requirements. We get a bunch of DSE's simple.ll cases, and some stuff it doesn't. Unlike DSE, however, we only try to eliminate stores of the same value to the same memory location, not just general stores to the same memory location. Reviewers: davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29149 llvm-svn: 293258
* NewGVN: Fix bug exposed by PR31761Daniel Berlin2017-01-261-3/+4
| | | | | | | | | | | | | | | | | | | Summary: This does not actually fix the testcase in PR31761 (discussion is ongoing on the testcase), but does fix a bug it exposes, where stores were not properly clobbering loads. We accomplish this by unifying the memory equivalence infratructure back into the normal congruence infrastructure, and then properly destroying congruence classes when memory state leaders disappear. Reviewers: davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29195 llvm-svn: 293216
* NewGVN: Fix output of pr31578 testcase now that we mark unreachable blocks ↵Daniel Berlin2017-01-261-13/+12
| | | | | | as unreachable llvm-svn: 293198
* NewGVN: Make unreachable blocks be marked with unreachableDaniel Berlin2017-01-262-20/+20
| | | | llvm-svn: 293196
* [NewGVN] Skip uses in unreachable blocks.Davide Italiano2017-01-261-0/+37
| | | | | | | | Otherwise we ask for a domtree node that's not there, and we crash. Differential Revision: https://reviews.llvm.org/D29145 llvm-svn: 293122
* NewGVN: Remove pr31686.ll, it is tested by pr31594.ll, which is much smaller ↵Daniel Berlin2017-01-201-2016/+0
| | | | | | and simpler llvm-svn: 292649
* NewGVN: Fix PR 31686 and PR 31698 by rewriting store leader handling.Daniel Berlin2017-01-204-1/+2049
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This rewrites store expression/leader handling. We no longer use the value operand as the leader, instead, we store it separately. We also now store the stored value as part of the expression, and compare it when comparing stores for equality. This enables us to get rid of a bunch of our previous hacks and machinations, as the existing machinery takes care of everything *except* updating the stored value on classes. The only time we have to update it is if the storecount goes to 0, and when we do, we destroy it. Since we no longer use the value operand as the leader, during elimination, we have to use the value operand. Doing this also fixes a bunch of store forwarding cases we were missing. Any value operand we use is guaranteed to either be updated by previous eliminations, or minimized by future ones. (IE the fact that we don't use the most dominating value operand when it's not a constant does not affect anything). Sadly, this change also exposes that we didn't pay attention to the output of the pr31594.ll test, as it also very clearly exposes the same store leader bug we are fixing here. (I added pr31682.ll anyway, but maybe we think that's too large to be useful) On the plus side, propagate-ir-flags.ll now passes due to the corrected store forwarding. This change was 3 stage'd on darwin and linux, with the full test-suite. Reviewers: davide Subscribers: llvm-commits llvm-svn: 292648
* NewGVN: Fix PR 31682, an overactive assert.Daniel Berlin2017-01-201-0/+42
| | | | | | | | Part of the assert has been left active for further debugging. The other part has been turned into a stat for tracking for the moment. llvm-svn: 292583
* [AliasAnalysis] Fences do not modify constant memory locationAnna Thomas2017-01-201-0/+20
| | | | | | | | | | | | | | | | | | | Summary: Fence instructions are currently marked as `ModRef` for all memory locations. We can improve this for constant memory locations (such as constant globals), since fence instructions cannot modify these locations. This helps us to forward constant loads across fences (added test case in GVN). There were no changes in behaviour for similar test cases in early-cse and licm. Reviewers: dberlin, sanjoy, reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28914 llvm-svn: 292546
* NewGVN: Fix PR31613 test regex namingDaniel Berlin2017-01-131-2/+2
| | | | llvm-svn: 291979
* NewGVN: Move leaders around properly to ensure we have a canonical ↵Daniel Berlin2017-01-131-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | dominating leader. Fixes PR 31613. Summary: This is a testcase where phi node cycling happens, and because we do not order the leaders by domination or anything similar, the leader keeps changing. Using std::set for the members is too expensive, and we actually don't need them sorted all the time, only at leader changes. We could keep both a set and a vector, and keep them mostly sorted and resort as necessary, or use a set and a fibheap, but all of this seems premature. After running some statistics, we are able to avoid the vast majority of sorting by keeping a "next leader" field. Most congruence classes only have leader changes once or twice during GVN. Reviewers: davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28594 llvm-svn: 291968
* [Devirtualization] MemDep returns non-local !invariant.group dependenciesPiotr Padlewski2017-01-122-5/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Memory Dependence Analysis was limited to return only local dependencies for invariant.group handling. Now it returns NonLocal when it finds it and then by asking getNonLocalPointerDependency we get found dep. Thanks to this we are able to devirtualize loops! void indirect(A &a, int n) { for (int i = 0 ; i < n; i++) a.foo(); } void test(int n) { A a; indirect(a); } After inlining a.foo() will be changed to direct call, even if foo and A::A() is external (but only if vtable definition is be available). Reviewers: nlewycky, dberlin, chandlerc, rsmith Subscribers: mehdi_amini, davide, llvm-commits Differential Revision: https://reviews.llvm.org/D28137 llvm-svn: 291762
* NewGVN: Fix PR31594, by tracking the store count of congruenceDaniel Berlin2017-01-111-0/+119
| | | | | | | | | | | classes, and updating checking to allow for equivalence through reachability. (Sadly, the checking here is not perfect, and can't be made perfect, so we'll have to disable it after we are satisfied with correctness. Right now it is just "very unlikely" to happen.) llvm-svn: 291698
* NewGVN: Fix PR 31573, a failure to verify memory congruency due toDaniel Berlin2017-01-091-0/+42
| | | | | | | not excluding ourselves when checking if any equivalent stores exist. llvm-svn: 291421
* [MemDep] NFC walk invariant.group graph only downPiotr Padlewski2017-01-081-0/+52
| | | | | | | | | | | | | | Summary: By using stripPointerCasts we can get to the root value and then walk down the bitcast graph Reviewers: reames Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28181 llvm-svn: 291405
* NewGVN: Make sure we properly lookup operand leaders while creatingDaniel Berlin2017-01-072-0/+430
| | | | | | | congruence classes for stores, and then keep them up to date. Add testcases. llvm-svn: 291351
* NewGVN: Fix PR 31501.Daniel Berlin2017-01-072-0/+173
| | | | | | | | | | | | Summary: LLVM's non-standard notion of phi nodes means we can't both try to substitute for undef in phi nodes *and* use phi nodes as leaders all the time. This changes NewGVN to use the same semantics as SimplifyPHINode to decide which phi nodes are equivalent. Reviewers: davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28312 llvm-svn: 291308
* NewGVN: Add a test case for equivalent phis.Daniel Berlin2017-01-021-0/+68
| | | | llvm-svn: 290830
* NewGVN: Add forgotten testcase for PR 31483Daniel Berlin2017-01-021-0/+106
| | | | llvm-svn: 290829
* [MemDep] Handle gep with zeros for invariant.groupPiotr Padlewski2016-12-301-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: gep 0, 0 is equivalent to bitcast. LLVM canonicalizes it to getelementptr because it make SROA can then handle it. Simple case like void g(A &a) { z(a); if (glob) a.foo(); } void testG() { A a; g(a); } was not devirtualized with -fstrict-vtable-pointers because luck of handling for gep 0 in Memory Dependence Analysis Reviewers: dberlin, nlewycky, chandlerc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28126 llvm-svn: 290763
* NewGVN: Fix PR 31491 by ensuring that we touch the right instructions. ↵Daniel Berlin2016-12-291-0/+30
| | | | | | Change to one based numbering so we can assert we don't cause the same bug again. llvm-svn: 290724
* Don't use our own incorrect version of isTriviallyDeadInstruction in NewGVN. ↵Daniel Berlin2016-12-261-0/+34
| | | | | | Fixes PR/31472 llvm-svn: 290549
* [NewGVN] Change test to reflect difference between GVN and NewGVN.Davide Italiano2016-12-261-1/+2
| | | | | | | | | | | | The current GVN algorithm folds unconditional branches to, it claims, expose more PRE oportunities. The folding, if really needed, (which is not sure, as it's not really proved it improves analysis) can be done by an earlier cleanup pass instead of GVN itself. Ack'ed/SGTM'd by Daniel Berlin. Differential Revision: https://reviews.llvm.org/D28117 llvm-svn: 290546
* Value number stores and memory states so we can detect when memory states ↵Daniel Berlin2016-12-251-0/+80
| | | | | | | | | | | | are equivalent (IE store of same value to memory). Reviewers: davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28084 llvm-svn: 290525
* Fix some DOS-style line endings that I suspect snuck in from one of theChandler Carruth2016-12-231-100/+100
| | | | | | | frustrating Subversion clients that fails to do line ending translation of text files. llvm-svn: 290404
* [NewGVN] Add the pass to PassRegistry.def.Davide Italiano2016-12-222-1/+1
| | | | | | | We need to hook up here to get it working with the new PM. Add a test while here (and remove a typo). llvm-svn: 290350
* [GVN] Initial check-in of a new global value numbering algorithm.Davide Italiano2016-12-2288-0/+5710
The code have been developed by Daniel Berlin over the years, and the new implementation goal is that of addressing shortcomings of the current GVN infrastructure, i.e. long compile time for large testcases, lack of phi predication, no load/store value numbering etc... The current code just implements the "core" GVN algorithm, although other pieces (load coercion, phi handling, predicate system) are already implemented in a branch out of tree. Once the core is stable, we'll start adding pieces on top of the base framework. The test currently living in test/Transform/NewGVN are a copy of the ones in GVN, with proper `XFAIL` (missing features in NewGVN). A flag will be added in a future commit to enable NewGVN, so that interested parties can exercise this code easily. Differential Revision: https://reviews.llvm.org/D26224 llvm-svn: 290346
OpenPOWER on IntegriCloud