summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFold.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename VMCore directory to IR.Chandler Carruth2013-01-021-2066/+0
| | | | | | | | | | | | | | | | | | Aside from moving the actual files, this patch only updates the build system and the source file comments under lib/... that are relevant. I'll be updating other docs and other files in smaller subsequnet commits. While I've tried to test this, but it is entirely possible that there will still be some build system fallout. Also, note that I've not changed the library name itself: libLLVMCore.a is still the library name. I'd be interested in others' opinions about whether we should rename this as well (I think we should, just not sure what it might break) llvm-svn: 171359
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-2/+2
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Fix isEliminableCastPair to work correctly in the presence of pointersDuncan Sands2012-10-301-1/+5
| | | | | | with different sizes. llvm-svn: 167018
* Enable some additional constant folding for PPCDoubleDouble.Ulrich Weigand2012-10-301-17/+3
| | | | | | This fixes Clang :: CodeGen/complex-builtints.c on PowerPC. llvm-svn: 167013
* Move TargetData to DataLayout.Micah Villmow2012-10-081-1/+1
| | | | llvm-svn: 165402
* Remove tabs.Bill Wendling2012-07-191-2/+2
| | | | llvm-svn: 160477
* Reapply r155682, making constant folding more consistent, with a fix to workDan Gohman2012-04-271-28/+37
| | | | | | properly with how the code handles all-undef PHI nodes. llvm-svn: 155721
* Revert r155682, "Use ConstantExpr::getExtractElement when constant-folding ↵NAKAMURA Takumi2012-04-271-37/+28
| | | | | | | | vectors" It broke stage2 build. stage1/clang sometimes crashed. llvm-svn: 155699
* Use ConstantExpr::getExtractElement when constant-folding vectorsDan Gohman2012-04-271-28/+37
| | | | | | | | | | | | | | | | | | | | | instead of getAggregateElement. This has the advantage of being more consistent and allowing higher-level constant folding to procede even if an inner extract element cannot be folded. Make ConstantFoldInstruction call ConstantFoldConstantExpression on the instruction's operands, making it more consistent with ConstantFoldConstantExpression itself. This makes sure that ConstantExprs get TargetData-aware folding before being handed off as operands for further folding. This causes more expressions to be folded, but due to a known shortcoming in constant folding, this currently has the side effect of stripping a few more nuw and inbounds flags in the non-targetdata side of constant-fold-gep.ll. This is mostly harmless. This fixes rdar://11324230. llvm-svn: 155682
* ConstantFoldSelectInstruction swapped the operands of the select.Nadav Rotem2012-04-241-1/+1
| | | | | | Fix 12592. Patch by Matt Pharr. llvm-svn: 155480
* Remove some dead code and tidy things up now that vectors use ConstantDataVectorChris Lattner2012-02-061-16/+0
| | | | | | instead of always using ConstantVector. llvm-svn: 149912
* Fix ConstantFoldShuffleVectorInstruction to properly handle the caseChris Lattner2012-01-301-3/+5
| | | | | | when the result type has a different # elements than the input vectors. llvm-svn: 149221
* continue making the world safe for ConstantDataVector. At this point,Chris Lattner2012-01-271-28/+38
| | | | | | | we should (theoretically optimize and codegen ConstantDataVector as well as ConstantVector. llvm-svn: 149116
* unbreak test/Bitcode/shuffle.ll.Chris Lattner2012-01-261-0/+3
| | | | llvm-svn: 149033
* simplify by using ShuffleVectorInst::getMaskValue.Chris Lattner2012-01-261-10/+8
| | | | llvm-svn: 149029
* eliminate the Constant::getVectorElements method. There are better (andChris Lattner2012-01-261-10/+10
| | | | | | | more robust) ways to do what it was doing now. Also, add static methods for decoding a ShuffleVector mask. llvm-svn: 149028
* Continue improving support for ConstantDataAggregate, and use theChris Lattner2012-01-261-358/+91
| | | | | | new methods recently added to (sometimes greatly!) simplify code. llvm-svn: 149024
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-2/+2
| | | | llvm-svn: 148578
* Don't try to create a GEP when the pointee type is unsized (such GEPsDuncan Sands2012-01-111-1/+2
| | | | | | | are invalid). Fixes a crash on array1.C from the GCC testsuite when compiled with dragonegg. llvm-svn: 147946
* The powers that be have decided that LLVM IR should now support 16-bitDan Gohman2011-12-171-1/+2
| | | | | | | | "half precision" floating-point with a first-class type. This patch adds basic IR support (but not codegen support). llvm-svn: 146786
* Make constant folding for GEPs a bit more aggressive.Eli Friedman2011-12-151-1/+1
| | | | llvm-svn: 146639
* Return undef value (instead of arbitrary) for wrong or undef index inJakub Staszak2011-09-021-4/+4
| | | | | | ConstantVector. llvm-svn: 139007
* ConstantVector returns arbitrary value for the wrong index.Jakub Staszak2011-09-021-0/+4
| | | | | | This fixes PR10813. llvm-svn: 139006
* Convert GetElementPtrInst to use ArrayRef.Jay Foad2011-07-251-3/+2
| | | | llvm-svn: 135904
* Make better use of ConstantExpr::getGetElementPtr's InBounds parameter.Jay Foad2011-07-211-12/+8
| | | | llvm-svn: 135676
* Convert ConstantExpr::getGetElementPtr andJay Foad2011-07-211-17/+12
| | | | | | ConstantExpr::getInBoundsGetElementPtr to use ArrayRef. llvm-svn: 135673
* Convert ConstantFoldGetElementPtr to use ArrayRef.Jay Foad2011-07-191-24/+21
| | | | llvm-svn: 135483
* Add APInt(numBits, ArrayRef<uint64_t> bigVal) constructor to prevent future ↵Jeffrey Yasskin2011-07-181-1/+1
| | | | | | | | | ambiguity errors like the one corrected by r135261. Migrate all LLVM callers of the old constructor to the new one. llvm-svn: 135431
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-65/+65
| | | | llvm-svn: 135375
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-131-22/+18
| | | | llvm-svn: 135040
* don't load element before checking to see if it is valid.Chris Lattner2011-07-091-2/+2
| | | | llvm-svn: 134836
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. llvm-svn: 134829
* Improve constant folding of undef for cmp and select operators.Dan Gohman2011-07-011-2/+7
| | | | llvm-svn: 134223
* Improve constant folding of undef for binary operators.Dan Gohman2011-07-011-4/+24
| | | | llvm-svn: 134221
* Make ConstantVector::get() always take an ArrayRef, never a std::vector.Jay Foad2011-06-221-1/+1
| | | | llvm-svn: 133614
* Revamp the "ConstantStruct::get" methods. Previously, these were scatteredChris Lattner2011-06-201-3/+3
| | | | | | | | | | | | | | | 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
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* Don't include Operator.h from InstrTypes.h.Jay Foad2011-04-111-0/+1
| | | | llvm-svn: 129271
* Enhance constant folding of bitcast operations on vectors of floats.Nadav Rotem2011-02-171-2/+1
| | | | | | | Add getAllOnesValue of FP numbers to Constants and APFloat. Add more tests. llvm-svn: 125776
* convert ConstantVector::get to use ArrayRef.Chris Lattner2011-02-151-6/+6
| | | | llvm-svn: 125537
* revert my ConstantVector patch, it seems to have made the llvm-gccChris Lattner2011-02-141-6/+6
| | | | | | builders unhappy. llvm-svn: 125504
* Switch ConstantVector::get to use ArrayRef instead of a pointer+sizeChris Lattner2011-02-141-6/+6
| | | | | | idiom. Change various clients to simplify their code. llvm-svn: 125487
* Fix a regression from r125393;Nadav Rotem2011-02-131-1/+2
| | | | | | | | | | | | | It caused a crash in MultiSource/Benchmarks/Bullet. Opt hit an assertion with "opt -std-compile-opts" because Constant::getAllOnesValue doesn't know how to handle floats. This patch added a test to reproduce the problem and a check that the destination vector is of integer type. Thank you Benjamin! llvm-svn: 125459
* Fix 9173.Nadav Rotem2011-02-111-0/+40
| | | | | | | Add more folding patterns to constant expressions of vector selects and vector bitcasts. llvm-svn: 125393
* Fix 'fcmp one' constant folding. Noticed by inspection.Nick Lewycky2011-01-301-1/+1
| | | | llvm-svn: 124557
* Fix some formatting and upgrade comments from llvm 1.x to 2.x syntax.Nick Lewycky2011-01-301-6/+6
| | | | llvm-svn: 124556
* Add the select optimization recently added to instcombine to constant folding.Nick Lewycky2011-01-291-0/+12
| | | | | | | This is the one where one of the branches of the select is another select on the same condition. llvm-svn: 124547
* Add a constant folding of casts from zero to zero. Fixes PR9011!Nick Lewycky2011-01-211-0/+4
| | | | | | | | While here, I'd like to complain about how vector is not an aggregate type according to llvm::Type::isAggregateType(), but they're listed under aggregate types in the LangRef and zero vectors are stored as ConstantAggregateZero. llvm-svn: 123956
* Remove casts between Value** and Constant**, which won't work if aJay Foad2011-01-141-18/+31
| | | | | | | static_cast from Constant* to Value* has to adjust the "this" pointer. This is groundwork for PR889. llvm-svn: 123435
* Move some shift transforms out of instcombine and into InstructionSimplify.Duncan Sands2011-01-141-2/+2
| | | | | | | | | | | | While there, I noticed that the transform "undef >>a X -> undef" was wrong. For example if X is 2 then the top two bits must be equal, so the result can not be anything. I fixed this in the constant folder as well. Also, I made the transform for "X << undef" stronger: it now folds to undef always, even though X might be zero. This is in accordance with the LangRef, but I must admit that it is fairly aggressive. Also, I added "i32 X << 32 -> undef" following the LangRef and the constant folder, likewise fairly aggressive. llvm-svn: 123417
OpenPOWER on IntegriCloud