summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Avoid infinite looping in AllGlobalLoadUsesSimpleEnoughForHeapSRA(). This ↵Evan Cheng2009-06-021-6/+16
| | | | | | can happen when PHI uses are recursively dependent on each other. llvm-svn: 72710
* PR4286: Make RewriteLoadUserOfWholeAlloca and Eli Friedman2009-06-011-8/+13
| | | | | | | | RewriteStoreUserOfWholeAlloca deal with tail padding because isSafeUseOfBitCastedAllocation expects them to. Otherwise, we crash trying to erase the bitcast. llvm-svn: 72688
* Be more aggressive in doing LoadPRE by tracing backwards when a block only hasOwen Anderson2009-05-311-4/+39
| | | | | | | | a single predecessor. Patch by Jakub Staszak. llvm-svn: 72661
* fix PR4284, a bug in simplifylibcalls handling memcmp. Patch by Chris Lattner2009-05-301-1/+1
| | | | | | Benjamin Kramer! llvm-svn: 72625
* Give embedded metadata its own type instead of relying on EmptyStructTy.Nick Lewycky2009-05-301-1/+24
| | | | llvm-svn: 72610
* Enable GVN Load PRE.Bill Wendling2009-05-291-1/+1
| | | | llvm-svn: 72589
* just show the instruction, its not that slow.Torok Edwin2009-05-291-6/+1
| | | | llvm-svn: 72577
* for instructions with void type we have no choice but print the instruction asTorok Edwin2009-05-291-1/+4
| | | | | | is, otherwise we get a <badref>. llvm-svn: 72567
* Add a DEBUG() output to GVN that prints the instruction clobbering a load.Torok Edwin2009-05-291-1/+11
| | | | | | | This is useful when trying to figure out why GVN didn't eliminate redundant loads. llvm-svn: 72565
* Fix an issue where phiMap was not being updated properly when doing load PRE.Owen Anderson2009-05-291-0/+5
| | | | | | Diagnosis and patch thanks to Jakub Staszak. llvm-svn: 72562
* Use Operands.data() instead of &Operands[0] where Operands is a potentiallyNick Lewycky2009-05-281-1/+1
| | | | | | empty SmallVector. llvm-svn: 72512
* Revert 72493 and replace it with a more conservative fix, for now: don'tDan Gohman2009-05-271-7/+8
| | | | | | | | rewrite the comparison if there is any implicit extension or truncation on the induction variable. I'm planning for IVUsers to eventually take over some of the work of this code, and for it to be generalized. llvm-svn: 72496
OpenPOWER on IntegriCloud