summaryrefslogtreecommitdiff
path: root/lib/Analysis/PHITransAddr.cpp
Commit message (Collapse)AuthorAge
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-15
| | | | | | instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206243 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add range based accessors for the Use-Def chain of a Value.Chandler Carruth2014-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires a number of steps. 1) Move value_use_iterator into the Value class as an implementation detail 2) Change it to actually be a *Use* iterator rather than a *User* iterator. 3) Add an adaptor which is a User iterator that always looks through the Use to the User. 4) Wrap these in Value::use_iterator and Value::user_iterator typedefs. 5) Add the range adaptors as Value::uses() and Value::users(). 6) Update *all* of the callers to correctly distinguish between whether they wanted a use_iterator (and to explicitly dig out the User when needed), or a user_iterator which makes the Use itself totally opaque. Because #6 requires churning essentially everything that walked the Use-Def chains, I went ahead and added all of the range adaptors and switched them to range-based loops where appropriate. Also because the renaming requires at least churning every line of code, it didn't make any sense to split these up into multiple commits -- all of which would touch all of the same lies of code. The result is still not quite optimal. The Value::use_iterator is a nice regular iterator, but Value::user_iterator is an iterator over User*s rather than over the User objects themselves. As a consequence, it fits a bit awkwardly into the range-based world and it has the weird extra-dereferencing 'operator->' that so many of our iterators have. I think this could be fixed by providing something which transforms a range of T&s into a range of T*s, but that *can* be separated into another patch, and it isn't yet 100% clear whether this is the right move. However, this change gets us most of the benefit and cleans up a substantial amount of code around Use and User. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203364 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename some member variables from TD to DL.Rafael Espindola2014-02-18
| | | | | | TargetData was renamed DataLayout back in r165242. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201581 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Move the Dominators.h and Verifier.h headers into the IRChandler Carruth2014-01-13
| | | | | | | | | | | | | | | | | | directory. These passes are already defined in the IR library, and it doesn't make any sense to have the headers in Analysis. Long term, I think there is going to be a much better way to divide these matters. The dominators code should be fully separated into the abstract graph algorithm and have that put in Support where it becomes obvious that evn Clang's CFGBlock's can use it. Then the verifier can manually construct dominance information from the Support-driven interface while the Analysis library can provide a pass which both caches, reconstructs, and supports a nice update API. But those are very long term, and so I don't want to leave the really confusing structure until that day arrives. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199082 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct word hyphenationsAlp Toker2013-12-05
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities and contractions in nearby lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196471 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Release build: guard dump functions withManman Ren2012-09-12
| | | | | | | | | "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)" No functional change. Update r163344. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163679 91177308-0d34-0410-b5e6-96231b3b80d8
* Release build: guard dump functions with "ifndef NDEBUG"Manman Ren2012-09-06
| | | | | | | No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163344 91177308-0d34-0410-b5e6-96231b3b80d8
* Uniformize the InstructionSimplify interface by ensuring that all routinesDuncan Sands2012-03-13
| | | | | | | | | take a TargetLibraryInfo parameter. Internally, rather than passing TD, TLI and DT parameters around all over the place, introduce a struct for holding them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152623 91177308-0d34-0410-b5e6-96231b3b80d8
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
* Move Instruction::isSafeToSpeculativelyExecute out of VMCore andDan Gohman2011-12-14
| | | | | | | | | | into Analysis as a standalone function, since there's no need for it to be in VMCore. Also, update it to use isKnownNonZero and other goodies available in Analysis, making it more precise, enabling more aggressive optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146610 91177308-0d34-0410-b5e6-96231b3b80d8
* Propagate TargetLibraryInfo throughout ConstantFolding.cpp and Chad Rosier2011-12-01
| | | | | | | InstructionSimplify.cpp. Other fixups as needed. Part of rdar://10500969 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145559 91177308-0d34-0410-b5e6-96231b3b80d8
* Shorten some expressions by using ArrayRef::slice().Frits van Bommel2011-07-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135910 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert GetElementPtrInst to use ArrayRef.Jay Foad2011-07-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135904 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert SimplifyGEPInst to use ArrayRef.Jay Foad2011-07-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135482 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't include Operator.h from InstrTypes.h.Jay Foad2011-04-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129271 91177308-0d34-0410-b5e6-96231b3b80d8
* split dom frontier handling stuff out to its own DominanceFrontier header,Chris Lattner2011-01-02
| | | | | | | | so that Dominators.h is *just* domtree. Also prune #includes a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122714 91177308-0d34-0410-b5e6-96231b3b80d8
* Strip trailing whitespace.Dan Gohman2010-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119706 91177308-0d34-0410-b5e6-96231b3b80d8
* Use llvm_unreachable for "impossible" situations.Dan Gohman2010-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119705 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for PHI-translating sext, zext, and trunc instructions,Dan Gohman2010-11-18
| | | | | | | enabling more PRE. PR8586. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119704 91177308-0d34-0410-b5e6-96231b3b80d8
* In which I discover the existence of loops. Threading an operationDuncan Sands2010-11-16
| | | | | | | | | | | | over a phi node by applying it to each operand may be wrong if the operation and the phi node are mutually interdependent (the testcase has a simple example of this). So only do this transform if it would be correct to perform the operation in each predecessor of the block containing the phi, i.e. if the other operands all dominate the phi. This should fix the FFMPEG snow.c regression reported by İsmail Dönmez. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119347 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r97010, the speculative revert failed.Daniel Dunbar2010-02-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97036 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculatively revert r97010, "Add an argument to PHITranslateValue to specifyDaniel Dunbar2010-02-24
| | | | | | the DominatorTree. ...", in hopes of restoring poor old PPC bootstrap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97027 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an argument to PHITranslateValue to specify the DominatorTree. If thisBob Wilson2010-02-24
| | | | | | | | | | | | | | | | | | | | | argument is non-null, pass it along to PHITranslateSubExpr so that it can prefer using existing values that dominate the PredBB, instead of just blindly picking the first equivalent value that it finds on a uselist. Also when the DominatorTree is specified, have PHITranslateValue filter out any result that does not dominate the PredBB. This is basically just refactoring the check that used to be in GetAvailablePHITranslatedSubExpr and also in GVN. Despite my initial expectations, this change does not affect the results of GVN for any testcases that I could find, but it should help compile time. Before this change, if PHITranslateSubExpr picked a value that does not dominate, PHITranslateWithInsertion would then insert a new value, which GVN would later determine to be redundant and would replace. By picking a good value to begin with, we save GVN the extra work of inserting and then replacing a new value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97010 91177308-0d34-0410-b5e6-96231b3b80d8
* Change dbgs() back to errs() as Chris requested.David Greene2009-12-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92085 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert debug messages to use dbgs(). Generally this meansDavid Greene2009-12-23
| | | | | | | s/errs/dbgs/g except for certain special cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92046 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a minor optimization: if we haven't changed the operands of anChris Lattner2009-12-09
| | | | | | | | | | | | add, there is no need to scan the world to find the same add again. This invalidates the previous testcase, which wasn't wonderful anyway, because it needed a run of instcombine to permute the use-lists in just the right way to before GVN was run (so it was really fragile). Not a big loss. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90973 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR5733, a case where we'd replace an add with a lexically identical Chris Lattner2009-12-09
| | | | | | | binary operator that wasn't an add. In this case, a xor. Whoops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90971 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a nasty variable that was shadowing the real CurBB but with the wrong value.Chris Lattner2009-12-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90920 91177308-0d34-0410-b5e6-96231b3b80d8
* fix many input tracking bugs.Chris Lattner2009-12-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90915 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PHI translation to take the PHI out of the instinputs set and addChris Lattner2009-12-09
| | | | | | | the translated value back to it if an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90909 91177308-0d34-0410-b5e6-96231b3b80d8
* instructions defined in CurBB may be intermediate nodes of the computation.Chris Lattner2009-12-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90908 91177308-0d34-0410-b5e6-96231b3b80d8
* add dumping and sanity checking support.Chris Lattner2009-12-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90906 91177308-0d34-0410-b5e6-96231b3b80d8
* make sure that PHITransAddr keeps its 'InstInputs' list up toChris Lattner2009-12-08
| | | | | | | date when instsimplify kicks in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90901 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a typo (and -> add) and fix GetAvailablePHITranslatedSubExpr to not Chris Lattner2009-12-08
| | | | | | | side-effect the current object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90837 91177308-0d34-0410-b5e6-96231b3b80d8
* fix typoChris Lattner2009-12-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90793 91177308-0d34-0410-b5e6-96231b3b80d8
* add accessor, improve comment.Chris Lattner2009-12-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90792 91177308-0d34-0410-b5e6-96231b3b80d8
* add support for phi translation and incorpation of new expression.Chris Lattner2009-12-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90782 91177308-0d34-0410-b5e6-96231b3b80d8
* checkpoint of the new PHITransAddr code, still not done and not used byChris Lattner2009-12-07
| | | | | | | anything. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90779 91177308-0d34-0410-b5e6-96231b3b80d8
* add the start of a class used to handle phi translation in memdep andChris Lattner2009-12-04
gvn (this is just a skeleton so far). This will ultimately be used to fix a nasty miscompilation with GVN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90518 91177308-0d34-0410-b5e6-96231b3b80d8