summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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. llvm-svn: 73416
* Merge PartialInliner changes.Owen Anderson2009-06-151-0/+5
| | | | llvm-svn: 73412
* Make the EnableLoadPRE variable static.Dan Gohman2009-06-151-1/+1
| | | | llvm-svn: 73398
* Fix old-style type names in comments.Dan Gohman2009-06-144-11/+11
| | | | llvm-svn: 73362
* Convert several parts of the ScalarEvolution framework to useDan Gohman2009-06-141-8/+8
| | | | | | SmallVector instead of std::vector. llvm-svn: 73357
* Add another item to the list of things that indvars does.Dan Gohman2009-06-141-1/+4
| | | | llvm-svn: 73355
* Fix CMake build. Patch from Ingmar Vanhassel.Torok Edwin2009-06-141-0/+1
| | | | llvm-svn: 73342
* Add an early implementation of a partial inlining pass. The idea behind thisOwen Anderson2009-06-141-0/+171
| | | | | | | | | | is that, for functions whose bodies are entirely guarded by an if-statement, it can be profitable to pull the test out of the callee and into the caller. This code has had some cursory testing, but still has a number of known issues on the LLVM test suite. llvm-svn: 73338
* Unlike the other instructions, GEP really does need to look at the type of aNick Lewycky2009-06-131-0/+14
| | | | | | pointer. This fixes kimwitu++. Pointed out by Frits van Bommel on review! llvm-svn: 73299
* Teach SCEVExpander's visitAddRecExpr to reuse an existing canonicalDan Gohman2009-06-131-71/+24
| | | | | | | | | | | | | | | | | induction variable when the addrec to be expanded does not require a wider type. This eliminates the need for IndVarSimplify to micro-manage SCEV expansions, because SCEVExpander now automatically expands them in the form that IndVarSimplify considers to be canonical. (LSR still micro-manages its SCEV expansions, because it's optimizing for the target, rather than for other optimizations.) Also, this uses the new getAnyExtendExpr, which has more clever expression simplification logic than the IndVarSimplify code it replaces, and this cleans up some ugly expansions in code such as the included masked-iv.ll testcase. llvm-svn: 73294
* second half of fix for PR4366: don't zap store to null of Chris Lattner2009-06-121-3/+7
| | | | | | non-default addrspaces. llvm-svn: 73253
* Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, becauseDan Gohman2009-06-121-15/+0
| | | | | | it may round differently. This fixes PR4374. llvm-svn: 73243
* Give Instruction::isSameOperationAs a corresponding comment to noteDan Gohman2009-06-121-2/+3
| | | | | | | | | | | the relationship with MergeFunctions.cpp's isEquivalentOperation, and make a trivial code reordering so that the two functions are easier to compare. Fix the name of Instruction::isSameOperationAs in MergeFunction.cpp's isEquivalentOperation's comment, and fix a nearby 80-column violation. llvm-svn: 73241
* Keep callers of a weak function calling it, instead of the non-weak equivalent.Nick Lewycky2009-06-121-0/+1
| | | | llvm-svn: 73235
* Don't forget to match the calling convention when producing a thunk.Nick Lewycky2009-06-121-2/+2
| | | | llvm-svn: 73231
* Given two identical weak functions, produce one internal function and two weakNick Lewycky2009-06-121-4/+17
| | | | | | thunks. llvm-svn: 73230
* Add an "are types equivalent" operation that ignores the types that a pointerNick Lewycky2009-06-121-99/+354
| | | | | | | | | | | | | | | points to while analyzing all other fields. Use FoldingSetNodeID to produce a good hash. This dramatically decreases run times. Emit thunks. This means that it can look at all functions regardless of what the linkage is or if the address is taken, but unfortunately some small functions can be even shorter than the thunk because our backend doesn't yet realize it can just turn these into jumps. This means that this pass will pessimize code on average. llvm-svn: 73222
* Fix 4366: store to null in non-default addr space should not beChris Lattner2009-06-111-1/+2
| | | | | | turned into unreachable. llvm-svn: 73195
* Implement and use new method Function::hasAddressTaken().Jay Foad2009-06-103-38/+6
| | | | llvm-svn: 73164
* Remove an unused function SafeToDestroyConstant(). Rename an almostJay Foad2009-06-092-24/+9
| | | | | | | identical function ConstantIsDead() to SafeToDestroyConstant(), to emphasise the connection with Constant::destroyConstant(). llvm-svn: 73149
* Don't crash on multiple return value with no obvious inserted value.Nick Lewycky2009-06-061-2/+2
| | | | | | Fixes PR4314. llvm-svn: 73007
* PR4340: Run SimplifyDemandedVectorElts on insertelement instructions; Eli Friedman2009-06-061-0/+6
| | | | | | sometimes it can find simplifications that won't be found otherwise. llvm-svn: 73006
* Use cast<> instead of dyn_cast<> for things that are known to beJay Foad2009-06-064-23/+16
| | | | | | Instructions. llvm-svn: 73002
* Simplify.Devang Patel2009-06-051-15/+5
| | | | llvm-svn: 72965
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-047-64/+182
| | | | | | | | | | | | | | | 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 llvm-svn: 72897
* Don't do the X * 0.0 -> 0.0 transformation in instcombine, becauseDan Gohman2009-06-041-5/+5
| | | | | | | | instcombine doesn't know when it's safe. To partially compensate for this, introduce new code to do this transformation in dagcombine, which can use UnsafeFPMath. llvm-svn: 72872
* Don't attempt to simplify an non-affine IV expression if it can'tDan Gohman2009-06-031-12/+10
| | | | | | be simplified to a loop-invariant value. This fixes PR4315. llvm-svn: 72798
* Fix CodeGenPrepare's address-mode sinking to handle unusualDan Gohman2009-06-021-1/+4
| | | | | | | addresses, involving Base values which do not have Pointer type. This fixes PR4297. llvm-svn: 72739
OpenPOWER on IntegriCloud