summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFolding.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use ANSI-approved way of getting the value infinity (otherwise VC++ won't ↵Jeff Cohen2005-05-031-3/+4
| | | | | | compile it) llvm-svn: 21662
* fold fp div by 0 to inf, the way gcc does. This is legal according to the ↵Andrew Lenharth2005-05-021-0/+7
| | | | | | FP spec llvm-svn: 21655
* Shut GCC 4.0 up about classes with virtual functions but no virtualReid Spencer2005-04-241-0/+5
| | | | | | destructor. llvm-svn: 21510
* Remove trailing whitespaceMisha Brukman2005-04-211-40/+40
| | | | llvm-svn: 21427
* Fix a nasty thinko in my previous commit.Chris Lattner2005-01-281-1/+1
| | | | llvm-svn: 19881
* Fix ConstProp/2005-01-28-SetCCGEP.ll: indexing over zero sized elements doesChris Lattner2005-01-281-5/+36
| | | | | | not change the address. llvm-svn: 19874
* No need to pessimize current code for future possibilities.Chris Lattner2005-01-061-4/+3
| | | | llvm-svn: 19311
* Fix test/Regression/CFrontend/2003-11-01-EmptyStructCrash.cChris Lattner2004-11-221-0/+1
| | | | llvm-svn: 18115
* Generalize this code to turn any cast-to-first-element-of into a gep constexprChris Lattner2004-11-171-8/+21
| | | | llvm-svn: 17914
* fold gep undef, ... -> undefChris Lattner2004-10-171-1/+8
| | | | | | This comes up many times in perlbmk and probably others. llvm-svn: 17100
* Fix constant folding relational operators with undef operands.Chris Lattner2004-10-171-7/+4
| | | | llvm-svn: 17077
* Implement constant folding of undef values.Chris Lattner2004-10-161-4/+54
| | | | llvm-svn: 17070
* Allow creation of GEP constantexprs with a vector of value* operands asChris Lattner2004-10-111-15/+16
| | | | | | | well as a vector of constant*'s. It turns out that this is more efficient and all of the clients want to do that, so we should cater to them. llvm-svn: 16923
* If we are trying to create a ConstantExpr cast that is really a GEP to theChris Lattner2004-10-111-0/+11
| | | | | | | | | | | | | first element of an array, return a GEP instead of a cast. This allows us to transparently fold this: int* getelementptr (int* cast ([100 x int]* %Gbody to int*), int 40) into this: int* getelementptr ([100 x int]* %Gbody, int 0, int 40) llvm-svn: 16911
* bug 122:Reid Spencer2004-07-171-23/+20
| | | | | | | | - Replace ConstantPointerRef usage with GlobalValue usage - Minimize redundant isa<GlobalValue> usage - Correct isa<Constant> for GlobalValue subclass llvm-svn: 14927
* Implement folding of expressions like 'uint cast (int* getelementptr (int*Chris Lattner2004-07-151-0/+12
| | | | | | | null, uint 1) to uint)' to a constant integer. We can only do this with primitive LLVM types, because other types have target-specific sizes. llvm-svn: 14837
* When folding constant expr gep's, don't force the use of long indices.Chris Lattner2004-07-071-3/+6
| | | | llvm-svn: 14658
* Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()Chris Lattner2004-06-171-2/+2
| | | | llvm-svn: 14201
* Fix a bug that Chris asserts emphatically is a bug. The changed clauseReid Spencer2004-05-301-1/+1
| | | | | | | would always return false because the Type of a type value is always Type::TypeTY and can never be a floating point type. llvm-svn: 13902
* Add a missing break, which caused a crash in an obscure situationChris Lattner2004-04-111-0/+1
| | | | llvm-svn: 12825
* Support getelementptr instructions which use uint's to index into structureChris Lattner2004-04-051-4/+4
| | | | | | | types and can have arbitrary 32- and 64-bit integer types indexing into sequential types. llvm-svn: 12653
* Teach the constant folder how to do select instructionsChris Lattner2004-03-121-0/+11
| | | | llvm-svn: 12321
* Implement test/Regression/Assembler/2004-03-07-FunctionAddressAlignment.llxChris Lattner2004-03-081-0/+20
| | | | llvm-svn: 12218
* Get all instruction definitionsChris Lattner2004-02-221-3/+1
| | | | llvm-svn: 11706
* Move the folding of gep null, 0, 0, 0 to a place where it can be shared andChris Lattner2004-02-161-2/+15
| | | | | | enjoyed by all, fixing a fixme. Add an assert llvm-svn: 11505
* Fix a crasher bug in my constant folding rewriteChris Lattner2004-02-011-3/+10
| | | | llvm-svn: 11044
* Implement a bunch of symbolic constant folding opportunities. This implementsChris Lattner2004-01-131-21/+324
| | | | | | | | | | | | | | | testcase test/Regression/Assembler/ConstantExprFold.llx Note that these kinds of things only rarely show up in source code, but are exceedingly common in the intermediate stages of algorithms like SCCP. By folding things (especially relational operators) that use symbolic constants, we are able to speculatively fold more conditional branches, which can lead to some big simplifications. It would be easy to add a lot more special cases here, so if you notice SCCP missing anything "obvious", you know what to make smarter. :) llvm-svn: 10812
* Rearrange and comment code better. No functionality changesChris Lattner2004-01-121-160/+177
| | | | llvm-svn: 10808
* Rename ConstantHandling.* -> ConstantFolding.*Chris Lattner2004-01-121-0/+656
Move a bunch of (now) private stuff from ConstantFolding.h into ConstantFolding.cpp. This _finally_ gets us to a place where we have a sane constant folder. The rules are: 1. LLVM clients now use ConstantExpr::get* methods to fold constants. If they cannot be folded, a constantexpr is created, so these methods always return valid Constant*'s. 2. The implementation of ConstantExpr::get* uses the functions exposed by ConstantFolding.h to try to fold constants. If they cannot be folded, they should return a null pointer. 3. The implementation of ConstantFolding can do whatever it wants, and only has one client (Constants.cpp) This cuts down on the wierd dependencies, and eliminates the two interfaces. The old constanthandling interface was especially bad for clients to use because almost none of them took the failure condition into consideration, thus leading to obscure problems. llvm-svn: 10807
OpenPOWER on IntegriCloud