summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFold.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Remove no-longer-used variable.Dale Johannesen2007-09-251-3/+2
| | | | llvm-svn: 42329
* Make APFloat->int conversions deterministic even inDale Johannesen2007-09-251-2/+0
| | | | | | cases with undefined behavior. llvm-svn: 42328
* float->int conversion rounds toward 0. Duh.Dale Johannesen2007-09-241-1/+1
| | | | | | Fixes PR1698. llvm-svn: 42273
* Just use APFloat for const / const. FixesDale Johannesen2007-09-241-17/+0
| | | | | | -1. / -0. llvm-svn: 42254
* Fix dumb regression in constant folding (Regression/C/casts)Dale Johannesen2007-09-201-1/+1
| | | | llvm-svn: 42165
* Fix some long double issues.Dale Johannesen2007-09-191-19/+21
| | | | llvm-svn: 42133
* 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. llvm-svn: 42131
* Revise previous patch per review comments.Dale Johannesen2007-09-121-7/+6
| | | | | | | Next round of x87 long double stuff. Getting close now, basically works. llvm-svn: 41875
* Add APInt interfaces to APFloat (allows directlyDale Johannesen2007-09-111-13/+8
| | | | | | | | | access to bits). Use them in place of float and double interfaces where appropriate. First bits of x86 long double constants handling (untested, probably does not work). llvm-svn: 41858
* Fix a buggy constant folding transformation when handling aliases.Chris Lattner2007-09-101-4/+7
| | | | llvm-svn: 41818
* Next round of APFloat changes.Dale Johannesen2007-09-061-66/+97
| | | | | | | | | | | | | | Use APFloat in UpgradeParser and AsmParser. Change all references to ConstantFP to use the APFloat interface rather than double. Remove the ConstantFP double interfaces. Use APFloat functions for constant folding arithmetic and comparisons. (There are still way too many places APFloat is just a wrapper around host float/double, but we're getting there.) llvm-svn: 41747
* Update GEP constructors to use an iterator interface to fixDavid Greene2007-09-041-3/+5
| | | | | | GLIBCXX_DEBUG issues. llvm-svn: 41697
* Constant fold: getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1)Chris Lattner2007-08-131-1/+23
| | | | | | | | | | | | | | | | | | | | Into: inttoptr (i64 0 to i8*) -> null This occurs in the example in PR1602. With this fixed, we now compile the example in PR1602 into fully "devirtualized" code: define void @_Z1g1S(%struct.S* noalias %s) { entry: %tmp131415 = getelementptr %struct.S* %s, i32 0, i32 0 ; <i32 (...)***> [#uses=1] %tmp16 = load i32 (...)*** %tmp131415, align 4 ; <i32 (...)**> [#uses=1] %tmp26277 = load i32 (...)** %tmp16 ; <i32 (...)*> [#uses=1] %tmp2829 = bitcast i32 (...)* %tmp26277 to void (%struct.S*)* ; <void (%struct.S*)*> [#uses=1] tail call void %tmp2829( %struct.S* %s ) ret void } This still has the vtable dispatch (as required) but does not have any pointer to method cruft left. llvm-svn: 41046
* Fix a doxygen directive.Reid Spencer2007-08-051-1/+1
| | | | llvm-svn: 40849
* zext(undef) = 0 and sext(undef) = 0, not undef.Chris Lattner2007-07-201-1/+6
| | | | | | This hopefully fixes a miscompilation of TargetData.cpp when self hosting. llvm-svn: 40125
* Fix comments about vectors to use the current wording.Dan Gohman2007-07-161-7/+7
| | | | llvm-svn: 39921
* Add a comment to explain a folding transform.Reid Spencer2007-03-261-0/+1
| | | | llvm-svn: 35360
* fold constantexprs more aggressively, fixing PR1265Chris Lattner2007-03-251-2/+17
| | | | llvm-svn: 35336
* Fix constant fold of div by zero and rem by zero to match IEEE 754Reid Spencer2007-03-231-8/+18
| | | | | | | requirements. We must return NaN in some cases and correctly signed infinity in other cases. Passes CFP2006 (not that that says much). llvm-svn: 35277
* Fix constant folding of fp->int bitcast for vectors.Reid Spencer2007-03-031-2/+2
| | | | llvm-svn: 34880
* Prefer non-virtual calls to ConstantInt::isZero over virtual calls toReid Spencer2007-03-021-6/+6
| | | | | | Constant::isNullValue() in situations where it is possible. llvm-svn: 34821
* Use the APInt versions of the bit-wise conversions of float/double to intReid Spencer2007-03-011-8/+10
| | | | | | | | and back. While this is not strictly necessary, it does pave the way for future changes in casting. It should now be possible to improve vector casting to deal with un-equal fp/int sizes. llvm-svn: 34808
* Use a simpler constructor when constructing ConstantInst.Reid Spencer2007-03-011-20/+19
| | | | llvm-svn: 34793
* Pull out the stops.Reid Spencer2007-02-271-4/+2
| | | | llvm-svn: 34703
OpenPOWER on IntegriCloud