aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantFold.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58964 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix unused variable warnings.Devang Patel2008-11-031-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58653 91177308-0d34-0410-b5e6-96231b3b80d8
* apply Eli's patch for PR2165 and provide a testcase.Chris Lattner2008-10-161-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57625 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57329 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename APFloat::convertToAPInt to bitcastToAPInt toDale Johannesen2008-10-091-2/+2
| | | | | | | | | make it clearer what the function does. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57325 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to fold each element of a vector. This is needed to maintain structuralNick Lewycky2008-09-031-12/+4
| | | | | | | equivalence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55694 91177308-0d34-0410-b5e6-96231b3b80d8
* 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55689 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a case where vector comparison constant folding would cause anChris Lattner2008-07-101-33/+33
| | | | | | | infinite recursion. part of PR2529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53383 91177308-0d34-0410-b5e6-96231b3b80d8
* elementwise comparison of vector constants was completely wrong. FixChris Lattner2008-07-101-19/+32
| | | | | | | it for PR2529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53380 91177308-0d34-0410-b5e6-96231b3b80d8
* improve commentChris Lattner2008-07-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53243 91177308-0d34-0410-b5e6-96231b3b80d8
* 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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53220 91177308-0d34-0410-b5e6-96231b3b80d8
* Constant folding for insertvalue and extractvalue.Dan Gohman2008-06-031-10/+105
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51889 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert constant-folding change that will miscompile in some cases.Nick Lewycky2008-05-171-23/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51223 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak the build.Nick Lewycky2008-05-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51217 91177308-0d34-0410-b5e6-96231b3b80d8
* Constant fold inttoptr and ptrtoint.Nick Lewycky2008-05-171-0/+23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51216 91177308-0d34-0410-b5e6-96231b3b80d8
* IR support for extractvalue and insertvalue instructions. Also, beginDan Gohman2008-05-151-4/+17
| | | | | | | moving toward making structs and arrays first-class types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51157 91177308-0d34-0410-b5e6-96231b3b80d8
* merge of use-diet branch to trunkGabor Greif2008-05-101-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50943 91177308-0d34-0410-b5e6-96231b3b80d8
* hopefully resolve PR2240Chris Lattner2008-04-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49999 91177308-0d34-0410-b5e6-96231b3b80d8
* rearrange some code, simplify handling of shifts.Chris Lattner2008-04-201-60/+56
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49995 91177308-0d34-0410-b5e6-96231b3b80d8
* Use simplified ConstantFP::get method, fix a bug handling frem x, 0 with ↵Chris Lattner2008-04-201-13/+17
| | | | | | long doubles. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49976 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement PR2206.Chris Lattner2008-04-191-8/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49967 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49965 91177308-0d34-0410-b5e6-96231b3b80d8
* indentation fix.Chris Lattner2008-04-191-14/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49964 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't eliminate bitcast instructions that change the type of a pointerNate Begeman2008-03-311-19/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48971 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48792 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.Dan Gohman2008-02-291-6/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47744 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov2008-02-201-7/+14
| | | | | | annoying warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some minor issues folding undef, PR2052Chris Lattner2008-02-191-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47314 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44856 91177308-0d34-0410-b5e6-96231b3b80d8
* significantly simplify some code, no functionality change.Chris Lattner2007-12-111-88/+23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44850 91177308-0d34-0410-b5e6-96231b3b80d8
* refactor some code, no functionality change.Chris Lattner2007-12-111-94/+96
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44849 91177308-0d34-0410-b5e6-96231b3b80d8
* 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". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44817 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for vectors to int <-> float casts.Nate Begeman2007-11-171-0/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44204 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43579 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for folding binary operators with vector zero operands.Dan Gohman2007-10-301-19/+29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43510 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable attempts to constant fold PPC f128.Dale Johannesen2007-10-161-0/+4
| | | | | | | | | Remove the assumption that this will happen from various places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43053 91177308-0d34-0410-b5e6-96231b3b80d8
* avoid an APFloat copy.Chris Lattner2007-10-151-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42979 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable some compile-time optimizations on PPCDale Johannesen2007-10-141-0/+12
| | | | | | | | long double. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42958 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42732 91177308-0d34-0410-b5e6-96231b3b80d8
* 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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42484 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove no-longer-used variable.Dale Johannesen2007-09-251-3/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42329 91177308-0d34-0410-b5e6-96231b3b80d8
* Make APFloat->int conversions deterministic even inDale Johannesen2007-09-251-2/+0
| | | | | | | cases with undefined behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42328 91177308-0d34-0410-b5e6-96231b3b80d8
* float->int conversion rounds toward 0. Duh.Dale Johannesen2007-09-241-1/+1
| | | | | | | | Fixes PR1698. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42273 91177308-0d34-0410-b5e6-96231b3b80d8
* Just use APFloat for const / const. FixesDale Johannesen2007-09-241-17/+0
| | | | | | | -1. / -0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42254 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix dumb regression in constant folding (Regression/C/casts)Dale Johannesen2007-09-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42165 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some long double issues.Dale Johannesen2007-09-191-19/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42133 91177308-0d34-0410-b5e6-96231b3b80d8
* Partial fix for PR1678: correct some parts of constantDuncan Sands2007-09-191-2/+4
| | | | | | | | fold that were missed in the fix for PR1646. Probably this null/not-null logic should be factorized somewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42131 91177308-0d34-0410-b5e6-96231b3b80d8
* Revise previous patch per review comments.Dale Johannesen2007-09-121-7/+6
| | | | | | | | | Next round of x87 long double stuff. Getting close now, basically works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41875 91177308-0d34-0410-b5e6-96231b3b80d8