summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/NewGVN.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* NewGVN: Remove unused includesDaniel Berlin2017-09-201-21/+0
| | | | llvm-svn: 313700
* NewGVN: Fix PR 34430 - we need to look through predicateinfo copies to ↵Daniel Berlin2017-09-051-31/+32
| | | | | | detect self-cycles of phi nodes. We also need to not ignore certain types of arguments when testing whether the phi has a backedge or was originally constant. llvm-svn: 312510
* NewGVN: Fix PR 34452 by passing instruction all the way down when we do ↵Daniel Berlin2017-09-051-7/+9
| | | | | | aggregate value simplification llvm-svn: 312509
* NewGVN: Detect copies through predicateinfoDaniel Berlin2017-09-051-1/+12
| | | | llvm-svn: 312508
* NewGVN: Change where check for original instruction in phi of ops leader ↵Daniel Berlin2017-09-051-3/+8
| | | | | | finding is done. Where we had it before, we would stop looking when we hit the original instruction, but skip it. Now we skip it and keep looking. llvm-svn: 312507
* Fix PR/33305. caused by trying to simplify expressions in phi of ops that ↵Daniel Berlin2017-09-021-50/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | should have no leaders. Summary: After a discussion with Rekka, i believe this (or a small variant) should fix the remaining phi-of-ops problems. Rekka's algorithm for completeness relies on looking up expressions that should have no leader, and expecting it to fail (IE looking up expressions that can't exist in a predecessor, and expecting it to find nothing). Unfortunately, sometimes these expressions can be simplified to constants, but we need the lookup to fail anyway. Additionally, our simplifier outsmarts this by taking these "not quite right" expressions, and simplifying them into other expressions or walking through phis, etc. In the past, we've sometimes been able to find leaders for these expressions, incorrectly. This change causes us to not to try to phi of ops such expressions. We determine safety by seeing if they depend on a phi node in our block. This is not perfect, we can do a bit better, but this should be a "correctness start" that we can then improve. It also requires a bunch of caching that i'll eventually like to eliminate. The right solution, longer term, to the simplifier issues, is to make the query interface for the instruction simplifier/constant folder have the flags we need, so that we can keep most things going, but turn off the possibly-invalid parts (threading through phis, etc). This is an issue in another wrong code bug as well. Reviewers: davide, mcrosier Subscribers: sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D37175 llvm-svn: 312401
* NewGVN: Make sure we don't incorrectly use PredicateInfo when doing PHI of opsDaniel Berlin2017-09-011-3/+10
| | | | | | | | | | | | Summary: When we backtranslate expressions, we can't use the predicateinfo, since we are evaluating them in a different context. Reviewers: davide, mcrosier Subscribers: sanjoy, Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D37174 llvm-svn: 312352
* NewGVN: Make sure we add the correct user if we swapped the comparison operandsDaniel Berlin2017-08-301-2/+4
| | | | llvm-svn: 312162
* NewGVN: Allow simplification into variablesDaniel Berlin2017-08-301-22/+21
| | | | llvm-svn: 312161
* [NewGVN] Use `auto` when the type is obvious NFCI.Davide Italiano2017-08-261-2/+2
| | | | llvm-svn: 311838
* NewGVN: Fix PR33204 - We need to add memory users when we bypass memorydefs ↵Daniel Berlin2017-08-261-4/+8
| | | | | | for loads, not just when we do it for stores. llvm-svn: 311829
* NewGVN: We weren't properly simplifying selects with equal arguments due to ↵Daniel Berlin2017-08-241-1/+1
| | | | | | a thinko. llvm-svn: 311626
* Move helper classes into anonymous namespaces.Benjamin Kramer2017-08-201-0/+2
| | | | | | No functionality change intended. llvm-svn: 311288
* [DebugCounter] Move the semicolon out of the DEBUG_COUNTER macro and require ↵Craig Topper2017-08-101-2/+2
| | | | | | | | | | it to be placed at the end of each use. This make it consistent with STATISTIC which it will often appears near. While there move one DEBUG_COUNTER instance out of an anonymous namespace. It's already declaring a static variable so the namespace is unnecessary. llvm-svn: 310637
* [NewGVN] Add CL option to control the generation of phi-of-ops (disable by ↵Chad Rosier2017-08-101-0/+6
| | | | | | | | default). Differential Revision: https://reviews.llvm.org/D36478539 llvm-svn: 310594
* [NewGVN] Use a cast instead of a dyn_cast.Chad Rosier2017-08-081-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D36478 llvm-svn: 310397
* [NewGVN] Fix the case where we have a phi-of-ops which goes away.Davide Italiano2017-08-031-6/+27
| | | | | | Patch by Daniel Berlin, fixes PR33196 (and probably something else). llvm-svn: 309988
* [NewGVN] fix typos; NFCSanjay Patel2017-08-031-8/+8
| | | | llvm-svn: 309946
* [NewGVN] Fold single-use variables. NFCI.Davide Italiano2017-08-021-5/+3
| | | | llvm-svn: 309790
* [NewGVN] Remove a (now stale) comment. NFCI.Davide Italiano2017-08-021-1/+0
| | | | llvm-svn: 309789
* [NewGVN] Check for congruency of memory accesses.Davide Italiano2017-07-111-1/+2
| | | | | | | | | | This is fine as nothing in the code relies on leader and memory leader being the same for a given congruency class. Ack'ed by Dan. Fixes PR33720. llvm-svn: 307699
* [NewGVN] Fix an innocent typo I found while debugging PR33720.Davide Italiano2017-07-111-1/+1
| | | | llvm-svn: 307694
* [NewGVN] Clarify the function invariants formatting them properly.Davide Italiano2017-07-111-3/+4
| | | | llvm-svn: 307692
* [NewGVN] Simplify a lambda a little bit. NFCI.Davide Italiano2017-07-101-3/+1
| | | | llvm-svn: 307586
* NewGVN: Remove useless test in addPhiOfOps.Daniel Berlin2017-06-291-2/+1
| | | | llvm-svn: 306702
* [NewGVN] Fix a bug that made the store verifier less effective.Davide Italiano2017-06-201-6/+4
| | | | | | | | | We weren't actually checking for duplicated stores, as the condition was always actually false. This was found by Coverity, and I have no clue how to trigger this in real-world code (although I tried for a bit). llvm-svn: 305867
* [NewGVN] Simplify findConditionEquivalence(). NFCI.Davide Italiano2017-06-191-3/+1
| | | | llvm-svn: 305707
* NewGVN: Fix PR 33461, caused by slightly overzealous verification.Daniel Berlin2017-06-191-18/+30
| | | | llvm-svn: 305657
* NewGVN: This is wrong by inspection, it will not cause an issue currently ↵Daniel Berlin2017-06-141-1/+1
| | | | | | due to other limitations, i believe. This also means i can't make a test for it. llvm-svn: 305415
* Fix signed/unsigned comparison warning; NFCGeorge Burgess IV2017-06-131-1/+1
| | | | llvm-svn: 305262
* NewGVN: Fix PR/33187. This is a bug caused by two things:Daniel Berlin2017-06-061-32/+48
| | | | | | | | | | | | | 1. When there is no perfect iteration order, we can't let phi nodes put themselves in terms of things that come later in the iteration order, or we will endlessly cycle (the normal RPO algorithm clears the hashtable to avoid this issue). 2. We are sometimes erasing the wrong expression (causing pessimism) because our equality says loads and stores are the same. We introduce an exact equality function and use it when erasing to make sure we erase only identical expressions, not equivalent ones. llvm-svn: 304807
* NewGVN: Fix PR 33185 by checking whether we need to recursivelyDaniel Berlin2017-05-311-23/+15
| | | | | | generate a phi of ops, which we don't currently support. llvm-svn: 304272
* NewGVN: Compute hash value of expression on demand and use it in inequality ↵Daniel Berlin2017-05-301-30/+12
| | | | | | testing. llvm-svn: 304195
* NewGVN: Fix PR33194, memory corruption by putting temporary instructions in ↵Daniel Berlin2017-05-301-5/+8
| | | | | | tables sometimes. llvm-svn: 304194
* Make helper functions static. NFC.Benjamin Kramer2017-05-261-0/+2
| | | | llvm-svn: 304029
* NewGVN: Fix PR 33119, PR 33129, due to regressed undef handlingDaniel Berlin2017-05-251-22/+42
| | | | | | Fix PR33120 and others by eliminating self-cycles a different way. llvm-svn: 303875
* [NewGVN] Update additionalUsers when we simplify to a value.Davide Italiano2017-05-241-0/+4
| | | | | | | | | | Otherwise we don't revisit an instruction that could be simplified, and when we verify, we discover there's something that changed, i.e. what we had wasn't a maximal fixpoint. Fixes PR32836. llvm-svn: 303715
* NewGVN: Fix PR 33116, the memoryphi version of bug 32838.Daniel Berlin2017-05-211-6/+5
| | | | llvm-svn: 303521
* NewGVN: Cleanup some repeated code using some templated helpersDaniel Berlin2017-05-211-40/+40
| | | | llvm-svn: 303520
* NewGVN: Fix printing of simplified expressionDaniel Berlin2017-05-211-1/+1
| | | | llvm-svn: 303519
* [NewGVN] Create a StoreExpression instead of a VariableExpression.Davide Italiano2017-05-201-1/+1
| | | | | | | | | | | | | In the case where we have an operand defined by a lod of the same memory location. Historically this was a VariableExpression because we wanted to make sure they ended up in the same class, but if we create the right expression, they end up in the same class anyway. Fixes PR32897. Thanks to Dan for the detailed discussion and the fix suggestion. llvm-svn: 303475
* [NewGVN] Get rid of an assertion.Davide Italiano2017-05-201-1/+0
| | | | | | | | | | This was here because we don't want to switch leaders too much, in order to avoid fixpoint(ing) issue, but it's not sure if it matters in practice. A first step towards fixing PR32897. llvm-svn: 303473
* NewGVN: Fix PR32838.Daniel Berlin2017-05-191-22/+53
| | | | | | | | | | This is a complicated bug involving two issues: 1. What do we do with phi nodes when we prove all arguments are not live? 2. When is it safe to use value leaders to determine if we can ignore an argumnet? llvm-svn: 303453
* Last of the major pieces to NewGVN - yay!Daniel Berlin2017-05-191-117/+525
| | | | | | | | | | | | | | | | | | | | | | Summary: NewGVN: Handle equivalence between phi of ops and op of phis. This makes our GVN mostly-complete. It would be complete, modulo some deliberate choices we make. This means it detects roughly all herband equivalences in polynomial time, including cases notoriously hard for other GVN's to detect. It also detects a very large swath of the cases we currently rely on instcombine to detect that involve folding upwards through phis. Fixes PR 31125, 31463, PR 31868 Reviewers: davide Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D32151 llvm-svn: 303444
* NewGVN: Get rid of most dominating leader checkDaniel Berlin2017-05-191-24/+2
| | | | llvm-svn: 303443
* [NewGVN] Delete the old store when we find congruent to a load.Davide Italiano2017-05-191-2/+2
| | | | | | | (or non-store, more in general). Fixes PR33086. Caught by the store verifier. llvm-svn: 303406
* [NewGVN] Break infinite recursion in singleReachablePHIPath().Davide Italiano2017-05-181-6/+20
| | | | | | | | | | | | We can have cycles between PHIs and this causes singleReachablePhi() to call itself indefintely (until we run out of stack). The proper solution would be that of computing SCCs, but it's not worth for now, so just keep a visited set and give up when we find a cycle. Thanks to Dan for the discussion/help with this. Fixes PR33014. llvm-svn: 303393
* [NewGVN] Replace predicate info leftovers.Davide Italiano2017-05-181-0/+6
| | | | | | | This time with an additional fix, i.e. we remove the dead @llvm.ssa.copy instruction. llvm-svn: 303385
* BitVector: add iterators for set bitsFrancis Visoiu Mistrih2017-05-171-2/+1
| | | | | | Differential revision: https://reviews.llvm.org/D32060 llvm-svn: 303227
* NewGVN: Only do something in verifyStoreExpressions if assertions are ↵Daniel Berlin2017-05-161-0/+2
| | | | | | enabled, to avoid unused code warnings. llvm-svn: 303201
OpenPOWER on IntegriCloud