summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/ValueMapper.cpp
Commit message (Collapse)AuthorAge
* [C++] Use 'nullptr'. Transforms edition.Craig Topper2014-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207196 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend RemapInstruction and friends to take an optional new parameter, a ↵James Molloy2013-05-28
| | | | | | | | ValueMaterializer. Extend LinkModules to pass a ValueMaterializer to RemapInstruction and friends to lazily create Functions for lazily linked globals. This is a big win when linking small modules with large (mostly unused) library modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182776 91177308-0d34-0410-b5e6-96231b3b80d8
* Add ArrayRef constructor from None, and do the cleanups that this ↵Dmitri Gribenko2013-05-05
| | | | | | | | | constructor enables Patch by Robert Wilhelm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181138 91177308-0d34-0410-b5e6-96231b3b80d8
* Linker: correctly link in dbg.declareManman Ren2013-01-31
| | | | | | | | | | | | | | | | | | | | This is a re-worked version of r174048. Given source IR: call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !14), !dbg !15 we used to generate call void @llvm.dbg.declare(metadata !27, metadata !28), !dbg !29 !27 = metadata !{null} With this patch, we will correctly generate call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !27), !dbg !28 Looking up %argc.addr in ValueMap will return null, since %argc.addr is already correctly set up, we can use identity mapping. rdar://problem/13089880 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174093 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r173946. This breaks compilation of googletest with ClangAlexey Samsonov2013-01-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174048 91177308-0d34-0410-b5e6-96231b3b80d8
* Linker: correctly link in dbg.declareManman Ren2013-01-30
| | | | | | | | | | | | | | | | | Given source IR: call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !14), !dbg !15 we used to generate call void @llvm.dbg.declare(metadata !27, metadata !28), !dbg !29 !27 = metadata !{null} With this patch, we will correctly generate call void @llvm.dbg.declare(metadata !{i32* %argc.addr}, metadata !27), !dbg !28 Looking up %argc.addr in ValueMap will return null, since %argc.addr is already correctly set up, we can use identity mapping. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173946 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
* Rename virtual table anchors from Anchor() to anchor() for consistency with ↵Craig Topper2012-09-26
| | | | | | the rest of the tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164666 91177308-0d34-0410-b5e6-96231b3b80d8
* We need to map DebugLoc. It leads to Fuction * (through subprogram entry ↵Devang Patel2011-08-04
| | | | | | node) which should be appropriately mapped. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136910 91177308-0d34-0410-b5e6-96231b3b80d8
* fix rdar://9776316 - type remapping needed for inline asm blobs,Chris Lattner2011-07-15
| | | | | | | fixing some objc llvm-test crashes with LTO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135324 91177308-0d34-0410-b5e6-96231b3b80d8
* Undo r135191 (i.e. reapply Chris's patch. Now linker maps NamedMDNodes ↵Devang Patel2011-07-14
| | | | | | first, so there is not any need to map DebugLoc). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135205 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r135172 until Devang and I figure out the right answer.Chris Lattner2011-07-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135191 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop the ValueMapper from calling getAllMetadata, which unpacks DebugLoc intoChris Lattner2011-07-14
| | | | | | | | | an MDNode. This saves a bunch of time and memory in the IR linker, e.g. when doing LTO of files with debug info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135172 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstate r133513 (reverted in r133700) with an additional fix for aJay Foad2011-06-23
| | | | | | | -Wshorten-64-to-32 warning in Instructions.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133708 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r133513:Eric Christopher2011-06-23
| | | | | | | | | | | "Reinstate r133435 and r133449 (reverted in r133499) now that the clang self-hosted build failure has been fixed (r133512)." Due to some additional warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133700 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstate r133435 and r133449 (reverted in r133499) now that the clangJay Foad2011-06-21
| | | | | | self-hosted build failure has been fixed (r133512). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133513 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r133435 and r133449 to appease buildbots.Chad Rosier2011-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133499 91177308-0d34-0410-b5e6-96231b3b80d8
* Change how PHINodes store their operands.Jay Foad2011-06-20
| | | | | | | | | | | | | | | | | | | | Change PHINodes to store simple pointers to their incoming basic blocks, instead of full-blown Uses. Note that this loses an optimization in SplitCriticalEdge(), because we can no longer walk the use list of a BasicBlock to find phi nodes. See the comment I removed starting "However, the foreach loop is slow for blocks with lots of predecessors". Extend replaceAllUsesWith() on a BasicBlock to also update any phi nodes in the block's successors. This mimics what would have happened when PHINodes were proper Users of their incoming blocks. (Note that this only works if OldBB->replaceAllUsesWith(NewBB) is called when OldBB still has a terminator instruction, so it still has some successors.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133435 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9214: Convert Metadata API to use ArrayRef.Jay Foad2011-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129932 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR9015, a crash linking recursive metadata.Chris Lattner2011-01-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124099 91177308-0d34-0410-b5e6-96231b3b80d8
* Revamp the ValueMapper interfaces in a couple ways:Chris Lattner2011-01-08
| | | | | | | | | | | | | | | | | | 1. Take a flags argument instead of a bool. This makes it more clear to the reader what it is used for. 2. Add a flag that says that "remapping a value not in the map is ok". 3. Reimplement MapValue to share a bunch of code and be a lot more efficient. For lookup failures, don't drop null values into the map. 4. Using the new flag a bunch of code can vaporize in LinkModules and LoopUnswitch, kill it. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123058 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR8313 by changing ValueToValueMap use a TrackingVH.Rafael Espindola2010-10-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116390 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r112091 and r111922, support for metadata linking, with aDan Gohman2010-08-26
| | | | | | | | | | | | | | | fix: add a flag to MapValue and friends which indicates whether any module-level mappings are being made. In the common case of inlining, no module-level mappings are needed, so MapValue doesn't need to examine non-function-local metadata, which can be very expensive in the case of a large module with really deep metadata (e.g. a large C++ program compiled with -g). This flag is a little awkward; perhaps eventually it can be moved into the ClonedCodeInfo class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112190 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r111922, "MapValue support for MDNodes. This is similar to r109117,Daniel Dunbar2010-08-26
| | | | | | | except ...", it is causing *massive* performance regressions when building Clang with itself (-O3 -g). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112158 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r112091, "Remap metadata attached to instructions when remappingDaniel Dunbar2010-08-26
| | | | | | individual ...", which depends on r111922, which I am reverting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112157 91177308-0d34-0410-b5e6-96231b3b80d8
* Remap metadata attached to instructions when remapping individualDan Gohman2010-08-25
| | | | | | | instructions, not when remapping modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112091 91177308-0d34-0410-b5e6-96231b3b80d8
* Use MapValue in the Linker instead of having a private functionDan Gohman2010-08-24
| | | | | | | | | which does the same thing. This eliminates redundant code and handles MDNodes better. MDNode linking still doesn't fully work yet though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111941 91177308-0d34-0410-b5e6-96231b3b80d8
* MapValue support for MDNodes. This is similar to r109117, exceptDan Gohman2010-08-24
| | | | | | | | | that it avoids a lot of unnecessary cloning by avoiding remapping MDNode cycles when none of the nodes in the cycle actually need to be remapped. Also it uses the new temporary MDNode mechanism. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111922 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert this because we can't clone cyclic MDNodes which are creating during aNick Lewycky2010-07-24
| | | | | | | build of llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109355 91177308-0d34-0410-b5e6-96231b3b80d8
* Whether function-local or not, a MDNode may reference a Function in which caseNick Lewycky2010-07-24
| | | | | | | | it needs to be mapped to refer to the function in the new module, not the old one. Fixes PR7700. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109353 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculatively revert 109117Devang Patel2010-07-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109132 91177308-0d34-0410-b5e6-96231b3b80d8
* Map MDNode correctly. Devang Patel2010-07-22
| | | | | | | A non function local MDNode can have an operand which is cloned by MapValue(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109117 91177308-0d34-0410-b5e6-96231b3b80d8
* MDString is already checked earlier.Devang Patel2010-07-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107516 91177308-0d34-0410-b5e6-96231b3b80d8
* Cosmetic change.Devang Patel2010-06-23
| | | | | | | Do not use "ValueMap" as a name for a local variable or an argument. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106698 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 106592 for now. It causes clang-selfhost build failure.Devang Patel2010-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106598 91177308-0d34-0410-b5e6-96231b3b80d8
* If a metadata operand is seeded in value map and the metadata should also be ↵Devang Patel2010-06-22
| | | | | | | | | | | | | seeded in value map. This is not limited to function local metadata. Failure to seed metdata in such cases causes troubles when in a cloned module, metadata from a new module refers to values in old module. Usually this results in mysterious bugpoint crashes. For example, Checking to see if we can delete global inits: Unknown constant! UNREACHABLE executed at /d/g/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:904! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106592 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 106528. It is causing self host failures.Devang Patel2010-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106529 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not rely on DenseMap slot which can be easily invalidated when DenseMap ↵Devang Patel2010-06-22
| | | | | | grows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106528 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename ValueMapTy as ValueToValueMapTy to clearly indicate that this has no ↵Devang Patel2010-04-20
| | | | | | replationship with ADT/ValueMap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101950 91177308-0d34-0410-b5e6-96231b3b80d8
* There is no need to install ValueMapper.h header. Devang Patel2010-04-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101949 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid extra calls to MD->getNumOperands()Victor Hernandez2010-01-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94618 91177308-0d34-0410-b5e6-96231b3b80d8
* It turns out that this #include is needed because otherwiseChris Lattner2010-01-21
| | | | | | | | | | | ValueMapper.cpp ends up calling an out of line __ZNK4llvm12PATypeHolder3getEv, which is a template and llvm-config determines arbitrarily to use the one in libipo. This sucks, but keeping the #include is a reasonable workaround. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94103 91177308-0d34-0410-b5e6-96231b3b80d8
* unbreak the build, apparently without this transformutils starts depending ↵Chris Lattner2010-01-21
| | | | | | on libipa? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94102 91177308-0d34-0410-b5e6-96231b3b80d8
* tidy upChris Lattner2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94101 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't need to include IntrinsicInst.h any moreVictor Hernandez2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94092 91177308-0d34-0410-b5e6-96231b3b80d8
* No need to map NULL operands of metadataVictor Hernandez2010-01-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94091 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch Elts from vector to SmallVectorVictor Hernandez2010-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93989 91177308-0d34-0410-b5e6-96231b3b80d8
* Map operands of all function-local metadata, not just metadata passed to ↵Victor Hernandez2010-01-20
| | | | | | llvm.dbg.declare intrinsics git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93979 91177308-0d34-0410-b5e6-96231b3b80d8
* While mapping llvm.dbg.declare intrinsic manually map its operand, if possible,Devang Patel2010-01-18
| | | | | | | | because it points to an alloca instruction through metadata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93757 91177308-0d34-0410-b5e6-96231b3b80d8