summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFold.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert 80959. It isn't sufficient to solve the full problem. And itDan Gohman2009-09-031-1/+3
| | | | | | 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-3/+1
| | | | | | | | | | | | | | | 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
* Cleanup whitespace and indentation.Dan Gohman2009-08-291-29/+28
| | | | llvm-svn: 80451
* Push LLVMContexts through the IntegerType APIs.Owen Anderson2009-08-131-46/+46
| | | | llvm-svn: 78948
* Simplify this code, and use an in-bounds GEP.Dan Gohman2009-08-121-5/+7
| | | | llvm-svn: 78755
* Privatize the StructType table, which unfortunately involves routing ↵Owen Anderson2009-08-051-3/+3
| | | | | | contexts through a number of APIs. llvm-svn: 78258
* Move a few more APIs back to 2.5 forms. The only remaining ones left to ↵Owen Anderson2009-07-311-58/+58
| | | | | | | | change back are metadata related, which I'm waiting on to avoid conflicting with Devang. llvm-svn: 77721
* Move getTrue() and getFalse() to 2.5-like APIs.Owen Anderson2009-07-311-6/+6
| | | | llvm-svn: 77685
* Move more code back to 2.5 APIs.Owen Anderson2009-07-301-23/+23
| | | | llvm-svn: 77635
* Move types back to the 2.5 API.Owen Anderson2009-07-291-3/+3
| | | | llvm-svn: 77516
* Move ConstantExpr to 2.5 API.Owen Anderson2009-07-291-44/+44
| | | | llvm-svn: 77494
* Return ConstantVector to 2.5 API.Owen Anderson2009-07-281-26/+26
| | | | llvm-svn: 77366
* Change ConstantArray to 2.5 API.Owen Anderson2009-07-281-3/+3
| | | | llvm-svn: 77347
* Move ConstantStruct back to 2.5 API.Owen Anderson2009-07-271-3/+3
| | | | llvm-svn: 77266
* Move ConstantFP construction back to the 2.5-ish API.Owen Anderson2009-07-271-8/+8
| | | | llvm-svn: 77247
* Revert the ConstantInt constructors back to their 2.5 forms where possible, ↵Owen Anderson2009-07-241-45/+45
| | | | | | thanks to contexts-on-types. More to come. llvm-svn: 77011
* Rename getConstantInt{True|False} to get{True|False} at Chris' behest.Owen Anderson2009-07-211-6/+6
| | | | llvm-svn: 76598
* llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.Torok Edwin2009-07-141-5/+5
| | | | | | | | | 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
* Inline EvalVectorOp in order to get rid of passing-pointer-to-static-methods ↵Owen Anderson2009-07-131-38/+132
| | | | | | behavior. llvm-svn: 75538
* Begin the painful process of tearing apart the rat'ss nest that is ↵Owen Anderson2009-07-131-206/+239
| | | | | | | | | Constants.cpp and ConstantFold.cpp. This involves temporarily hard wiring some parts to use the global context. This isn't ideal, but it's the only way I could figure out to make this process vaguely incremental. llvm-svn: 75445
* assert(0) -> LLVM_UNREACHABLE.Torok Edwin2009-07-111-5/+6
| | | | | | | | | 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-68/+22
| | | | | | | these instructions, no autoupgrade or backwards compatibility support is provided. llvm-svn: 74991
* Expand this test to handle more cases (remainder and shifts) of zero.Nick Lewycky2009-06-211-8/+15
| | | | llvm-svn: 73839
* implement PR4424: 0/x is always 0 for integer division.Chris Lattner2009-06-211-0/+7
| | | | llvm-svn: 73835
* Revert r73790, and replace it with a significantly less ugly solution. ↵Owen Anderson2009-06-201-60/+51
| | | | | | | | | Rather than trying to make the global reader-writer lock work, create separate recursive mutexes for each value map. The recursive-ness fixes the double-acquiring issue, which having one per ValueMap lets us continue to maintain some concurrency. llvm-svn: 73801
* Fix a serious bug that would cause deadlock during abstract type refinement. ↵Owen Anderson2009-06-191-51/+60
| | | | | | | | | | The constant creation gets involved, and we end up trying to recursively acquire a writer lock. The fix for this is slightly horrible, and involves passing a boolean "locked" parameter around in Constants.cpp, but it's better than having locked and unlocked versions of most of the code. llvm-svn: 73790
* Support vector casts in more places, fixing a variety of assertionDan Gohman2009-06-151-16/+16
| | | | | | | | | | | | | | | 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
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-041-8/+15
| | | | | | | | | | | | | | | integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt llvm-svn: 72897
* Apply a patch by Micah Villmow to fix AsmParser to accept vectorDan Gohman2009-03-141-0/+6
| | | | | | | shift constant expressions, and add support for folding vector shift constant expressions. This fixes PR3802. llvm-svn: 67010
* Extension of GEP in constant folder was broken (apparently this codeDaniel Dunbar2009-02-241-1/+1
| | | | | | | has never been run!). - Sorry, don't know how to make an LLVM test case for this. llvm-svn: 65383
* Allow the inverse transform x86_fp80 -> i80 (alsoDuncan Sands2009-02-041-9/+4
| | | | | | fires during the Ada build). llvm-svn: 63731
* Fix PR3468: a crash when constant folding a bitcast ofDuncan Sands2009-02-041-6/+5
| | | | | | | i80 to x86 long double (this was presumably generated by sroa). llvm-svn: 63730
* Make special cases (0 inf nan) work for frem.Dale Johannesen2009-01-211-10/+0
| | | | | | | | Besides APFloat, this involved removing code from two places that thought they knew the result of frem(0., x) but were wrong. llvm-svn: 62645
* div/rem by zero and div/rem overflow are both undefined according toChris Lattner2009-01-191-11/+11
| | | | | | | langref. Constant fold them to undef instead of trying to preserve the trap. This fixes PR3354. llvm-svn: 62534
* Added support for the following definition of shufflevector Mon P Wang2008-11-101-9/+10
| | | | | | <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask> llvm-svn: 58964
* Fix unused variable warnings.Devang Patel2008-11-031-0/+1
| | | | llvm-svn: 58653
* apply Eli's patch for PR2165 and provide a testcase.Chris Lattner2008-10-161-0/+6
| | | | llvm-svn: 57625
* Add a "loses information" return value to APFloat::convertDale Johannesen2008-10-091-2/+4
| | | | | | | and APFloat::convertToInteger. Restore return value to IEEE754. Adjust all users accordingly. llvm-svn: 57329
* Rename APFloat::convertToAPInt to bitcastToAPInt toDale Johannesen2008-10-091-2/+2
| | | | | | | make it clearer what the function does. No functional change. llvm-svn: 57325
* Try to fold each element of a vector. This is needed to maintain structuralNick Lewycky2008-09-031-12/+4
| | | | | | equivalence. llvm-svn: 55694
* Don't crash when trying to constant fold a vector with some elements that can'tNick Lewycky2008-09-031-6/+12
| | | | | | | | | be folded. Instead, fail to fold the entire vector. We could also return a vector with some elements folded and some not. If anyone thinks that's a better approach, please speak up! llvm-svn: 55689
* Fix a case where vector comparison constant folding would cause anChris Lattner2008-07-101-33/+33
| | | | | | infinite recursion. part of PR2529 llvm-svn: 53383
* elementwise comparison of vector constants was completely wrong. FixChris Lattner2008-07-101-19/+32
| | | | | | it for PR2529 llvm-svn: 53380
* improve commentChris Lattner2008-07-081-1/+1
| | | | llvm-svn: 53243
* Fix three bugs:Chris Lattner2008-07-081-56/+101
| | | | | | | | | | | 1) evaluate [v]fcmp true/false with undefs to true or false instead of undef. 2) fix vector comparisons with undef to return a vector result instead of i1 3) fix vector comparisons with evaluatable results to return vector true/false instead of i1 true/false (PR2529) llvm-svn: 53220
* Constant folding for insertvalue and extractvalue.Dan Gohman2008-06-031-10/+105
| | | | llvm-svn: 51889
* Revert constant-folding change that will miscompile in some cases.Nick Lewycky2008-05-171-23/+0
| | | | llvm-svn: 51223
* Unbreak the build.Nick Lewycky2008-05-171-1/+1
| | | | llvm-svn: 51217
* Constant fold inttoptr and ptrtoint.Nick Lewycky2008-05-171-0/+23
| | | | llvm-svn: 51216
* IR support for extractvalue and insertvalue instructions. Also, beginDan Gohman2008-05-151-4/+17
| | | | | | moving toward making structs and arrays first-class types. llvm-svn: 51157
OpenPOWER on IntegriCloud