summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix some typos in a comment.Dan Gohman2009-07-171-7/+7
| | | | llvm-svn: 76249
* Add a new Operator class, for handling Instructions and ConstantExprsDan Gohman2009-07-171-13/+3
| | | | | | | | | in a convenient manner, factoring out some common code from InstructionCombining and ValueTracking. Move the contents of BinaryOperators.h into Operator.h and use Operator to generalize them to support ConstantExprs as well as Instructions. llvm-svn: 76232
* Revert yesterday's change by removing the LLVMContext parameter to ↵Owen Anderson2009-07-151-6/+4
| | | | | | AllocaInst and MallocInst. llvm-svn: 75863
* Don't restrict the set of instructions where we try to constant-fold the Eli Friedman2009-07-151-3/+1
| | | | | | | operands; it's possible to end up with a constant-foldable operand to most instructions, even those which can't trap. llvm-svn: 75845
* Move EVER MORE stuff over to LLVMContext.Owen Anderson2009-07-141-10/+18
| | | | llvm-svn: 75703
* llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.Torok Edwin2009-07-141-37/+37
| | | | | | | | | This adds location info for all llvm_unreachable calls (which is a macro now) in !NDEBUG builds. In NDEBUG builds location info and the message is off (it only prints "UREACHABLE executed"). llvm-svn: 75640
* Fix trivial todo in instcombine.Eli Friedman2009-07-141-1/+2
| | | | llvm-svn: 75586
* PR4548: optimize zext+udiv+trunc to udiv.Eli Friedman2009-07-131-1/+20
| | | | llvm-svn: 75539
* Canonicalize boolean +/- a constant to a select.Eli Friedman2009-07-131-6/+8
| | | | | | | | (I think it's reasonably clear that we want to have a canonical form for constructs like this; if anyone thinks that a select is not the best canonical form, please tell me.) llvm-svn: 75531
* These don't really need contexts either.Owen Anderson2009-07-131-4/+4
| | | | llvm-svn: 75528
* Misc simplifications to InstCombiner::commonIntCastTransforms. Most of Eli Friedman2009-07-131-60/+17
| | | | | | | | the changes are allowed by not calling this function for bitcasts. The Instruction::AShr case is dead because SimplifyDemandedInstructionBits handles that case. llvm-svn: 75514
* Fix comment.Eli Friedman2009-07-131-3/+2
| | | | llvm-svn: 75499
* Move more functionality over to LLVMContext.Owen Anderson2009-07-131-23/+29
| | | | llvm-svn: 75497
* Don't bother to call commonIntCastTransforms for bitcasts; int->int Eli Friedman2009-07-131-7/+3
| | | | | | bitcasts will always be eliminated anyway. llvm-svn: 75495
* Begin the painful process of tearing apart the rat'ss nest that is ↵Owen Anderson2009-07-131-18/+27
| | | | | | | | | Constants.cpp and ConstantFold.cpp. This involves temporarily hard wiring some parts to use the global context. This isn't ideal, but it's the only way I could figure out to make this process vaguely incremental. llvm-svn: 75445
* Remove check which is duplicated in Eli Friedman2009-07-121-20/+0
| | | | | | InstCombiner::visitSelectInstWithICmp. llvm-svn: 75409
* assert(0) -> LLVM_UNREACHABLE.Torok Edwin2009-07-111-35/+35
| | | | | | | | | Make llvm_unreachable take an optional string, thus moving the cerr<< out of line. LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for NDEBUG builds. llvm-svn: 75379
* Convert more assert(0)+abort() -> LLVM_UNREACHABLE,Torok Edwin2009-07-111-3/+3
| | | | | | and abort()/exit() -> llvm_report_error(). llvm-svn: 75363
* Push LLVMContext through the PatternMatch API.Owen Anderson2009-07-101-110/+132
| | | | llvm-svn: 75255
* This started as a small change, I swear. Unfortunately, lots of things call ↵Owen Anderson2009-07-091-139/+153
| | | | | | the [I|F]CmpInst constructors. Who knew!? llvm-svn: 75200
* A little bit more LLVMContextification.Owen Anderson2009-07-091-2/+4
| | | | llvm-svn: 75159
* "LLVMContext* " --> "LLVMContext *"Owen Anderson2009-07-061-31/+31
| | | | llvm-svn: 74878
* Thread LLVMContext through the constant folding APIs, which touches a lot of ↵Owen Anderson2009-07-061-4/+6
| | | | | | files. llvm-svn: 74844
* Convert the first batch of passes to use LLVMContext.Owen Anderson2009-07-031-612/+695
| | | | llvm-svn: 74748
* Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487.Dan Gohman2009-07-011-1/+15
| | | | llvm-svn: 74646
* 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
* 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-161-39/+0
| | | | | | | 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
* Support vector casts in more places, fixing a variety of assertionDan Gohman2009-06-151-126/+155
| | | | | | | | | | | | | | | 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 old-style type names in comments.Dan Gohman2009-06-141-6/+6
| | | | llvm-svn: 73362
* 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
* Fix 4366: store to null in non-default addr space should not beChris Lattner2009-06-111-1/+2
| | | | | | turned into unreachable. llvm-svn: 73195
* 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
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-041-53/+163
| | | | | | | | | | | | | | | 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
* Fix bug in FoldFCmp_IntToFP_Cst. If inttofp is a uintofp, use unsigned ↵Evan Cheng2009-05-221-61/+67
| | | | | | instead of signed integer constant. llvm-svn: 72300
* Teach ValueTracking a new way to analyze PHI nodes, and and teachDan Gohman2009-05-211-2/+4
| | | | | | | | Instcombine to be more aggressive about using SimplifyDemandedBits on shift nodes. This allows a shift to be simplified to zero in the included test case. llvm-svn: 72204
* calls in nothrow functions can be marked nothrow even if the calleeChris Lattner2009-05-131-0/+10
| | | | | | | is not known to be nothrow. This allows readnone/readonly functions to be deleted even if we don't know whether the callee can throw. llvm-svn: 71676
* Rename PaddedSize to AllocSize, in the hope that thisDuncan Sands2009-05-091-15/+15
| | | | | | | will make it more obvious what it represents, and stop it being confused with the StoreSize. llvm-svn: 71349
* This transform requires valid TargetData info. Wrap it in 'if (TD)' inNick Lewycky2009-05-081-25/+27
| | | | | | preparation for the day we use null TargetData when no target is specified. llvm-svn: 71210
* Perform constant folding on operands of instructions with non-voidDan Gohman2009-05-071-1/+3
| | | | | | types, such as loads and calls. llvm-svn: 71175
* Allow readonly functions to unwind exceptions. TeachDuncan Sands2009-05-061-1/+1
| | | | | | | | the optimizers about this. For example, a readonly function with no uses cannot be removed unless it is also marked nounwind. llvm-svn: 71071
* Return null instead of false, as appropriate.Dan Gohman2009-04-251-3/+3
| | | | llvm-svn: 70054
* Add several more icmp simplifications. Transform signed comparisonsDan Gohman2009-04-251-82/+159
| | | | | | | into unsigned ones when the operands are known to have the same sign bit value. llvm-svn: 70053
* Allow i16 type indices to gep.Sanjiv Gupta2009-04-241-6/+1
| | | | llvm-svn: 69946
* Before trying to introduce/eliminate cast/ext/trunc to make indices type asSanjiv Gupta2009-04-201-1/+6
| | | | | | pointer type, make sure that the pointer size is a valid sequential index type. llvm-svn: 69574
* Instcombine should not promote whole computation trees to "strange"Chris Lattner2009-04-081-0/+20
| | | | | | | | | | | | | integer types, unless they are already strange. This prevents it from turning the code produced by SROA into crazy libcalls and stuff that the code generator can't handle. In the attached example, the result was an i96 multiply that caused the x86 backend to assert. Note that if TargetData had an idea of what the legal types are for a target that this could be used to stop instcombine from introducing i64 muls, as Scott wanted. llvm-svn: 68598
* fix rdar://6762290, a crash compiling cxx filt with clang.Chris Lattner2009-04-071-3/+4
| | | | llvm-svn: 68500
OpenPOWER on IntegriCloud