aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
* This started as a small change, I swear. Unfortunately, lots of things call ↵Owen Anderson2009-07-097-24/+26
| | | | | | the [I|F]CmpInst constructors. Who knew!? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75200 91177308-0d34-0410-b5e6-96231b3b80d8
* There's no need to consider PHI nodes in the same block as the instructionNick Lewycky2009-07-091-0/+4
| | | | | | | we're inserting sigma/phi functions for. Patch by Andre Tavares. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75138 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some statistics to SSI so we can see what it's up to.Nick Lewycky2009-07-091-0/+43
| | | | | | | Add an -ssi-everything pass which calls createSSI on everything in the function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75135 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch GlobalVariable ctors to a sane API, where *either* a context or a ↵Owen Anderson2009-07-082-11/+8
| | | | | | module is required. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75025 91177308-0d34-0410-b5e6-96231b3b80d8
* Push LLVMContext through GlobalVariables and IRBuilder.Owen Anderson2009-07-082-4/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
* "LLVMContext* " --> "LLVMContext *"Owen Anderson2009-07-066-12/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74878 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread LLVMContext through the constant folding APIs, which touches a lot of ↵Owen Anderson2009-07-063-5/+8
| | | | | | files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
* More LLVMContext-ification.Owen Anderson2009-07-0515-90/+132
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74807 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix build.Mike Stump2009-07-031-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74782 91177308-0d34-0410-b5e6-96231b3b80d8
* Add Static Single Information construction pass written by André Tavares!Nick Lewycky2009-07-031-0/+390
| | | | | | | | | Use it by requiring it through the pass manager, then calling its createSSI method on the variables that you want in SSI form. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74780 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a pointer to the owning LLVMContext to Module. This requires threading ↵Owen Anderson2009-07-011-1/+1
| | | | | | | | | | | LLVMContext through a lot of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools. Patches for Clang and LLVM-GCC to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
* improve the APIs for creating struct and function types with no ↵Chris Lattner2009-07-011-1/+1
| | | | | | | | | arguments/elements to not have to create a temporary vector (in the API at least). Patch by Jay Foad! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74584 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor code simplification.Dan Gohman2009-06-301-3/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74491 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the block from the LoopInfo, rather than just the Loop.Dan Gohman2009-06-271-1/+1
| | | | | | | | LoopInfo will handle removing it from the Loop, as well as updating its own tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74398 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach LoopSimplify how to merge multiple loop exits into a single exit,Dan Gohman2009-06-272-1/+76
| | | | | | | | | | | | | | | | | when one of them can be converted to a trivial icmp and conditional branch. This addresses what is essentially a phase ordering problem. SimplifyCFG knows how to do this transformation, but it doesn't do so if the primary block has any instructions in it other than an icmp and a branch. In the given testcase, the block contains other instructions, however they are loop-invariant and can be hoisted. SimplifyCFG doesn't have LoopInfo though, so it can't hoist them. And, it's important that the blocks be merged before LoopRotation, as it doesn't support multiple-exit loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74396 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused routines.Devang Patel2009-06-261-41/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74351 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix linking of llvm-ld and lli with CMake, from Xerxes RånbyDouglas Gregor2009-06-261-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74285 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix LCSSA to avoid emitting a PHI node for the unwind destination ofDan Gohman2009-06-261-2/+11
| | | | | | | | an invoke instruction, since the value isn't really live across that edge. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74242 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize instcombine's isSafeToLoadUnconditionally() functionChris Lattner2009-06-161-0/+45
| | | | | | | | | to ignore readonly calls, and factor it out of instcombine so that it can be used by other passes. Patch by Frits van Bommel! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73506 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the crash in this test. This is basically the sameDale Johannesen2009-06-151-2/+27
| | | | | | | | | | problem addressed in 31284, but the patch there only addressed the case where an invoke is the first thing in a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73416 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix old-style type names in comments.Dan Gohman2009-06-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73362 91177308-0d34-0410-b5e6-96231b3b80d8
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-041-6/+2
| | | | | | | | | | | | | | | | integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
* Give embedded metadata its own type instead of relying on EmptyStructTy.Nick Lewycky2009-05-301-1/+24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72610 91177308-0d34-0410-b5e6-96231b3b80d8
* available_externall linkage is not local, this was confusing the codegenerator,Edwin Török2009-05-232-2/+4
| | | | | | | | | | and it wasn't generating calls through @PLT for these functions. hasLocalLinkage() is now false for available_externally, I attempted to fix the inliner and dce to handle available_externally properly. It passed make check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72328 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SCEVExpander to expand arithmetic involving pointers into GEPDan Gohman2009-05-191-30/+31
| | | | | | | | | | | | | | | | | instructions. It attempts to create high-level multi-operand GEPs, though in cases where this isn't possible it falls back to casting the pointer to i8* and emitting a GEP with that. Using GEP instructions instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that don't use ScalarEvolution, such as BasicAliasAnalysis. Also, make the AddrModeMatcher more aggressive in handling GEPs. Previously it assumed that operand 0 of a GEP would require a register in almost all cases. It now does extra checking and can do more matching if operand 0 of the GEP is foldable. This fixes a problem that was exposed by SCEVExpander using GEPs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72093 91177308-0d34-0410-b5e6-96231b3b80d8
* Reuse existing getUnderlyingObject instead ofDale Johannesen2009-05-141-24/+6
| | | | | | | | adding another copy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71783 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle some additonal cases of external weak globals.Dale Johannesen2009-05-131-4/+22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71717 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't generate a select whose operand is load of a weakDale Johannesen2009-05-131-0/+6
| | | | | | | | | external. These may have address 0 and are not safe to execute unconditionally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71688 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename PaddedSize to AllocSize, in the hope that thisDuncan Sands2009-05-092-2/+2
| | | | | | | | will make it more obvious what it represents, and stop it being confused with the StoreSize. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71349 91177308-0d34-0410-b5e6-96231b3b80d8
* PR4123: don't crash when inlining a call which uses its own result.Eli Friedman2009-05-081-3/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71199 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify code by using SmallVector's pop_back_val() instead ofDan Gohman2009-05-064-12/+6
| | | | | | | separate back() and pop_back() calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71089 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow readonly functions to unwind exceptions. TeachDuncan Sands2009-05-061-7/+5
| | | | | | | | | the optimizers about this. For example, a readonly function with no uses cannot be removed unless it is also marked nounwind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71071 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply 70645, converting ScalarEvolution to useDan Gohman2009-05-042-22/+6
| | | | | | | | | | | | | CallbackVH, with fixes. allUsesReplacedWith need to walk the def-use chains and invalidate all users of a value that is replaced. SCEVs of users need to be recalcualted even if the new value is equivalent. Also, make forgetLoopPHIs walk def-use chains, since any SCEV that depends on a PHI should be recalculated when more information about that PHI becomes available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70927 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor loop backedge finding out of CodeGenPrepare into a new Chris Lattner2009-05-041-0/+50
| | | | | | | FindFunctionBackedges function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70819 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r70645 for now; it's causing a variety of regressions.Dan Gohman2009-05-032-6/+22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70661 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert ScalarEvolution to use CallbackVH for its internal map. ThisDan Gohman2009-05-022-22/+6
| | | | | | | | | | makes ScalarEvolution::deleteValueFromRecords, and it's code that subtly needed to be called before ReplaceAllUsesWith, unnecessary. It also makes ValueDeletionListener unnecessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70645 91177308-0d34-0410-b5e6-96231b3b80d8
* Previously, RecursivelyDeleteDeadInstructions provided an optionDan Gohman2009-05-022-5/+62
| | | | | | | | | | | | | | | | | | | of returning a list of pointers to Values that are deleted. This was unsafe, because the pointers in the list are, by nature of what RecursivelyDeleteDeadInstructions does, always dangling. Replace this with a simple callback mechanism. This may eventually be removed if all clients can reasonably be expected to use CallbackVH. Use this to factor out the dead-phi-cycle-elimination code from LSR utility function, and generalize it to use the RecursivelyDeleteTriviallyDeadInstructions utility function. This makes LSR more aggressive about eliminating dead PHI cycles; adjust tests to either be less trivial or to simply expect fewer instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70636 91177308-0d34-0410-b5e6-96231b3b80d8
* Real fix for PR3549, by using caching for predecessor counts in addition to ↵Owen Anderson2009-04-221-11/+13
| | | | | | | | | the predecessors themselves. This halves the time to optimize the testcase, beyond what my previous patch did. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69792 91177308-0d34-0410-b5e6-96231b3b80d8
* Use PredIteratorCache in LCSSA, which gives a 37% overall speedup on the ↵Owen Anderson2009-04-221-2/+5
| | | | | | testcase from PR3549. More improvements to come. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69788 91177308-0d34-0410-b5e6-96231b3b80d8
* use predicate instead of hand-rolled loopChris Lattner2009-04-211-11/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69752 91177308-0d34-0410-b5e6-96231b3b80d8
* remove trailing whitespaceJim Grosbach2009-04-171-50/+50
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69402 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR3944: make mem2reg O(N) instead of O(N^2) in the number of Eli Friedman2009-04-161-19/+11
| | | | | | | | incoming edges for a block with many predecessors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69312 91177308-0d34-0410-b5e6-96231b3b80d8
* While inlining, clone llvm.dbg.func.start intrinsic and adjust Devang Patel2009-04-152-3/+52
| | | | | | | llvm.dbg.region.end instrinsic. This nested llvm.dbg.func.start/llvm.dbg.region.end pair now enables DW_TAG_inlined_subroutine support in code generator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69118 91177308-0d34-0410-b5e6-96231b3b80d8
* Update call graph after inlining invoke.Devang Patel2009-03-311-2/+19
| | | | | | | Patch by Jay Foad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68120 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that errs() is properly non-buffered, there's no need toDan Gohman2009-03-231-2/+1
| | | | | | | explicitly flush it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67526 91177308-0d34-0410-b5e6-96231b3b80d8
* Factorize out a concept - no functionality change.Duncan Sands2009-03-211-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67454 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't load values out of global constants with weakDuncan Sands2009-03-201-1/+2
| | | | | | | | | | linkage: the value may be replaced with something different at link time. (Frontends that want to allow values to be loaded out of weak constants can give their constants weak_odr linkage). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67407 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comment typo.Dale Johannesen2009-03-191-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67307 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert my previous change on Local.cpp, instead, fix the bug on scalarrepl.Zhou Sheng2009-03-181-3/+0
| | | | | | | | If the instruction has no users, it is also not only used by debug info and should not be deleted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67194 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug.Zhou Sheng2009-03-181-0/+3
| | | | | | | If I->use_empty(), this method should return false. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67180 91177308-0d34-0410-b5e6-96231b3b80d8