Chris Lattner
a101affbdb
make this a static function instead of a method.
...
llvm-svn: 92795
2010-01-05 22:30:42 +00:00
Chris Lattner
53b9ed70ee
more rearrangement and cleanup, fix my test failure.
...
llvm-svn: 92792
2010-01-05 22:21:18 +00:00
Chris Lattner
45cd7ba394
cleanup
...
llvm-svn: 92790
2010-01-05 22:07:33 +00:00
Chris Lattner
2f69f6a822
remove two trunc xforms that are subsumed by EvaluateInDifferentType.
...
The only difference is that EvaluateInDifferentType checks to ensure
they are profitable before doing them :)
llvm-svn: 92788
2010-01-05 22:01:41 +00:00
Chris Lattner
13293b9738
just remove this xform which is subsumed by others.
...
llvm-svn: 92775
2010-01-05 21:16:30 +00:00
Chris Lattner
3aac94341a
move a trunc-specific transform out of commonIntCastTransforms into visitTrunc.
...
llvm-svn: 92773
2010-01-05 21:11:17 +00:00
Benjamin Kramer
0ba7479f2c
Move remaining stuff to the isInteger predicate.
...
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Chris Lattner
18ed3a6976
move a zext specific xform out of commonIntCastTransforms into visitZExt and modernize it.
...
llvm-svn: 92770
2010-01-05 21:04:47 +00:00
Chris Lattner
4c21bfec50
move a trunc-specific xform out of commonIntCastTransforms into visitTrunc
...
llvm-svn: 92768
2010-01-05 20:57:30 +00:00
Chris Lattner
e293a03aff
reduce indentation
...
llvm-svn: 92766
2010-01-05 20:56:24 +00:00
Benjamin Kramer
c233521d45
Convert a ton of simple integer type equality tests to the new predicate.
...
llvm-svn: 92760
2010-01-05 20:07:06 +00:00
Chris Lattner
f457542506
optimize comparisons against cttz/ctlz/ctpop, patch by Alastair Lynn!
...
llvm-svn: 92745
2010-01-05 18:09:56 +00:00
Dan Gohman
4b9a39d586
Nick Lewycky pointed out that this code makes changes unconditionally.
...
llvm-svn: 92739
2010-01-05 17:50:58 +00:00
Dan Gohman
fff95c0489
Set Changed properly after calling DeleteDeadPHIs.
...
llvm-svn: 92735
2010-01-05 16:31:45 +00:00
Dan Gohman
e4a22bdd4a
Use do+while instead of while for loops which obviously have a
...
non-zero trip count. Use SmallVector's pop_back_val().
llvm-svn: 92734
2010-01-05 16:27:25 +00:00
Dan Gohman
7924aacfe4
Fix indentation.
...
llvm-svn: 92733
2010-01-05 16:20:55 +00:00
Dan Gohman
41cc1e1fc4
Make RecursivelyDeleteTriviallyDeadInstructions,
...
RecursivelyDeleteDeadPHINode, and DeleteDeadPHIs return a flag
indicating whether they made any changes.
llvm-svn: 92732
2010-01-05 15:45:31 +00:00
Benjamin Kramer
cd6b749245
Add newline at EOF.
...
llvm-svn: 92727
2010-01-05 13:32:48 +00:00
Benjamin Kramer
e90a3c66c4
Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
...
llvm-svn: 92726
2010-01-05 13:12:22 +00:00
Chris Lattner
09b91ecf3c
prune some #includes.
...
llvm-svn: 92712
2010-01-05 07:54:43 +00:00
Chris Lattner
58ddbda58c
split and/or/xor out into one overly-large (2000LOC) file. However, I think
...
it does make sense to keep them together, at least for now.
llvm-svn: 92711
2010-01-05 07:50:36 +00:00
Chris Lattner
7201f09ff2
missed file with previous commit.
...
llvm-svn: 92710
2010-01-05 07:45:02 +00:00
Chris Lattner
dd39b601af
split instcombine of shifts out to its own file.
...
llvm-svn: 92709
2010-01-05 07:44:46 +00:00
Chris Lattner
e75f48f8bd
eliminate getBitCastOperand and simplify some over-complex inbounds stuff.
...
llvm-svn: 92708
2010-01-05 07:42:10 +00:00
Chris Lattner
e21194fe22
split call handling out to InstCombineCalls.cpp
...
llvm-svn: 92707
2010-01-05 07:32:13 +00:00
Chris Lattner
491e03b6ef
optimize cttz and ctlz when we can prove something about the
...
leading/trailing bits. Patch by Alastair Lynn!
llvm-svn: 92706
2010-01-05 07:23:56 +00:00
Chris Lattner
e36e3b586d
this inline function moved to addsub
...
llvm-svn: 92705
2010-01-05 07:20:54 +00:00
Chris Lattner
63747a10a8
split add/sub out to its own file. Eliminate use of
...
dyn_castNotVal in the X+~X transform. dyn_castNotVal is
dramatic overkill for what the xform needed.
llvm-svn: 92704
2010-01-05 07:18:46 +00:00
Chris Lattner
5ea00f56bd
all the places we use hasOneUse() we know are instructions, so inline
...
and simplify.
llvm-svn: 92700
2010-01-05 07:04:23 +00:00
Chris Lattner
081decf118
eliminate AssociativeOpt and its last uses.
...
llvm-svn: 92697
2010-01-05 07:01:16 +00:00
Chris Lattner
4d773ac576
inline the FoldICmpLogical functor.
...
llvm-svn: 92695
2010-01-05 06:59:49 +00:00
Chris Lattner
1e57d0e7e3
inline the 'AddRHS' transformation, simplifying things significantly.
...
Eliminate the 'AddMaskingAnd' transformation, it is redundant with this
more general code right below it:
// A+B --> A|B iff A and B have no bits set in common.
llvm-svn: 92693
2010-01-05 06:29:13 +00:00
Chris Lattner
17a2db8444
remove massive over-genality manifested as a big template
...
that got instantiated. There is no reason for instcombine
to try this hard for simple associative optimizations. Next
up, eliminate the template completely.
llvm-svn: 92692
2010-01-05 06:24:06 +00:00
Chris Lattner
92f9d59ad1
split mul/div/rem instructions out to their own file.
...
llvm-svn: 92689
2010-01-05 06:09:35 +00:00
Chris Lattner
8822b80a65
clean up header.
...
llvm-svn: 92688
2010-01-05 06:05:07 +00:00
Chris Lattner
e4910dc145
split select out to its own file.
...
llvm-svn: 92687
2010-01-05 06:03:12 +00:00
Chris Lattner
b55724e825
split out load/store/alloca.
...
llvm-svn: 92685
2010-01-05 05:57:49 +00:00
Chris Lattner
916d97c2d5
reduce indentation
...
llvm-svn: 92684
2010-01-05 05:42:08 +00:00
Chris Lattner
e22030e730
split vector stuff out to InstCombineVectorOps.cpp
...
llvm-svn: 92683
2010-01-05 05:36:20 +00:00
Chris Lattner
23ff3ce8eb
split PHI node stuff out to InstCombinePHI.cpp
...
llvm-svn: 92682
2010-01-05 05:31:55 +00:00
Chris Lattner
48618eeec3
convert various IntrinsicInst's to use class instead of struct.
...
llvm-svn: 92681
2010-01-05 05:21:26 +00:00
Chris Lattner
2ef4ba7cf5
fix an infinite loop in reassociate building emacs.
...
llvm-svn: 92679
2010-01-05 04:55:35 +00:00
David Greene
6b20914d8a
Change errs() to dbgs().
...
llvm-svn: 92639
2010-01-05 01:28:37 +00:00
David Greene
a48859b420
Change errs() to dbgs().
...
llvm-svn: 92636
2010-01-05 01:28:29 +00:00
David Greene
6c314b2f2b
Change errs() to dbgs().
...
llvm-svn: 92633
2010-01-05 01:28:12 +00:00
David Greene
706266dce6
Change errs() to dbgs().
...
llvm-svn: 92631
2010-01-05 01:28:07 +00:00
David Greene
04f5c49e6f
Change errs() to dbgs().
...
llvm-svn: 92629
2010-01-05 01:28:05 +00:00
David Greene
e5c3a6f658
Change errs() to dbgs().
...
llvm-svn: 92627
2010-01-05 01:27:54 +00:00
David Greene
0d082a1e9d
Change errs() to dbgs().
...
llvm-svn: 92625
2010-01-05 01:27:51 +00:00
David Greene
ccb57dd5d2
Change errs() to dbgs().
...
llvm-svn: 92624
2010-01-05 01:27:47 +00:00
David Greene
ab5e347e1d
Change errs() to dbgs().
...
llvm-svn: 92623
2010-01-05 01:27:44 +00:00
David Greene
9bb1c8a001
Change errs() to dbgs().
...
llvm-svn: 92622
2010-01-05 01:27:39 +00:00
David Greene
633e3e29d8
Change errs() to dbgs().
...
llvm-svn: 92620
2010-01-05 01:27:33 +00:00
David Greene
342f06bea0
Change errs() to dbgs().
...
llvm-svn: 92619
2010-01-05 01:27:30 +00:00
David Greene
6c61de5712
Change errs() to dbgs().
...
llvm-svn: 92617
2010-01-05 01:27:24 +00:00
David Greene
bb6730f5ac
Change errs() to dbgs().
...
llvm-svn: 92615
2010-01-05 01:27:21 +00:00
David Greene
0a35321dc2
Change errs() to dbgs().
...
llvm-svn: 92614
2010-01-05 01:27:19 +00:00
David Greene
9befdbf1a8
Change errs() to dbgs().
...
llvm-svn: 92613
2010-01-05 01:27:17 +00:00
David Greene
02e79531be
Change errs() to dbgs().
...
llvm-svn: 92612
2010-01-05 01:27:15 +00:00
David Greene
937fdd9ec0
Change errs() to dbgs().
...
llvm-svn: 92611
2010-01-05 01:27:11 +00:00
David Greene
578f63538f
Change errs() to dbgs().
...
llvm-svn: 92610
2010-01-05 01:27:09 +00:00
David Greene
d5a25b5d1f
Change errs() to dbgs().
...
llvm-svn: 92609
2010-01-05 01:27:06 +00:00
David Greene
15100f4246
Change errs() to dbgs().
...
llvm-svn: 92608
2010-01-05 01:27:04 +00:00
David Greene
a013a3b5e4
Change errs() to dbgs().
...
llvm-svn: 92607
2010-01-05 01:27:01 +00:00
David Greene
d0587e9991
Change errs() to dbgs().
...
llvm-svn: 92606
2010-01-05 01:26:57 +00:00
David Greene
1d478b6184
Change errs() to dbgs().
...
llvm-svn: 92605
2010-01-05 01:26:54 +00:00
David Greene
e07c8e1668
Change errs() to dbgs().
...
llvm-svn: 92604
2010-01-05 01:26:52 +00:00
David Greene
991e882855
Change errs() to dbgs().
...
llvm-svn: 92603
2010-01-05 01:26:49 +00:00
David Greene
94ab26dd76
Change errs() to dbgs().
...
llvm-svn: 92602
2010-01-05 01:26:45 +00:00
David Greene
2805ab874b
Change errs() to dbgs().
...
llvm-svn: 92601
2010-01-05 01:26:44 +00:00
David Greene
e7608c8372
Change errs() to dbgs().
...
llvm-svn: 92600
2010-01-05 01:26:41 +00:00
David Greene
afac983b1a
Change errs() to dbgs().
...
llvm-svn: 92599
2010-01-05 01:26:39 +00:00
Devang Patel
3b08c33f33
Remove dead debug info intrinsics.
...
Intrinsic::dbg_stoppoint
Intrinsic::dbg_region_start
Intrinsic::dbg_region_end
Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.
llvm-svn: 92557
2010-01-05 01:10:40 +00:00
Daniel Dunbar
1fb9148421
Fix some struct/class specifier mismatches.
...
llvm-svn: 92550
2010-01-05 00:15:58 +00:00
Chris Lattner
3b060b2d41
Truncate GEP indexes larger than the pointer size down to pointer size
...
when doing this transform if the GEP is not inbounds. No testcase because
it is very difficult to trigger this: instcombine already canonicalizes
GEP indices to pointer size, so it relies specific permutations of the
instcombine worklist.
Thanks to Duncan for pointing this possible problem out.
llvm-svn: 92495
2010-01-04 18:57:15 +00:00
Chris Lattner
8304a93ff4
silence a bogus 'might be used uninit' warning from GCC.
...
llvm-svn: 92494
2010-01-04 18:48:26 +00:00
Chris Lattner
e19878577c
move some more cast-related stuff
...
llvm-svn: 92471
2010-01-04 07:59:07 +00:00
Mikhail Glushenkov
38e36d577a
80-col violations, trailing whitespace.
...
llvm-svn: 92470
2010-01-04 07:55:25 +00:00
Chris Lattner
f9920fbac9
move the [Can]EvaluateInDifferentType functions out to InstCombineCasts.cpp
...
llvm-svn: 92469
2010-01-04 07:54:59 +00:00
Chris Lattner
7a5037baf5
split 943 lines of instcombine out to a new InstCombineCasts.cpp
...
file. InstructionCombining.cpp is now down to a svelte 9300 lines :)
llvm-svn: 92468
2010-01-04 07:53:58 +00:00
Chris Lattner
fed736376e
split instcombine of compares (visit[FI]Cmp) out to
...
a new InstCombineCompares.cpp file.
llvm-svn: 92467
2010-01-04 07:37:31 +00:00
Chris Lattner
176c21d33e
update cmakefile
...
llvm-svn: 92466
2010-01-04 07:19:55 +00:00
Chris Lattner
fbcc4eb5a5
move the 'SimplifyDemandedFoo' methods out to their own file, cutting 1K lines out of instcombine.cpp
...
llvm-svn: 92465
2010-01-04 07:17:19 +00:00
Chris Lattner
cf0889fda3
split the instcombine class definition out to a header shared
...
among the instcombine library.
llvm-svn: 92463
2010-01-04 07:12:23 +00:00
Chris Lattner
cb0fe8a20b
remove a ton of unneeded LLVMContext stuff.
...
llvm-svn: 92462
2010-01-04 07:02:48 +00:00
Chris Lattner
ec9a1ab1bb
move InstCombineWorklist out to its own header.
...
llvm-svn: 92461
2010-01-04 06:30:00 +00:00
Chris Lattner
2e86be5607
forgot to svn add these.
...
llvm-svn: 92460
2010-01-04 06:28:20 +00:00
Chris Lattner
2d9948f5f1
move instcombine to its own library, it's past time.
...
llvm-svn: 92459
2010-01-04 06:23:24 +00:00
Chris Lattner
ce3f5f3448
implement an instcombine xform needed by clang's codegen
...
on the example in PR4216. This doesn't trigger in the testsuite,
so I'd really appreciate someone scrutinizing the logic for
correctness.
llvm-svn: 92458
2010-01-04 06:03:59 +00:00
Chris Lattner
eb68b810a8
pull my debug hooks out, I'm done with this xform for now.
...
llvm-svn: 92446
2010-01-03 06:58:48 +00:00
Nick Lewycky
ebb78c871c
Small cleanups, refactor some duplicated code into a single method. No
...
functionality change.
llvm-svn: 92445
2010-01-03 04:39:07 +00:00
Chris Lattner
647c629ee4
generalize the previous transformation to handle indexing into
...
arrays of structs and other arrays, so long as all the subsequent
indexes are constants. This triggers frequently for stuff like:
@divisions = internal constant [29 x [2 x i32]] [[2 x i32] zeroinitializer, [2 x i32] [i32 0, i32 1], [2 x i32] [i32 0, i32 2], [2 x i32] [i32 0, i32 1], [2 x i32] zeroinitializer, [2 x i32] [i32 0, i32 1], [2 x i32] [i32 0, i32 1], [2 x i32] [i32 0, i32 2], [2 x i32] [i32 0, i32 2], [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] zeroinitializer, [2 x i32] [i32 0, i32 2], [2 x i32] [i32 0, i32 1], [2 x i32] zeroinitializer, [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 1, i32 2]], align 32 ; <[29 x [2 x i32]]*> [#uses=50]
%623 = getelementptr inbounds [29 x [2 x i32]]* @divisions, i64 0, i64 %619, i64 0 ; <i32*> [#uses=1]
%684 = icmp eq i32 %683, 999
also for the "my_defs" table in 'gs', etc.
llvm-svn: 92444
2010-01-03 03:03:27 +00:00
Nick Lewycky
b871238139
Cleanup.
...
llvm-svn: 92436
2010-01-03 00:55:31 +00:00
Chris Lattner
acb0c133ec
teach instcombine to optimize idioms like A[i]&42 == 0. This
...
occurs in 403.gcc in mode_mask_array, in safe-ctype.c (which
is copied in multiple apps) in _sch_istable, etc.
llvm-svn: 92427
2010-01-02 22:08:28 +00:00
Chris Lattner
4af67af013
Teach the table lookup optimization to generate range compares
...
when a consequtive sequence of elements all satisfies the
predicate. Like the double compare case, this generates better
code than the magic constant case and generalizes to more than
32/64 element array lookups.
Here are some examples where it triggers. From 403.gcc, most
accesses to the rtx_class array are handled, e.g.:
@rtx_class = constant [153 x i8] c"xxxxxmmmmmmmmxxxxxxxxxxxxmxxxxxxiiixxxxxxxxxxxxxxxxxxxooxooooooxxoooooox3x2c21c2222ccc122222ccccaaaaaa<<<<<<<<<<<<<<<<<<111111111111bbooxxxxxxxxxxcc2211x", align 32 ; <[153 x i8]*> [#uses=547]
%142 = icmp eq i8 %141, 105
@rtx_class = constant [153 x i8] c"xxxxxmmmmmmmmxxxxxxxxxxxxmxxxxxxiiixxxxxxxxxxxxxxxxxxxooxooooooxxoooooox3x2c21c2222ccc122222ccccaaaaaa<<<<<<<<<<<<<<<<<<111111111111bbooxxxxxxxxxxcc2211x", align 32 ; <[153 x i8]*> [#uses=543]
%165 = icmp eq i8 %164, 60
Also, most of the 59-element arrays (mode_class/rid_to_yy, etc)
optimized before are actually range compares. This lets 32-bit
machines optimize them.
400.perlbmk has stuff like this:
400.perlbmk: PL_regkind, even for 32-bit:
@PL_regkind = constant [62 x i8] c"\00\00\02\02\02\06\06\06\06\09\09\0B\0B\0D\0E\0E\0E\11\12\12\14\14\16\16\18\18\1A\1A\1C\1C\1E\1F !!!$$&'((((,-.///88886789:;8$", align 32 ; <[62 x i8]*> [#uses=4]
%811 = icmp ne i8 %810, 33
@PL_utf8skip = constant [256 x i8] c"\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\04\04\04\04\04\04\04\04\05\05\05\05\06\06\07\0D", align 32 ; <[256 x i8]*> [#uses=94]
%12 = icmp ult i8 %10, 2
etc.
llvm-svn: 92426
2010-01-02 21:50:18 +00:00
Chris Lattner
c67cde71b1
theoretically the negate we find could be in a different function, check
...
for this case.
llvm-svn: 92425
2010-01-02 21:46:33 +00:00
Chris Lattner
dfb25d34f5
use enums for the over/underdefined markers for clarity. Switch
...
to using -2/-3 instead of -1/-2 for a future xform.
llvm-svn: 92423
2010-01-02 20:20:33 +00:00
Chris Lattner
07a1a284d3
remove the random sampling framework, which is not maintained anymore.
...
If there is interest, it can be resurrected from SVN. PR4912.
llvm-svn: 92422
2010-01-02 20:07:03 +00:00
Nick Lewycky
cda0109ec5
Fix logic error in previous commit. The != case needs to become an or, not an
...
and.
llvm-svn: 92419
2010-01-02 16:14:56 +00:00
Nick Lewycky
3cc8fe073a
Optimize pointer comparison into the typesafe form, now that the backends will
...
handle them efficiently. This is the opposite direction of the transformation
we used to have here.
llvm-svn: 92418
2010-01-02 15:25:44 +00:00