summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/ValueMapper.cpp
AgeCommit message (Collapse)AuthorFilesLines
2012-09-26Rename virtual table anchors from Anchor() to anchor() for consistency with ↵Craig Topper1-1/+1
the rest of the tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04We need to map DebugLoc. It leads to Fuction * (through subprogram entry ↵Devang Patel1-3/+2
node) which should be appropriately mapped. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136910 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15fix rdar://9776316 - type remapping needed for inline asm blobs,Chris Lattner1-1/+17
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
2011-07-14Undo r135191 (i.e. reapply Chris's patch. Now linker maps NamedMDNodes ↵Devang Patel1-2/+3
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
2011-07-14revert r135172 until Devang and I figure out the right answer.Chris Lattner1-3/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135191 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14Stop the ValueMapper from calling getAllMetadata, which unpacks DebugLoc intoChris Lattner1-2/+3
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
2011-07-09Land the long talked about "type system rewrite" patch. ThisChris Lattner1-39/+68
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
2011-06-23Reinstate r133513 (reverted in r133700) with an additional fix for aJay Foad1-0/+14
-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
2011-06-23Revert r133513:Eric Christopher1-14/+0
"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
2011-06-21Reinstate r133435 and r133449 (reverted in r133499) now that the clangJay Foad1-0/+14
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
2011-06-21Revert r133435 and r133449 to appease buildbots.Chad Rosier1-14/+0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133499 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-20Change how PHINodes store their operands.Jay Foad1-0/+14
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
2011-04-21PR9214: Convert Metadata API to use ArrayRef.Jay Foad1-2/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129932 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24fix PR9015, a crash linking recursive metadata.Chris Lattner1-6/+11
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124099 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08Revamp the ValueMapper interfaces in a couple ways:Chris Lattner1-105/+64
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
2010-10-13Fix PR8313 by changing ValueToValueMap use a TrackingVH.Rafael Espindola1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26Reapply r112091 and r111922, support for metadata linking, with aDan Gohman1-21/+61
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
2010-08-26Revert r111922, "MapValue support for MDNodes. This is similar to r109117,Daniel Dunbar1-27/+8
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
2010-08-26Revert r112091, "Remap metadata attached to instructions when remappingDaniel Dunbar1-12/+1
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
2010-08-25Remap metadata attached to instructions when remapping individualDan Gohman1-1/+12
instructions, not when remapping modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24Use MapValue in the Linker instead of having a private functionDan Gohman1-1/+1
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
2010-08-24MapValue support for MDNodes. This is similar to r109117, exceptDan Gohman1-8/+27
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
2010-07-24Revert this because we can't clone cyclic MDNodes which are creating during aNick Lewycky1-3/+4
build of llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24Whether function-local or not, a MDNode may reference a Function in which caseNick Lewycky1-4/+3
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
2010-07-22Speculatively revert 109117Devang Patel1-27/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-22Map MDNode correctly. Devang Patel1-6/+27
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
2010-07-02MDString is already checked earlier.Devang Patel1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107516 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23Cosmetic change.Devang Patel1-4/+4
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
2010-06-22Revert 106592 for now. It causes clang-selfhost build failure.Devang Patel1-34/+13
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106598 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22If a metadata operand is seeded in value map and the metadata should also be ↵Devang Patel1-13/+34
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
2010-06-22Revert 106528. It is causing self host failures.Devang Patel1-5/+7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106529 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22Do not rely on DenseMap slot which can be easily invalidated when DenseMap ↵Devang Patel1-7/+5
grows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106528 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20Rename ValueMapTy as ValueToValueMapTy to clearly indicate that this has no ↵Devang Patel1-2/+2
replationship with ADT/ValueMap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20There is no need to install ValueMapper.h header. Devang Patel1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26Avoid extra calls to MD->getNumOperands()Victor Hernandez1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94618 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21It turns out that this #include is needed because otherwiseChris Lattner1-1/+1
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
2010-01-21unbreak the build, apparently without this transformutils starts depending ↵Chris Lattner1-0/+1
on libipa? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94102 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21tidy upChris Lattner1-14/+7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94101 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21Don't need to include IntrinsicInst.h any moreVictor Hernandez1-1/+0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94092 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21No need to map NULL operands of metadataVictor Hernandez1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20Switch Elts from vector to SmallVectorVictor Hernandez1-2/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20Map operands of all function-local metadata, not just metadata passed to ↵Victor Hernandez1-19/+13
llvm.dbg.declare intrinsics git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18While mapping llvm.dbg.declare intrinsic manually map its operand, if possible,Devang Patel1-0/+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
2009-11-01Revert 85678/85680. The decision is to stay with the current form of Chris Lattner1-7/+2
indirectbr, thus we don't need "blockaddr(@func, null)". Eliminate it for simplicity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85699 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31adjust a couple xforms to work with null bb's in BlockAddress.Chris Lattner1-2/+7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29teach various passes about blockaddress. We no longerChris Lattner1-2/+2
crash on any clang tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85465 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29teach ValueMapper about BlockAddress', making bugpoint a lot more useful.Chris Lattner1-7/+10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85458 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29unindent massive blocks, no functionality change.Chris Lattner1-69/+75
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85457 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24MapValue doesn't needs its LLVMContext argument.Dan Gohman1-10/+9
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28Rename MDNode.h header. It defines MDnode and other metadata classes.Devang Patel1-1/+1
New name is Metadata.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77370 91177308-0d34-0410-b5e6-96231b3b80d8