summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ConstantFolding.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Give these files top-level comments that describe the current code.Dan Gohman2009-09-101-3/+7
| | | | llvm-svn: 81473
* Revert 80959. It isn't sufficient to solve the full problem. And itDan Gohman2009-09-031-12/+6
| | | | | | introduced regressions in the Ocaml bindings tests. llvm-svn: 80969
* Remove the API for creating ConstantExprs with the nsw, nuw, inbounds,Dan Gohman2009-09-031-6/+12
| | | | | | | | | | | | | | | and exact flags. Because ConstantExprs are uniqued, creating an expression with this flag causes all expressions with the same operands to have the same flag, which may not be safe. Add, sub, mul, and sdiv ConstantExprs are usually folded anyway, so the main interesting flag here is inbounds, and the constant folder already knows how to set the inbounds flag automatically in most cases, so there isn't an urgent need for the API support. This can be reconsidered in the future, but for now just removing these API bits eliminates a source of potential trouble with little downside. llvm-svn: 80959
* fix PR4848 an infinite loop when indexing down through a recursive gepChris Lattner2009-09-021-1/+1
| | | | | | | and we get the original pointer type. This doesn't mean that we're at the first pointer being indexed. Correct the predicate. llvm-svn: 80762
* Don't assume that the operand of an inttoptr is an pointer-sized integer.Dan Gohman2009-08-211-1/+3
| | | | llvm-svn: 79651
* Change getelementptr folding to use APInt instead of uint64_t forDan Gohman2009-08-211-11/+15
| | | | | | | offset computations. This fixes a truncation bug on targets that don't have 64-bit pointers. llvm-svn: 79639
* Various comment and whitespace cleanups.Dan Gohman2009-08-201-1/+1
| | | | llvm-svn: 79533
* Fix a bug in the over-index constant folding. When over-indexing anDan Gohman2009-08-191-8/+24
| | | | | | | | array member of a struct, it's possible to land in an arbitrary position inside that struct, such that attempting to find further getelementptr indices will fail. In such cases, folding cannot be done. llvm-svn: 79485
* Canonicalize indices in a constantexpr GEP. If Indices exceed theDan Gohman2009-08-191-4/+48
| | | | | | | | static extents of the static array type, it causes GlobalOpt and other passes to be more conservative. This canonicalization also allows the constant folder to add "inbounds" to GEPs. llvm-svn: 79440
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-14/+17
| | | | llvm-svn: 78948
* Move a few more APIs back to 2.5 forms. The only remaining ones left to ↵Owen Anderson2009-07-311-9/+9
| | | | | | | | change back are metadata related, which I'm waiting on to avoid conflicting with Devang. llvm-svn: 77721
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-4/+4
| | | | llvm-svn: 77635
* Move types back to the 2.5 API.Owen Anderson2009-07-291-4/+4
| | | | llvm-svn: 77516
* Move ConstantExpr to 2.5 API.Owen Anderson2009-07-291-26/+26
| | | | llvm-svn: 77494
* Return ConstantVector to 2.5 API.Owen Anderson2009-07-281-1/+1
| | | | llvm-svn: 77366
* Move ConstantFP construction back to the 2.5-ish API.Owen Anderson2009-07-271-6/+6
| | | | llvm-svn: 77247
* Remove Value::getNameLenDaniel Dunbar2009-07-261-78/+44
| | | | llvm-svn: 77148
* Revert the ConstantInt constructors back to their 2.5 forms where possible, ↵Owen Anderson2009-07-241-10/+10
| | | | | | thanks to contexts-on-types. More to come. llvm-svn: 77011
* Get rid of the Pass+Context magic.Owen Anderson2009-07-221-71/+71
| | | | llvm-svn: 76702
* llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.Torok Edwin2009-07-141-3/+3
| | | | | | | | | 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
* assert(0) -> LLVM_UNREACHABLE.Torok Edwin2009-07-111-3/+4
| | | | | | | | | 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
* Remove the vicmp and vfcmp instructions. Because we never had a release withNick Lewycky2009-07-081-2/+0
| | | | | | | these instructions, no autoupgrade or backwards compatibility support is provided. llvm-svn: 74991
* "LLVMContext* " --> "LLVMContext *"Owen Anderson2009-07-061-11/+11
| | | | llvm-svn: 74878
* Thread LLVMContext through the constant folding APIs, which touches a lot of ↵Owen Anderson2009-07-061-102/+120
| | | | | | files. llvm-svn: 74844
* Support vector casts in more places, fixing a variety of assertionDan Gohman2009-06-151-2/+2
| | | | | | | | | | | | | | | 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
* Change ConstantFoldConstantExpression to accept a nullDan Gohman2009-06-021-2/+0
| | | | | | | | | | | TargetData pointer. The only thing it's used for are calls to ConstantFoldCompareInstOperands and ConstantFoldInstOperands, which both already accept a null TargetData pointer. This makes ConstantFoldConstantExpression easier to use in clients where TargetData is optional. llvm-svn: 72741
* Use v.data() instead of &v[0] when SmallVector v might be empty.Jay Foad2009-05-211-5/+5
| | | | llvm-svn: 72210
* Rename PaddedSize to AllocSize, in the hope that thisDuncan Sands2009-05-091-3/+3
| | | | | | | will make it more obvious what it represents, and stop it being confused with the StoreSize. llvm-svn: 71349
* Revert 71165. It did more than just revert 71158 and it introducedDan Gohman2009-05-071-4/+36
| | | | | | several regressions. The problem due to 71158 is now fixed. llvm-svn: 71176
* Temporarily revert r71158. It was causing a failure during a full bootstrap:Bill Wendling2009-05-071-36/+4
| | | | | | | | | | | | | | | | | | | | | checking for bcopy... no checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511. /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://developer.apple.com/bugreporter> for instructions. make[4]: *** [decUtility.o] Error 1 make[4]: *** Waiting for unfinished jobs.... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511. /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://developer.apple.com/bugreporter> for instructions. make[4]: *** [decNumber.o] Error 1 make[3]: *** [all-stage2-libdecnumber] Error 2 make[3]: *** Waiting for unfinished jobs.... llvm-svn: 71165
* Constant-fold ptrtoint+add+inttoptr to gep when the pointer is anDan Gohman2009-05-071-4/+36
| | | | | | | array and the add is within range. This helps simplify expressions expanded by ScalarEvolutionExpander. llvm-svn: 71158
* use higher level APIs.Chris Lattner2009-04-031-8/+6
| | | | llvm-svn: 68351
* Rename getABITypeSize to getTypePaddedSize, asDuncan Sands2009-01-121-1/+1
| | | | | | suggested by Chris. llvm-svn: 62099
* Fix whitespace in comment.Nick Lewycky2008-12-151-2/+1
| | | | | | | Remove TODO; icmp isn't a binary operator, so this function will never deal with them. llvm-svn: 61020
* undef beats zero. Fix this missed optimization opportunity. Patch by Matt Elder!Nick Lewycky2008-11-201-1/+1
| | | | llvm-svn: 59705
* Don't try to create a mask when we don't need one. Fixes a crash.Nick Lewycky2008-10-241-4/+6
| | | | llvm-svn: 58075
* Teach constant folding that an inttoptr of aDuncan Sands2008-08-131-0/+13
| | | | | | | ptrtoint can be turned into a bitcast if the integer is at least as wide as a pointer. llvm-svn: 54752
* Fix minor issues with VICmp/VFCmp constant expressionsNate Begeman2008-07-251-1/+3
| | | | llvm-svn: 54030
* "ret (constexpr)" can't be folded into a Constant. Add a method toNick Lewycky2008-05-251-16/+45
| | | | | | | | | | Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it to try to use targetdata to fold constant expressions on void instructions. Also extend the icmp(inttoptr, inttoptr) folding to handle the case where int size != ptr size. llvm-svn: 51559
* transform more loops to iterator form, detabifyGabor Greif2008-05-221-1/+1
| | | | llvm-svn: 51436
* Rewrite operand loops to use iterators. This shrinks .o file (at gcc4.0.1 ↵Gabor Greif2008-05-221-4/+5
| | | | | | -O3 x86) substantially (>500 bytes). Reason still unknown. llvm-svn: 51423
* suppress gcc3.4.6's <no value returned> warningsGabor Greif2008-05-211-0/+2
| | | | llvm-svn: 51372
* Remove dead return. Thanks to Bill for the review!Chris Lattner2008-05-081-2/+0
| | | | llvm-svn: 50863
* Add support for constant folding the 'offsetof' pattern even if theChris Lattner2008-05-081-16/+23
| | | | | | base is not zero. This fixes test/C++Frontend/2008-05-07-CrazyOffsetOf.cpp llvm-svn: 50840
* Switch to using Simplified ConstantFP::get API.Chris Lattner2008-04-201-11/+9
| | | | llvm-svn: 49977
* minor code cleanups, allow constant folding sinf/cosf.Chris Lattner2008-03-301-20/+26
| | | | llvm-svn: 48961
* Avoid unnecessarily casting away const, fixing a FIXME.Dan Gohman2008-01-311-1/+1
| | | | llvm-svn: 46591
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Fix a bug in my previous patch, thanks to Jay Foad forChris Lattner2007-12-121-2/+2
| | | | | | pointing this out and correcting the patch! llvm-svn: 44907
* Implement constant folding if vector<->vector bitcasts where the numberChris Lattner2007-12-111-2/+122
| | | | | | | of source/dest elements changes. This implements test/Transforms/InstCombine/bitcast-vector-fold.ll llvm-svn: 44855
OpenPOWER on IntegriCloud