summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ConstantFolding.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Change ConstantArray::get to form a ConstantDataArray when possible,Chris Lattner2012-01-311-3/+3
| | | | | | | | | | | | | | | kicking in the big win of ConstantDataArray. As part of this, change the implementation of GetConstantStringInfo in ValueTracking to work with ConstantDataArray (and not ConstantArray) making it dramatically, amazingly, more efficient in the process and renaming it to getConstantStringInfo. This keeps around a GetConstantStringInfo entrypoint that (grossly) forwards to getConstantStringInfo and constructs the std::string required, but existing clients should move over to getConstantStringInfo instead. llvm-svn: 149351
* Add r149110 back with a fix for when the vector and the int have the sameRafael Espindola2012-01-271-0/+38
| | | | | | width. llvm-svn: 149151
* Revert r149110 and add a testcase that was crashing since that revision.Rafael Espindola2012-01-271-38/+0
| | | | | | | Unfortunately I also had to disable constant-pool-sharing.ll the code it tests has been updated to use the IL logic. llvm-svn: 149148
* enhance constant folding to be able to constant fold bitcast of Chris Lattner2012-01-271-0/+38
| | | | | | ConstantVector's to integer type. llvm-svn: 149110
* progress making the world safe to ConstantDataVector. WhileChris Lattner2012-01-261-39/+45
| | | | | | | | we're at it, allow PatternMatch's "neg" pattern to match integer vector negations, and enhance ComputeNumSigned bits to handle shl of vectors. llvm-svn: 149082
* use Constant::getAggregateElement to simplify a bunch of code.Chris Lattner2012-01-251-73/+24
| | | | llvm-svn: 148934
* Use the right method to get the # elements in a CDS.Chris Lattner2012-01-251-2/+2
| | | | llvm-svn: 148897
* Split the interesting bits of ConstantFoldLoadThroughGEPConstantExprChris Lattner2012-01-241-43/+56
| | | | | | | | | | out into a new ConstantFoldLoadThroughGEPIndices (more useful) function and rewrite it to be simpler, more efficient, and to handle the new ConstantDataSequential type. Enhance ConstantFoldLoadFromConstPtr to handle ConstantDataSequential. llvm-svn: 148786
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-2/+0
| | | | llvm-svn: 148578
* Switch llvm.cttz and llvm.ctlz to accept a second i1 parameter whichChandler Carruth2011-12-121-4/+8
| | | | | | | | | | | | | | | | | | | | indicates whether the intrinsic has a defined result for a first argument equal to zero. This will eventually allow these intrinsics to accurately model the semantics of GCC's __builtin_ctz and __builtin_clz and the X86 instructions (prior to AVX) which implement them. This patch merely sets the stage by extending the signature of these intrinsics and establishing auto-upgrade logic so that the old spelling still works both in IR and in bitcode. The upgrade logic preserves the existing (inefficient) semantics. This patch should not change any behavior. CodeGen isn't updated because it can use the existing semantics regardless of the flag's value. Note that this will be followed by API updates to Clang and DragonEgg. Reviewed by Nick Lewycky! llvm-svn: 146357
* Add support for vectors of pointers.Nadav Rotem2011-12-051-1/+2
| | | | llvm-svn: 145801
* Add support for constant folding the pow intrinsic.Chad Rosier2011-12-031-3/+6
| | | | | | rdar://10514247 llvm-svn: 145730
* Abuse of mass replace isn't warranted even when the build is failing. ThanksChad Rosier2011-12-011-25/+29
| | | | | | for the suggestion, Eric. llvm-svn: 145643
* Fix build by not assuming TLI is guaranteed. Will have to track down cases whereChad Rosier2011-12-011-24/+23
| | | | | | TLI isn't being passed to ensure we don't miss opportunities to fold calls. llvm-svn: 145641
* Prevent library calls from being folded if -fno-builtin has been specified.Chad Rosier2011-12-011-23/+24
| | | | | | rdar://10500969 llvm-svn: 145639
* Propagate TargetLibraryInfo throughout ConstantFolding.cpp and Chad Rosier2011-12-011-26/+35
| | | | | | | InstructionSimplify.cpp. Other fixups as needed. Part of rdar://10500969 llvm-svn: 145559
* Fixes following the CR by Chris and Duncan:Nadav Rotem2011-08-291-6/+0
| | | | | | | Optimize chained bitcasts of the form A->B->A. Undo r138722 and change isEliminableCastPair to allow this case. llvm-svn: 138756
* Bitcasts are transitive. Bitcast-Bitcast-X becomes Bitcast-X.Nadav Rotem2011-08-281-0/+6
| | | | llvm-svn: 138722
* Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api.Nadav Rotem2011-08-241-10/+7
| | | | llvm-svn: 138469
* Revert "Address Duncan's CR request:"Eric Christopher2011-08-231-4/+9
| | | | | | | | | | This reverts commit 20a05be15ea5271ab6185b83200fa88263362400. (svn rev 138340) Conflicts: test/Transforms/InstCombine/bitcast.ll llvm-svn: 138366
* Address Duncan's CR request:Nadav Rotem2011-08-231-9/+4
| | | | | | | 1. Cleanup the tests in ConstantFolding.cpp 2. Implement isAllOnes for Constant, ConstantFP, ConstantVector llvm-svn: 138340
* Add constant folding support for bitcasts of splat vectors to integers.Nadav Rotem2011-08-201-2/+10
| | | | llvm-svn: 138206
* Convert GetElementPtrInst to use ArrayRef.Jay Foad2011-07-251-2/+1
| | | | llvm-svn: 135904
* Convert ConstantExpr::getGetElementPtr andJay Foad2011-07-211-4/+3
| | | | | | ConstantExpr::getInBoundsGetElementPtr to use ArrayRef. llvm-svn: 135673
* Convert TargetData::getIndexedOffset to use ArrayRef.Jay Foad2011-07-191-7/+5
| | | | llvm-svn: 135478
* Use ArrayRef in ConstantFoldInstOperands and ConstantFoldCall.Jay Foad2011-07-191-22/+21
| | | | llvm-svn: 135477
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-31/+31
| | | | llvm-svn: 135375
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-131-2/+2
| | | | llvm-svn: 135040
* Revert "revert 133714"Rafael Espindola2011-06-231-2/+1
| | | | | | | | This reverts commit e8e00f5efb4a22238f2407bf813de4606f30c5aa. The cmake build on OS X is still broken. llvm-svn: 133718
* revert 133714Dylan Noblesmith2011-06-231-1/+2
| | | | | | It broke the build worse. llvm-svn: 133716
* 133713 broke the build, revert it.Rafael Espindola2011-06-231-2/+1
| | | | llvm-svn: 133714
* Support: make floating-exception header privateDylan Noblesmith2011-06-231-1/+2
| | | | | | | | It has only one user. This eliminates the last include of config.h from the public headers -- ideally, config.h shouldn't even be installed by `make install` anymore. llvm-svn: 133713
* Revamp the "ConstantStruct::get" methods. Previously, these were scatteredChris Lattner2011-06-201-1/+1
| | | | | | | | | | | | | | | all over the place in different styles and variants. Standardize on two preferred entrypoints: one that takes a StructType and ArrayRef, and one that takes StructType and varargs. In cases where there isn't a struct type convenient, we now add a ConstantStruct::getAnon method (whose name will make more sense after a few more patches land). It would be "really really nice" if the ConstantStruct::get and ConstantVector::get methods didn't make temporary std::vectors. llvm-svn: 133412
* implement PR9315, constant folding exp2 in terms of pow (since hosts withoutChris Lattner2011-05-221-1/+7
| | | | | | C99 runtimes don't have exp2). llvm-svn: 131872
* Don't include Operator.h from InstrTypes.h.Jay Foad2011-04-111-0/+1
| | | | llvm-svn: 129271
* Constant folding support for calls to umul.with.overflow(), basically ↵Frits van Bommel2011-03-271-3/+8
| | | | | | identical to the smul.with.overflow() code. llvm-svn: 128379
* convert ConstantVector::get to use ArrayRef.Chris Lattner2011-02-151-2/+2
| | | | llvm-svn: 125537
* revert my ConstantVector patch, it seems to have made the llvm-gccChris Lattner2011-02-141-2/+2
| | | | | | builders unhappy. llvm-svn: 125504
* Switch ConstantVector::get to use ArrayRef instead of a pointer+sizeChris Lattner2011-02-141-2/+2
| | | | | | idiom. Change various clients to simplify their code. llvm-svn: 125487
* Simplify test, as suggested by Chris.Anders Carlsson2011-02-061-6/+2
| | | | llvm-svn: 124990
* When loading from a constant, fold inttoptr if the integer type and the ↵Anders Carlsson2011-02-061-0/+11
| | | | | | resulting pointer type both have the same size. llvm-svn: 124987
* Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman2011-01-241-1/+2
| | | | | | | | | | | with BasicAA's DecomposeGEPExpression, which recently began using a TargetData. This fixes PR8968, though the testcase is awkward to reduce. Also, update several off GetUnderlyingObject's users which happen to have a TargetData handy to pass it in. llvm-svn: 124134
* fix PR8983, a broken assertion.Chris Lattner2011-01-161-1/+1
| | | | llvm-svn: 123562
* Teach constant folding to perform conversions from constant floatingChandler Carruth2011-01-111-0/+56
| | | | | | | | point values to their integer representation through the SSE intrinsic calls. This is the last part of a README.txt entry for which I have real world examples. llvm-svn: 123206
* Cleanup some of the constant folding code to consistently test intrinsicChandler Carruth2011-01-101-16/+18
| | | | | | | IDs when available rather than using a mixture of IDs and textual name comparisons. llvm-svn: 123165
* use isNullValue() to simplify code, add an assert.Chris Lattner2011-01-061-5/+6
| | | | llvm-svn: 122977
* implement constant folding support for an exotic constant expr:Chris Lattner2011-01-061-1/+19
| | | | | | | | | | ret i64 ptrtoint (i8* getelementptr ([1000 x i8]* @X, i64 1, i64 sub (i64 0, i64 ptrtoint ([1000 x i8]* @X to i64))) to i64) to "ret i64 1000". This allows us to correctly compute the trip count on a loop in PR8883, which occurs with std::fill on a char array. This allows us to transform it into a memset with a constant size. llvm-svn: 122950
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-2/+1
| | | | | | | new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
* Move Value::getUnderlyingObject to be a standaloneDan Gohman2010-12-151-1/+1
| | | | | | | function so that it can live in Analysis instead of VMCore. llvm-svn: 121885
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-4/+2
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121120
OpenPOWER on IntegriCloud