summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/Utils
Commit message (Collapse)AuthorAge
* If PrototypeValue is erased in the middle of using the SSAUpdatorDuncan Sands2010-09-01
| | | | | | | | then the SSAUpdator may access freed memory. Instead, simply pass in the type and name explicitly, which is all that was used anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112699 91177308-0d34-0410-b5e6-96231b3b80d8
* implement SSAUpdater::RewriteUseAfterInsertions, a helpful form of RewriteUse.Chris Lattner2010-08-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112409 91177308-0d34-0410-b5e6-96231b3b80d8
* remove the ABCD and SSI passes. They don't have any clients thatChris Lattner2010-08-28
| | | | | | | | I'm aware of, aren't maintained, and LVI will be replacing their value. nlewycky approved this on irc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112355 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
* 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
* Teach SimplifyCFG how to simplify indirectbr instructions.Dan Gohman2010-08-14
| | | | | | | | | | | | - Eliminate redundant successors. - Convert an indirectbr with one successor into a direct branch. Also, generalize SimplifyCFG to be able to be run on a function entry block. It knows quite a few simplifications which are applicable to the entry block, and it only needs a few checks to avoid trouble with the entry block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111060 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r110396 to fix buildbots.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-05
| | | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ValueMap instead of DenseMap.Devang Patel2010-06-24
| | | | | | | The ValueMapper used by various cloning utility maps MDNodes also. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106706 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
* simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0Benjamin Kramer2010-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106047 91177308-0d34-0410-b5e6-96231b3b80d8
* Move FindAvailableLoadedValue isSafeToLoadUnconditionally out ofDan Gohman2010-05-28
| | | | | | | | lib/Transforms/Utils and into lib/Analysis so that Analysis passes can use them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104949 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix handling of unreachable blocks in the SSAUpdater. The previous code onlyBob Wilson2010-05-06
| | | | | | | | | | | handled cases where a block had zero predecessors, but failed to detect other cases like loops with no entries. The SSAUpdater is already doing a forward traversal through the blocks, so it is not hard to identify the blocks that were never reached on that traversal. This fixes the crash for ppc on the stepanov_vector test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103184 91177308-0d34-0410-b5e6-96231b3b80d8
* Combine the implementations of the core part of the SSAUpdater andBob Wilson2010-05-04
| | | | | | | MachineSSAUpdater to avoid duplicating all the code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103060 91177308-0d34-0410-b5e6-96231b3b80d8
* rename InlineInfo.DevirtualizedCalls -> InlinedCalls toChris Lattner2010-05-01
| | | | | | | | reflect that it includes all inlined calls now, not just devirtualized ones. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102824 91177308-0d34-0410-b5e6-96231b3b80d8
* switch InlineInfo.DevirtualizedCalls's list to be of WeakVH.Chris Lattner2010-04-23
| | | | | | | | | | This fixes a bug where calls inlined into an invoke would get changed into an invoke but the array would keep pointing to the (now dead) call. The improved inliner behavior is still disabled for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102196 91177308-0d34-0410-b5e6-96231b3b80d8
* The inliner was choosing to not consider call sitesChris Lattner2010-04-22
| | | | | | | | | | | that appear in the SCC as a result of inlining as candidates for inlining. Change this so that it *does* consider call sites that change from being indirect to being direct as a result of inlining. This allows it to completely "devirtualize" the testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102146 91177308-0d34-0410-b5e6-96231b3b80d8
* refactor the interface to InlineFunction so that most of the in/outChris Lattner2010-04-22
| | | | | | | | | arguments are handled with a new InlineFunctionInfo class. This makes it easier to extend InlineFunction to return more info in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102137 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
* Re-commit my previous SSAUpdater changes. The previous version naively triedBob Wilson2010-04-17
| | | | | | | | | | | | to determine where to place PHIs by iteratively comparing reaching definitions at each block. That was just plain wrong. This version now computes the dominator tree within the subset of the CFG where PHIs may need to be placed, and then places the PHIs in the iterated dominance frontier of each definition. The rest of the patch is mostly the same, with a few more performance improvements added in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101612 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for stpncpy_chk.Eric Christopher2010-04-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100710 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply address space patch after fixing an issue in MemCopyOptimizer.Mon P Wang2010-04-04
| | | | | | | | Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert all my SSAUpdater patches. The PHI placement algorithm is not correctBob Wilson2010-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (what was I thinking?) and there's also a problem with LCSSA. I'll try again later with fixes. --- Reverse-merging r100263 into '.': U lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100177 into '.': G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100148 into '.': G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100147 into '.': U include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100131 into '.': G include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100130 into '.': G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100126 into '.': G include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100050 into '.': D test/Transforms/GVN/2010-03-31-RedundantPHIs.ll --- Reverse-merging r100047 into '.': G include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100264 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r100191 since it breaks objc in clang Mon P Wang2010-04-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100199 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply address space patch after fixing an issue in MemCopyOptimizer.Mon P Wang2010-04-02
| | | | | | | | Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100191 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite another SSAUpdater function to avoid recursion.Bob Wilson2010-04-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100147 91177308-0d34-0410-b5e6-96231b3b80d8
* Change another SSAUpdater function to avoid recursion.Bob Wilson2010-04-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100131 91177308-0d34-0410-b5e6-96231b3b80d8
* The SSAUpdater should avoid recursive traversals of the CFG, since that mayBob Wilson2010-04-01
| | | | | | | blow out the stack for really big functions. Start by fixing an easy case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100126 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite part of the SSAUpdater to be more careful about inserting redundantBob Wilson2010-03-31
| | | | | | | | | PHIs. The previous algorithm was unable to reliably detect when existing PHIs in a cycle can be reused. I'm still working on reducing a testcase. Radar 7711900. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100047 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.Bob Wilson2010-03-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99948 91177308-0d34-0410-b5e6-96231b3b80d8
* Added support for address spaces and added a isVolatile field to memcpy, ↵Mon P Wang2010-03-30
| | | | | | | | | | memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) A update of langref will occur in a subsequent checkin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99928 91177308-0d34-0410-b5e6-96231b3b80d8
* Add comment.Evan Cheng2010-03-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99284 91177308-0d34-0410-b5e6-96231b3b80d8
* Forgot this.Evan Cheng2010-03-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99283 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a virtual destructor and give vtable a home.Benjamin Kramer2010-03-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98376 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor checked library call optimization into a common helper class and use itBenjamin Kramer2010-03-12
| | | | | | | to unify the almost identical code in CodeGenPrepare and InstCombineCalls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98338 91177308-0d34-0410-b5e6-96231b3b80d8
* stpcpy is so similar to strcpy, it doesn't deserve a complete copy of the ↵Benjamin Kramer2010-03-11
| | | | | | __strcpy_chk -> strcpy code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98284 91177308-0d34-0410-b5e6-96231b3b80d8
* Lower stpcpy_chk when possible.Eric Christopher2010-03-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98274 91177308-0d34-0410-b5e6-96231b3b80d8
* Add strncpy libcall creator. Use it when it should be used.Eric Christopher2010-03-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98219 91177308-0d34-0410-b5e6-96231b3b80d8
* Move SimplifyLibCalls's LibCall builders to a separate file so theyEric Christopher2010-03-05
| | | | | | | | | can be used in more places. Add an argument for the TargetData that most of them need. Update for the getInt8PtrTy() change. Should be no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97844 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename SuccessorNumber to GetSuccessorNumber.Bob Wilson2010-02-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96387 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor to share code to find the position of a basic block successor in theBob Wilson2010-02-16
| | | | | | | terminator's list of successors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96377 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SimplifyCFG about magic pointer constants.Jakob Stoklund Olesen2010-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Weird code sometimes uses pointer constants other than null. This patch teaches SimplifyCFG to build switch instructions in those cases. Code like this: void f(const char *x) { if (!x) puts("null"); else if ((uintptr_t)x == 1) puts("one"); else if (x == (char*)2 || x == (char*)3) puts("two"); else if ((intptr_t)x == 4) puts("four"); else puts(x); } Now becomes a switch: define void @f(i8* %x) nounwind ssp { entry: %magicptr23 = ptrtoint i8* %x to i64 ; <i64> [#uses=1] switch i64 %magicptr23, label %if.else16 [ i64 0, label %if.then i64 1, label %if.then2 i64 2, label %if.then9 i64 3, label %if.then9 i64 4, label %if.then14 ] Note that LLVM's own DenseMap uses magic pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95439 91177308-0d34-0410-b5e6-96231b3b80d8
* Check alignment of loads when deciding whether it is safe to execute themBob Wilson2010-01-30
| | | | | | | | unconditionally. Besides checking the offset, also check that the underlying object is aligned as much as the load itself. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94875 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve isSafeToLoadUnconditionally to recognize that GEPs with constantBob Wilson2010-01-29
| | | | | | | | indices are safe if the result is known to be within the bounds of the underlying object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94829 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't bother with sprintf, just pass the Twine through.Benjamin Kramer2010-01-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94684 91177308-0d34-0410-b5e6-96231b3b80d8
* DbgInfoIntrinsics no longer appear in an instruction's use list; so clean up ↵Victor Hernandez2010-01-21
| | | | | | looking for them in use iterations and remove OnlyUsedByDbgInfoIntrinsics() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94111 91177308-0d34-0410-b5e6-96231b3b80d8
* add a helper function.Chris Lattner2010-01-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93251 91177308-0d34-0410-b5e6-96231b3b80d8
* Make RecursivelyDeleteTriviallyDeadInstructions,Dan Gohman2010-01-05
| | | | | | | | RecursivelyDeleteDeadPHINode, and DeleteDeadPHIs return a flag indicating whether they made any changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92732 91177308-0d34-0410-b5e6-96231b3b80d8
* convert various IntrinsicInst's to use class instead of struct.Chris Lattner2010-01-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92681 91177308-0d34-0410-b5e6-96231b3b80d8