summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* fix inverted logic pointed out by John McCall, noticed by inspection.Chris Lattner2009-07-021-1/+1
| | | | | | | This was considering vector intrinsics to have cost 2, but non-vector intrinsics to have cost 1, which is backward. llvm-svn: 74698
* Fix a bunch of other places that used operator[] to test whetherDan Gohman2009-07-022-11/+19
| | | | | | a key is present in a std::map or DenseMap to use find instead. llvm-svn: 74676
* Request LCSSA after LoopSimplify. This fixes a problem in which theDan Gohman2009-07-011-1/+1
| | | | | | | PassManager was scheduling LCSSA before LoopSimplify, which does not preserve LCSSA. llvm-svn: 74661
* Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487.Dan Gohman2009-07-011-1/+15
| | | | llvm-svn: 74646
* 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. llvm-svn: 74614
* improve the APIs for creating struct and function types with no ↵Chris Lattner2009-07-013-9/+5
| | | | | | | | arguments/elements to not have to create a temporary vector (in the API at least). Patch by Jay Foad! llvm-svn: 74584
* Minor code simplification.Dan Gohman2009-06-301-3/+2
| | | | llvm-svn: 74491
* Don't try to split a loop when the controlling icmp instructionDan Gohman2009-06-271-0/+3
| | | | | | doesn't have an IV-based operand. This fixes PR4471. llvm-svn: 74399
* 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. llvm-svn: 74398
* 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. llvm-svn: 74396
* More minor code simplifications.Dan Gohman2009-06-271-14/+9
| | | | llvm-svn: 74395
* When a value is used multiple times within a single PHI, instructionsDan Gohman2009-06-271-3/+15
| | | | | | | | inserted to replace that value must dominate all of of the basic blocks associated with the uses of the value in the PHI, not just one of them. llvm-svn: 74376
* Incorporate the insertion point into the key of SCEVExpander's CSE map.Dan Gohman2009-06-261-121/+43
| | | | | | | | | | | | | | This helps it avoid reusing an instruction that doesn't dominate all of the users, in cases where the original instruction was inserted before all of the users were known. This may result in redundant expansions of sub-expressions that depend on loop-unpredictable values in some cases, however this isn't very common, and it primarily impacts IndVarSimplify, so GVN can be expected to clean these up. This eliminates the need for IndVarSimplify's FixUsesBeforeDefs, which fixes several bugs. llvm-svn: 74352
* Remove unused routines.Devang Patel2009-06-261-41/+0
| | | | llvm-svn: 74351
* Constify this value.Owen Anderson2009-06-261-3/+2
| | | | llvm-svn: 74330
* Fix linking of llvm-ld and lli with CMake, from Xerxes RånbyDouglas Gregor2009-06-262-0/+4
| | | | llvm-svn: 74285
* Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprogramsDevang Patel2009-06-261-1/+20
| | | | | | and llvm.dbg.global_variables. llvm-svn: 74251
* Change this code to a form about which VC++ reportedly isn't unhappy.Dan Gohman2009-06-261-1/+2
| | | | llvm-svn: 74243
* 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. llvm-svn: 74242
* Minor code simplification.Dan Gohman2009-06-261-7/+3
| | | | llvm-svn: 74240
* Reword a few comments.Dan Gohman2009-06-251-17/+17
| | | | llvm-svn: 74146
* When inserting code into a loop preheader, insert it before theDan Gohman2009-06-241-3/+6
| | | | | | | | terminator, instead of after the last phi. This fixes a bug exposed by ScalarEvolution analyzing more kinds of loops. This fixes PR4436. llvm-svn: 74072
* Extend ScalarEvolution's multiple-exit support to compute exactDan Gohman2009-06-242-37/+21
| | | | | | | | | | | | | | | trip counts in more cases. Generalize ScalarEvolution's isLoopGuardedByCond code to recognize And and Or conditions, splitting the code out into an isNecessaryCond helper function so that it can evaluate Ands and Ors recursively, and make SCEVExpander be much more aggressive about hoisting instructions out of loops. test/CodeGen/X86/pr3495.ll has an additional instruction now, but it appears to be due to an arbitrary register allocation difference. llvm-svn: 74048
* Don't emit a redundant BitCastInst if the value to be defined in theDan Gohman2009-06-241-1/+2
| | | | | | preheader is already an instruction. llvm-svn: 74031
* Fix a few minor issues that were exposed by the removal of SCEVHandle.Dan Gohman2009-06-221-1/+0
| | | | llvm-svn: 73910
* SCEVHandle is no more!Owen Anderson2009-06-223-117/+117
| | | | llvm-svn: 73906
* Fix this code to correctly handle loops with multiple exits. UntilDan Gohman2009-06-221-4/+4
| | | | | | | | now, this hasn't mattered, because ScalarEvolution hasn't been able to compute trip counts for loops with multiple exits. But it will soon. llvm-svn: 73864
* Rename a variable for consistency with the ExitBlock vs ExitingBlockDan Gohman2009-06-211-6/+6
| | | | | | terminology that LoopInfo uses. llvm-svn: 73863
* Fix a typo in a comment that Frits von Bommel noticed.Dan Gohman2009-06-191-1/+1
| | | | llvm-svn: 73796
* Re-apply r73718, now that the fix in r73787 is in, and add aDan Gohman2009-06-191-30/+36
| | | | | | | hand-crafted testcase which demonstrates the bug that was exposed in 254.gap. llvm-svn: 73793
* Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,Dan Gohman2009-06-191-0/+5
| | | | | | which it isn't prepared to handle. llvm-svn: 73787
* Revert 73718. It's breaking 254.gap.Evan Cheng2009-06-191-35/+29
| | | | llvm-svn: 73783
* make jump threading handle lexically identical compare instructionsChris Lattner2009-06-191-4/+17
| | | | | | | | as if they were multiple uses of the same instruction. This interacts well with the existing loadpre that j-t does to open up many new jump threads earlier. llvm-svn: 73768
* Teach jump threading to look at comparisons between phi nodes and non-constants.Nick Lewycky2009-06-191-25/+48
| | | | llvm-svn: 73755
* Improve tail call elim to move loads above readonly callsChris Lattner2009-06-191-1/+15
| | | | | | | when it allows forming a tail call. Patch by Frits van Bommel. This implements PR4323. llvm-svn: 73752
* part of PR4405: disable a contentious optimization forChris Lattner2009-06-191-5/+3
| | | | | | | | strcmp -> memcmp when the lengths of the strings are unknown. Patch by Nick Lewycky! llvm-svn: 73751
* Generalize LSR's OptimizeSMax to handle unsigned max tests as wellDan Gohman2009-06-181-29/+35
| | | | | | | as signed max tests. Along with r73717, this helps CodeGen avoid emitting code for a maximum operation for this class of loop. llvm-svn: 73718
* Revert IRBuilder CC propagation. Fix SimplifyLibCalls instead.Anton Korobeynikov2009-06-181-23/+62
| | | | llvm-svn: 73715
* Remove the code from IVUsers that attempted to handleDan Gohman2009-06-181-16/+2
| | | | | | | | | | | casted induction variables in cases where the cast isn't foldable. It ended up being a pessimization in many cases. This could be fixed, but it would require a bunch of complicated code in IVUsers' clients. The advantages of this approach aren't visible enough to justify it at this time. llvm-svn: 73706
* Generalize the zext(trunc(t) & C) instcombine to work even withDan Gohman2009-06-181-8/+21
| | | | | | | C is not a low-bits mask, and add a similar instcombine for zext((trunc(t) & C) ^ C). llvm-svn: 73705
* Instcombine zext(trunc(x) & mask) to x&mask, even if the trunc hasDan Gohman2009-06-171-0/+14
| | | | | | multiple users. llvm-svn: 73656
* This fixes a bug introduced in 72661, which canDale Johannesen2009-06-171-1/+18
| | | | | | | | | | | | | | | move loads back past a check that the load address is valid, see new testcase. The test that went in with 72661 has exactly this case, except that the conditional it's moving past is checking something else; I've settled for changing that test to reference a global, not a pointer. It may be possible to scan all the tests you pass and make sure none of them are checking any component of the address, but it's not trivial and I'm not trying to do that here. llvm-svn: 73632
* Add debug message about non-local loads being clobbered.Torok Edwin2009-06-171-1/+7
| | | | llvm-svn: 73625
* Update comments to use doxygen syntax.Dan Gohman2009-06-171-11/+11
| | | | llvm-svn: 73621
* >> What if my global variable was into a different address space than stack?Sanjiv Gupta2009-06-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | >> > > It doesn't matter in terms of semantics: because AnalyzeGlobal > returned false, we're guaranteed the address of the global is never > taken. I wouldn't be surprised if we end up generating invalid IR in > some cases, though, because of the semantics of replaceAllUsesWith. > Do you have a testcase that breaks? > > The problem is replaceAllUsesWith asserts for type mismatch here. Try attached .bc with llvm-ld. assert(New->getType() == getType() && "replaceAllUses of value with new value of different type!"); Since stack is always on address space zero, I don't think that type of GV in a different address space is ever going to match. The other way is to allow replaceAllUsesWith to ignore address spaces while comparing types. (do we have a way to do that ?). But then such an optimization may fail the entire idea of user wanting to place a variable into different memory space. The original idea of user might be to save on the stack space (data memory) and hence he asked the variable to be placed into different memory space (program memory). So the best bet here is to deny this optimization by checking GV->getType()->getAddressSpace() == 0. llvm-svn: 73605
* PR3439: Correct a silly mistake in the SimplifyDemandedUseBits code for Eli Friedman2009-06-171-1/+1
| | | | | | SRem. llvm-svn: 73598
* Generalize a few more instcombines to be vector/scalar-independent.Dan Gohman2009-06-161-18/+17
| | | | llvm-svn: 73541
* Generalize instcombine's isSafeToLoadUnconditionally() functionChris Lattner2009-06-162-39/+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! llvm-svn: 73506
* Use Type::getScalarType.Dan Gohman2009-06-161-4/+2
| | | | llvm-svn: 73451
* Support vector casts in more places, fixing a variety of assertionDan Gohman2009-06-154-141/+170
| | | | | | | | | | | | | | | failures. To support this, add some utility functions to Type to help support vector/scalar-independent code. Change ConstantInt::get and ConstantFP::get to support vector types, and add an overload to ConstantInt::get that uses a static IntegerType type, for convenience. Introduce a new getConstant method for ScalarEvolution, to simplify common use cases. llvm-svn: 73431
OpenPOWER on IntegriCloud