Chris Lattner
6072ead8e2
indentation fix.
...
llvm-svn: 49964
2008-04-19 21:13:00 +00:00
Nate Begeman
f2b0b0eb17
Don't eliminate bitcast instructions that change the type of a pointer
...
llvm-svn: 48971
2008-03-31 00:22:16 +00:00
Evan Cheng
df1690dc7c
Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
...
llvm-svn: 48792
2008-03-25 20:08:07 +00:00
Dan Gohman
06c45d516d
Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.
...
llvm-svn: 47744
2008-02-29 01:42:52 +00:00
Anton Korobeynikov
579f07135a
Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
...
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Chris Lattner
b4c6cc9587
Fix some minor issues folding undef, PR2052
...
llvm-svn: 47314
2008-02-19 06:22:12 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Christopher Lamb
edf0788758
Change the PointerType api for creating pointer types. The old functionality 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
2007-12-17 01:12:55 +00:00
Chris Lattner
8e6a8f984c
Teach VMCore to constant fold shufflevectors with constant operands.
...
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
2007-12-11 07:49:37 +00:00
Chris Lattner
5c6399eee6
significantly simplify some code, no functionality change.
...
llvm-svn: 44850
2007-12-11 06:07:39 +00:00
Chris Lattner
e8ea0374ac
refactor some code, no functionality change.
...
llvm-svn: 44849
2007-12-11 05:55:02 +00:00
Chris Lattner
d2265b45ae
Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
...
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
2007-12-10 22:53:04 +00:00
Nate Begeman
d4d45c268c
Add support for vectors to int <-> float casts.
...
llvm-svn: 44204
2007-11-17 03:58:34 +00:00
Dan Gohman
b43e020cdb
Fix a regression in test/CodeGen/X86/2007-04-24-VectorCrash.ll introduced
...
by r43510. Gracefully handle constants with vector type that aren't
ConstantVector or ConstantAggregateZero.
llvm-svn: 43579
2007-10-31 21:36:31 +00:00
Dan Gohman
9f39660c20
Add support for folding binary operators with vector zero operands.
...
llvm-svn: 43510
2007-10-30 19:00:49 +00:00
Dale Johannesen
e5facd51cb
Disable attempts to constant fold PPC f128.
...
Remove the assumption that this will happen from
various places.
llvm-svn: 43053
2007-10-16 23:38:29 +00:00
Chris Lattner
2b827fd70d
avoid an APFloat copy.
...
llvm-svn: 42979
2007-10-15 05:34:10 +00:00
Dale Johannesen
19db093b35
Disable some compile-time optimizations on PPC
...
long double.
llvm-svn: 42958
2007-10-14 01:56:47 +00:00
Neil Booth
5f00973393
convertFromInteger, as originally written, expected sign-extended
...
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
2007-10-07 11:45:55 +00:00
Dale Johannesen
9150652b21
Constant fold int-to-long-double conversions;
...
use APFloat for int-to-float/double; use
round-to-nearest for these (implementation-defined,
seems to match gcc).
llvm-svn: 42484
2007-09-30 18:19:03 +00:00
Dale Johannesen
17663f40b9
Remove no-longer-used variable.
...
llvm-svn: 42329
2007-09-25 23:32:20 +00:00
Dale Johannesen
e7439eff5a
Make APFloat->int conversions deterministic even in
...
cases with undefined behavior.
llvm-svn: 42328
2007-09-25 23:07:07 +00:00
Dale Johannesen
5026f4ba93
float->int conversion rounds toward 0. Duh.
...
Fixes PR1698.
llvm-svn: 42273
2007-09-24 21:06:09 +00:00
Dale Johannesen
acbb26f125
Just use APFloat for const / const. Fixes
...
-1. / -0.
llvm-svn: 42254
2007-09-24 00:32:45 +00:00
Dale Johannesen
cc7c475705
Fix dumb regression in constant folding (Regression/C/casts)
...
llvm-svn: 42165
2007-09-20 16:50:21 +00:00
Dale Johannesen
f4bad97ea0
Fix some long double issues.
...
llvm-svn: 42133
2007-09-19 14:22:58 +00:00
Duncan Sands
a38e527523
Partial fix for PR1678: correct some parts of constant
...
fold that were missed in the fix for PR1646. Probably
this null/not-null logic should be factorized somewhere.
llvm-svn: 42131
2007-09-19 10:16:17 +00:00
Dale Johannesen
028084efe5
Revise previous patch per review comments.
...
Next round of x87 long double stuff.
Getting close now, basically works.
llvm-svn: 41875
2007-09-12 03:30:33 +00:00
Dale Johannesen
245dceb06d
Add APInt interfaces to APFloat (allows directly
...
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
2007-09-11 18:32:33 +00:00
Chris Lattner
52fe869374
Fix a buggy constant folding transformation when handling aliases.
...
llvm-svn: 41818
2007-09-10 23:42:42 +00:00
Dale Johannesen
bed9dc423c
Next round of APFloat changes.
...
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
2007-09-06 18:13:44 +00:00
David Greene
c656cbb8c2
Update GEP constructors to use an iterator interface to fix
...
GLIBCXX_DEBUG issues.
llvm-svn: 41697
2007-09-04 15:46:09 +00:00
Chris Lattner
aadc778782
Constant fold: getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1)
...
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
2007-08-13 17:09:08 +00:00
Reid Spencer
05d55b396c
Fix a doxygen directive.
...
llvm-svn: 40849
2007-08-05 19:27:01 +00:00
Chris Lattner
363485da82
zext(undef) = 0 and sext(undef) = 0, not undef.
...
This hopefully fixes a miscompilation of TargetData.cpp when self hosting.
llvm-svn: 40125
2007-07-20 22:09:02 +00:00
Dan Gohman
06c60b6032
Fix comments about vectors to use the current wording.
...
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Reid Spencer
e20090b88d
Add a comment to explain a folding transform.
...
llvm-svn: 35360
2007-03-26 20:09:02 +00:00
Chris Lattner
6d94bb79ac
fold constantexprs more aggressively, fixing PR1265
...
llvm-svn: 35336
2007-03-25 05:47:04 +00:00
Reid Spencer
d96dc9020a
Fix constant fold of div by zero and rem by zero to match IEEE 754
...
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
2007-03-23 05:33:23 +00:00
Reid Spencer
50d7ad9183
Fix constant folding of fp->int bitcast for vectors.
...
llvm-svn: 34880
2007-03-03 08:32:46 +00:00
Reid Spencer
2e54a15943
Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
...
Constant::isNullValue() in situations where it is possible.
llvm-svn: 34821
2007-03-02 00:28:52 +00:00
Reid Spencer
4326cf5c51
Use the APInt versions of the bit-wise conversions of float/double to int
...
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
2007-03-01 20:44:23 +00:00
Reid Spencer
a127633716
Use a simpler constructor when constructing ConstantInst.
...
llvm-svn: 34793
2007-03-01 19:31:12 +00:00
Reid Spencer
4aeaeaf894
Pull out the stops.
...
llvm-svn: 34703
2007-02-27 23:33:03 +00:00
Reid Spencer
e2eb1fab8c
Adjust to changes in the APInt interface.
...
llvm-svn: 34681
2007-02-27 20:25:25 +00:00
Reid Spencer
ac419b52ad
For PR1205:
...
Implement review feedback:
1. Use new APInt::RoundDoubleToAPInt interface to specify the bit width so
that we don't have to truncate or extend in constant folding.
2. Fix a pasteo in SDiv that prevented a check for overflow.
3. Fix the shift operators: undef happens when the shift amount is equal
to the bitwidth.
llvm-svn: 34677
2007-02-27 19:29:54 +00:00
Reid Spencer
81658a8aca
For PR1205:
...
Implement constant folding via APInt instead of uint64_t.
llvm-svn: 34660
2007-02-27 06:23:51 +00:00
Chris Lattner
33e93b84af
ConstantFolding.cpp/h -> ConstantFold.cpp/h to avoid confusion with
...
lib/Analysis/ConstantFolding.
llvm-svn: 34653
2007-02-27 03:05:06 +00:00