summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFold.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* merge of use-diet branch to trunkGabor Greif2008-05-101-8/+8
| | | | llvm-svn: 50943
* hopefully resolve PR2240Chris Lattner2008-04-201-1/+1
| | | | llvm-svn: 49999
* rearrange some code, simplify handling of shifts.Chris Lattner2008-04-201-60/+56
| | | | llvm-svn: 49995
* Use simplified ConstantFP::get method, fix a bug handling frem x, 0 with ↵Chris Lattner2008-04-201-13/+17
| | | | | | long doubles. llvm-svn: 49976
* Implement PR2206.Chris Lattner2008-04-191-8/+17
| | | | llvm-svn: 49967
* refactor handling of symbolic constant folding, picking upChris Lattner2008-04-191-62/+62
| | | | | | | a few new cases( see Integer/a1.ll), but not anything that would happen in practice. llvm-svn: 49965
* indentation fix.Chris Lattner2008-04-191-14/+14
| | | | llvm-svn: 49964
* Don't eliminate bitcast instructions that change the type of a pointerNate Begeman2008-03-311-19/+21
| | | | llvm-svn: 48971
* Handle a special case xor undef, undef -> 0. Technically this should be ↵Evan Cheng2008-03-251-1/+6
| | | | | | transformed to undef. But this is such a common idiom (misuse) we are going to handle it. llvm-svn: 48792
* Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.Dan Gohman2008-02-291-6/+3
| | | | llvm-svn: 47744
* Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov2008-02-201-7/+14
| | | | | | annoying warnings. llvm-svn: 47367
* Fix some minor issues folding undef, PR2052Chris Lattner2008-02-191-1/+3
| | | | llvm-svn: 47314
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Change the PointerType api for creating pointer types. The old functionality ↵Christopher Lamb2007-12-171-4/+7
| | | | | | of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space. llvm-svn: 45082
* Teach VMCore to constant fold shufflevectors with constant operands.Chris Lattner2007-12-111-2/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to compile: #include <emmintrin.h> typedef __m128i VSInt16; typedef short vSInt16 __attribute__ ((__vector_size__ (16))); VSInt16 t3() { return (VSInt16)((vSInt16)_mm_set1_epi16(6518)); } into: _t3: movaps LCPI1_0, %xmm0 ret instead of: _t3: movl $6518, %eax movd %eax, %xmm0 pextrw $0, %xmm0, %eax xorps %xmm0, %xmm0 pinsrw $0, %eax, %xmm0 punpcklwd %xmm0, %xmm0 pshufd $0, %xmm0, %xmm0 ret llvm-svn: 44856
* significantly simplify some code, no functionality change.Chris Lattner2007-12-111-88/+23
| | | | llvm-svn: 44850
* refactor some code, no functionality change.Chris Lattner2007-12-111-94/+96
| | | | llvm-svn: 44849
* Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.Chris Lattner2007-12-101-11/+10
| | | | | | | | Reimplement the xform in Analysis/ConstantFolding.cpp where we can use targetdata to validate that it is safe. While I'm in there, fix some const correctness issues and generalize the interface to the "operand folder". llvm-svn: 44817
* Add support for vectors to int <-> float casts.Nate Begeman2007-11-171-0/+18
| | | | llvm-svn: 44204
* Fix a regression in test/CodeGen/X86/2007-04-24-VectorCrash.ll introducedDan Gohman2007-10-311-4/+3
| | | | | | | by r43510. Gracefully handle constants with vector type that aren't ConstantVector or ConstantAggregateZero. llvm-svn: 43579
* Add support for folding binary operators with vector zero operands.Dan Gohman2007-10-301-19/+29
| | | | llvm-svn: 43510
* Disable attempts to constant fold PPC f128.Dale Johannesen2007-10-161-0/+4
| | | | | | | Remove the assumption that this will happen from various places. llvm-svn: 43053
* avoid an APFloat copy.Chris Lattner2007-10-151-1/+1
| | | | llvm-svn: 42979
* Disable some compile-time optimizations on PPCDale Johannesen2007-10-141-0/+12
| | | | | | long double. llvm-svn: 42958
* convertFromInteger, as originally written, expected sign-extendedNeil Booth2007-10-071-1/+1
| | | | | | | | input. APInt unfortunately zero-extends signed integers, so Dale modified the function to expect zero-extended input. Make this assumption explicit in the function name. llvm-svn: 42732
* Constant fold int-to-long-double conversions;Dale Johannesen2007-09-301-17/+9
| | | | | | | | use APFloat for int-to-float/double; use round-to-nearest for these (implementation-defined, seems to match gcc). llvm-svn: 42484
OpenPOWER on IntegriCloud