summaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
Commit message (Collapse)AuthorAge
* Implement Constant::isAllOnesValue(). Fix ConstantFolding to use the new api.Nadav Rotem2011-08-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138469 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Address Duncan's CR request:"Eric Christopher2011-08-23
| | | | | | | | | | This reverts commit 20a05be15ea5271ab6185b83200fa88263362400. (svn rev 138340) Conflicts: test/Transforms/InstCombine/bitcast.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138366 91177308-0d34-0410-b5e6-96231b3b80d8
* Address Duncan's CR request:Nadav Rotem2011-08-23
| | | | | | | | | | | 1. Cleanup the tests in ConstantFolding.cpp 2. Implement isAllOnes for Constant, ConstantFP, ConstantVector git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138340 91177308-0d34-0410-b5e6-96231b3b80d8
* strengthen up an assertion: you can't create a constant structChris Lattner2011-08-07
| | | | | | | | with an opaque struct type, it doesn't make sense. This should resolve PR10473. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137028 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ArrayRef in the (protected) constructors of ConstantArray, ↵Jay Foad2011-07-25
| | | | | | ConstantStruct and ConstantVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135905 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert GetElementPtrInst to use ArrayRef.Jay Foad2011-07-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135904 91177308-0d34-0410-b5e6-96231b3b80d8
* Make better use of ConstantExpr::getGetElementPtr's InBounds parameter.Jay Foad2011-07-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135676 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert ConstantExpr::getGetElementPtr andJay Foad2011-07-21
| | | | | | | ConstantExpr::getInBoundsGetElementPtr to use ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135673 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert ConstantFoldGetElementPtr to use ArrayRef.Jay Foad2011-07-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135483 91177308-0d34-0410-b5e6-96231b3b80d8
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
* tidy upChris Lattner2011-07-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135360 91177308-0d34-0410-b5e6-96231b3b80d8
* remove the old and dangerous uncheckedReplaceAllUsesWith method,Chris Lattner2011-07-15
| | | | | | | | which was just replaceAllUsesWith without some assertions. It was needed back when type refinement was alive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135253 91177308-0d34-0410-b5e6-96231b3b80d8
* devirtualize Constant::isNullValue:Chris Lattner2011-07-15
| | | | | | | | 4 files changed, 15 insertions(+), 60 deletions(-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135252 91177308-0d34-0410-b5e6-96231b3b80d8
* add CFP::isNegative() and ConstnatInt::isNegative() methods.Chris Lattner2011-07-15
| | | | | | | | Devirtualize the isNegativeZeroValue method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135249 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.Jay Foad2011-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135040 91177308-0d34-0410-b5e6-96231b3b80d8
* Second attempt at de-constifying LLVM Types in FunctionType::get(),Jay Foad2011-07-12
| | | | | | StructType::get() and TargetData::getIntPtrType(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134982 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify assertions to not be completely redundant.Chris Lattner2011-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134968 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r134893 and r134888 (and related patches in other trees). It was causingBill Wendling2011-07-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an assert on Darwin llvm-gcc builds. Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\ ne 2067. etc. http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354 --- Reverse-merging r134893 into '.': U include/llvm/Target/TargetData.h U include/llvm/DerivedTypes.h U tools/bugpoint/ExtractFunction.cpp U unittests/Support/TypeBuilderTest.cpp U lib/Target/ARM/ARMGlobalMerge.cpp U lib/Target/TargetData.cpp U lib/VMCore/Constants.cpp U lib/VMCore/Type.cpp U lib/VMCore/Core.cpp U lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Instrumentation/ProfilingUtils.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/CodeGen/SjLjEHPrepare.cpp --- Reverse-merging r134888 into '.': G include/llvm/DerivedTypes.h U include/llvm/Support/TypeBuilder.h U include/llvm/Intrinsics.h U unittests/Analysis/ScalarEvolutionTest.cpp U unittests/ExecutionEngine/JIT/JITTest.cpp U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp U unittests/VMCore/PassManagerTest.cpp G unittests/Support/TypeBuilderTest.cpp U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp U lib/VMCore/IRBuilder.cpp G lib/VMCore/Type.cpp U lib/VMCore/Function.cpp G lib/VMCore/Core.cpp U lib/VMCore/Module.cpp U lib/AsmParser/LLParser.cpp U lib/Transforms/Utils/CloneFunction.cpp G lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Utils/InlineFunction.cpp U lib/Transforms/Instrumentation/GCOVProfiling.cpp U lib/Transforms/Scalar/ObjCARC.cpp U lib/Transforms/Scalar/SimplifyLibCalls.cpp U lib/Transforms/Scalar/MemCpyOptimizer.cpp G lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/Transforms/IPO/ArgumentPromotion.cpp U lib/Transforms/InstCombine/InstCombineCompares.cpp U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp U lib/Transforms/InstCombine/InstCombineCalls.cpp U lib/CodeGen/DwarfEHPrepare.cpp U lib/CodeGen/IntrinsicLowering.cpp U lib/Bitcode/Reader/BitcodeReader.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134949 91177308-0d34-0410-b5e6-96231b3b80d8
* De-constify Types in StructType::get() and TargetData::getIntPtrType().Jay Foad2011-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134893 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence -Wunused-variable in release builds.Chandler Carruth2011-07-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134868 91177308-0d34-0410-b5e6-96231b3b80d8
* the various ConstantExpr::get*Ty methods existed to work with issues aroundChris Lattner2011-07-09
| | | | | | | type refinement. Zap them now that type refinement is toast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134837 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10210: New method ConstantArray::getAsCString(). Use it in LTO toJay Foad2011-06-28
| | | | | | | avoid getting embedded trailing null bytes in std::strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133999 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the existing forms of ConstantArray::get() with a single formJay Foad2011-06-22
| | | | | | that takes an ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133615 91177308-0d34-0410-b5e6-96231b3b80d8
* Make ConstantVector::get() always take an ArrayRef, never a std::vector.Jay Foad2011-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133614 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate a temporary std::vector in ConstantStruct::get().Jay Foad2011-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133612 91177308-0d34-0410-b5e6-96231b3b80d8
* Revamp the "ConstantStruct::get" methods. Previously, these were scatteredChris Lattner2011-06-20
| | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133412 91177308-0d34-0410-b5e6-96231b3b80d8
* fix the varargs version of StructType::get to not require an LLVMContext, ↵Chris Lattner2011-06-18
| | | | | | | | | making usage much cleaner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133364 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused STL header includes.Jay Foad2011-04-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130068 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9214: Convert ConstantExpr::getIndices() to return an ArrayRef, plusJay Foad2011-04-13
| | | | | | related tweaks to ExprMapKeyType. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129443 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some redundant llvm:: prefixes.Jay Foad2011-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129441 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9214: Convert ConstantExpr::getWithOperands() to use ArrayRef.Jay Foad2011-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129439 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantInt has some getters which return ConstantInt's or ConstantVector's ofNick Lewycky2011-03-06
| | | | | | | | | the value splatted into every element. Extend this to getTrue and getFalse which by providing new overloads that take Types that are either i1 or <N x i1>. Use it in InstCombine to add vector support to some code, fixing PR8469! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127116 91177308-0d34-0410-b5e6-96231b3b80d8
* Added missing va_end().Talin2011-03-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126759 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an END_WITH_NULL accessor for ConstantStruct.Talin2011-02-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126714 91177308-0d34-0410-b5e6-96231b3b80d8
* hoist GlobalValue::removeDeadConstantUsers up to being a method on Constant.Chris Lattner2011-02-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125828 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance constant folding of bitcast operations on vectors of floats.Nadav Rotem2011-02-17
| | | | | | | | | Add getAllOnesValue of FP numbers to Constants and APFloat. Add more tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125776 91177308-0d34-0410-b5e6-96231b3b80d8
* convert ConstantVector::get to use ArrayRef.Chris Lattner2011-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125537 91177308-0d34-0410-b5e6-96231b3b80d8
* revert my ConstantVector patch, it seems to have made the llvm-gccChris Lattner2011-02-14
| | | | | | | builders unhappy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125504 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch ConstantVector::get to use ArrayRef instead of a pointer+sizeChris Lattner2011-02-14
| | | | | | | idiom. Change various clients to simplify their code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125487 91177308-0d34-0410-b5e6-96231b3b80d8
* make ConstantExpr::replaceUsesOfWithOnConstant preserve the inboundsChris Lattner2011-02-11
| | | | | | | flag. Noticed by Jin Gu Kang! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125366 91177308-0d34-0410-b5e6-96231b3b80d8
* make the constantexpr interfaces for inbounds GEPs follow the same styleChris Lattner2011-02-11
| | | | | | | as other constantexpr flags, reducing redundancy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125365 91177308-0d34-0410-b5e6-96231b3b80d8
* switch the constantexpr, target folder, and IRBuilder interfacesChris Lattner2011-02-10
| | | | | | | | for NSW/NUW binops to follow the pattern of exact binops. This allows someone to use Builder.CreateAdd(x, y, "tmp", MaybeNUW); git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125270 91177308-0d34-0410-b5e6-96231b3b80d8
* refactor ConstantExpr interfaces a bit around "exactness".Chris Lattner2011-02-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125190 91177308-0d34-0410-b5e6-96231b3b80d8
* fix comment change.Chris Lattner2011-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125047 91177308-0d34-0410-b5e6-96231b3b80d8
* implement .ll and .bc support for nsw/nuw on shl and exact on lshr/ashr.Chris Lattner2011-02-07
| | | | | | | Factor some code better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125006 91177308-0d34-0410-b5e6-96231b3b80d8
* enhance vmcore to know that udiv's can be exact, and add a trivialChris Lattner2011-02-06
| | | | | | | | | | instcombine xform to exercise this. Nothing forms exact udivs yet though. This is progress on PR8862 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124992 91177308-0d34-0410-b5e6-96231b3b80d8
* Have m_One also match constant vectors for which every element is 1.Duncan Sands2011-02-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124655 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix indentation.Jay Foad2011-01-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124375 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove casts between Value** and Constant**, which won't work if aJay Foad2011-01-14
| | | | | | | static_cast from Constant* to Value* has to adjust the "this" pointer. This is groundwork for PR889. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123435 91177308-0d34-0410-b5e6-96231b3b80d8