Chris Lattner
9e64bad0da
allow this to work on linux hosts.
...
llvm-svn: 92407
2010-01-02 00:22:15 +00:00
Chris Lattner
fe8af82cd4
Teach codegen to handle:
...
(X != null) | (Y != null) --> (X|Y) != 0
(X == null) & (Y == null) --> (X|Y) == 0
so that instcombine can stop doing this for pointers. This is part of PR3351,
which is a case where instcombine doing this for pointers (inserting ptrtoint)
is pessimizing code.
llvm-svn: 92406
2010-01-02 00:00:03 +00:00
Chris Lattner
4e49a69ec5
rename file.
...
llvm-svn: 92405
2010-01-01 23:55:04 +00:00
Chris Lattner
330323f780
whitespace cleanup
...
llvm-svn: 92404
2010-01-01 23:37:34 +00:00
Chris Lattner
ef4fba933d
add a simple instcombine xform, simplify another one to use hasAllZeroIndices()
...
instead of hand rolling a loop.
llvm-svn: 92403
2010-01-01 23:09:08 +00:00
Chris Lattner
feb7b1af69
generalize the pointer difference optimization to handle
...
a constantexpr gep on the 'base' side of the expression.
This completes comment #4 in PR3351, which comes from
483.xalancbmk.
llvm-svn: 92402
2010-01-01 22:42:29 +00:00
Chris Lattner
89b1b63bdf
teach instcombine to optimize pointer difference idioms involving constant
...
expressions. This is a step towards comment #4 in PR3351.
llvm-svn: 92401
2010-01-01 22:29:12 +00:00
Chris Lattner
de358b45b6
use 'match' to simplify some code.
...
llvm-svn: 92400
2010-01-01 22:12:03 +00:00
Chris Lattner
ce7717e168
implement the transform requested in PR5284
...
llvm-svn: 92398
2010-01-01 18:34:40 +00:00
Mikhail Glushenkov
e862cc48f3
Fix a warning on gcc 4.4.
...
SelectionDAGBuilder.cpp:4294: warning: suggest explicit braces to avoid
ambiguous ‘else’
llvm-svn: 92395
2010-01-01 04:41:36 +00:00
Mikhail Glushenkov
0fba686958
Trailing whitespace, 80-col violations.
...
llvm-svn: 92394
2010-01-01 04:41:22 +00:00
Mikhail Glushenkov
82242fb2a8
Minor simplifactions.
...
llvm-svn: 92393
2010-01-01 04:41:10 +00:00
Mikhail Glushenkov
3a5fc21b12
Typo.
...
llvm-svn: 92392
2010-01-01 04:40:54 +00:00
Mikhail Glushenkov
226e1c7f11
Make CheckForSuperfluousOptions handle list form of 'switch_on' correctly.
...
llvm-svn: 92391
2010-01-01 03:51:02 +00:00
Mikhail Glushenkov
f697106fb7
Minor simplifications.
...
llvm-svn: 92390
2010-01-01 03:50:51 +00:00
Mikhail Glushenkov
72ce967c39
Better error message.
...
llvm-svn: 92389
2010-01-01 03:50:34 +00:00
Chris Lattner
44298d184a
Teach codegen to lower llvm.powi to an efficient (but not optimal)
...
multiply sequence when the power is a constant integer. Before, our
codegen for std::pow(.., int) always turned into a libcall, which was
really inefficient.
This should also make many gfortran programs happier I'd imagine.
llvm-svn: 92388
2010-01-01 03:32:16 +00:00
Chris Lattner
3d38dbff2a
Make this more likely to generate a libcall.
...
llvm-svn: 92387
2010-01-01 03:26:51 +00:00
Chris Lattner
6d58c7dd39
add missing line.
...
llvm-svn: 92384
2010-01-01 01:54:08 +00:00
Chris Lattner
e5f5e4b151
add a few trivial instcombines for llvm.powi.
...
llvm-svn: 92383
2010-01-01 01:52:15 +00:00
Chris Lattner
0ea2e3d444
update this. To take the next step, llvm.powi should be generalized to work
...
on integers as well and codegen should lower them to branch trees.
llvm-svn: 92382
2010-01-01 01:29:26 +00:00
Chris Lattner
662a872e15
When factoring multiply expressions across adds, factor both
...
positive and negative forms of constants together. This
allows us to compile:
int foo(int x, int y) {
return (x-y) + (x-y) + (x-y);
}
into:
_foo: ## @foo
subl %esi, %edi
leal (%rdi,%rdi,2), %eax
ret
instead of (where the 3 and -3 were not factored):
_foo:
imull $-3, 8(%esp), %ecx
imull $3, 4(%esp), %eax
addl %ecx, %eax
ret
this started out as:
movl 12(%ebp), %ecx
imull $3, 8(%ebp), %eax
subl %ecx, %eax
subl %ecx, %eax
subl %ecx, %eax
ret
This comes from PR5359.
llvm-svn: 92381
2010-01-01 01:13:15 +00:00
Chris Lattner
dd837a069b
test case we alredy get right.
...
llvm-svn: 92380
2010-01-01 00:50:00 +00:00
Ted Kremenek
73df1b5d05
Remove old header.
...
llvm-svn: 92378
2010-01-01 00:04:49 +00:00
Chris Lattner
4a56803f29
clean up some comments.
...
llvm-svn: 92377
2010-01-01 00:04:26 +00:00
Chris Lattner
8812fc68ee
switch from std::map to DenseMap for rank data structures.
...
llvm-svn: 92375
2010-01-01 00:01:34 +00:00
Ted Kremenek
15f320fa10
Remove derelict serialization code.
...
llvm-svn: 92374
2009-12-31 23:40:17 +00:00
Chris Lattner
ebe5932016
reuse negates where possible instead of always creating them from scratch.
...
This allows us to optimize test12 into:
define i32 @test12(i32 %X) {
%factor = mul i32 %X, -3 ; <i32> [#uses=1]
%Z = add i32 %factor, 6 ; <i32> [#uses=1]
ret i32 %Z
}
instead of:
define i32 @test12(i32 %X) {
%Y = sub i32 6, %X ; <i32> [#uses=1]
%C = sub i32 %Y, %X ; <i32> [#uses=1]
%Z = sub i32 %C, %X ; <i32> [#uses=1]
ret i32 %Z
}
llvm-svn: 92373
2009-12-31 20:34:32 +00:00
Chris Lattner
bdf261d481
we don't need a smallptrset to detect duplicates, the values are
...
sorted, so we can just do a linear scan.
llvm-svn: 92372
2009-12-31 19:49:01 +00:00
Chris Lattner
5551708ece
make reassociate more careful about not leaving around dead mul's
...
llvm-svn: 92370
2009-12-31 19:34:45 +00:00
Chris Lattner
0e3d1bade8
remove debug
...
llvm-svn: 92369
2009-12-31 19:25:19 +00:00
Chris Lattner
59379f8bb0
teach reassociate to factor x+x+x -> x*3. While I'm at it,
...
fix RemoveDeadBinaryOp to actually do something.
llvm-svn: 92368
2009-12-31 19:24:52 +00:00
Chris Lattner
333b35d45e
change reassociate to use SmallVector for its key datastructures
...
instead of std::vector.
llvm-svn: 92366
2009-12-31 18:40:32 +00:00
Chris Lattner
0c384066c0
change an if to an assert, fix comment.
...
llvm-svn: 92364
2009-12-31 18:18:46 +00:00
Chris Lattner
e8cca9664a
move the rest of the add optimization code out to OptimizeAdd,
...
improve some comments, simplify a bit of code.
llvm-svn: 92363
2009-12-31 18:17:13 +00:00
Chris Lattner
236f281971
factor statistic updating better.
...
llvm-svn: 92362
2009-12-31 17:51:05 +00:00
Benjamin Kramer
9e60957f54
Silence compiler warning.
...
warning: comparison between signed and unsigned integer expressions
llvm-svn: 92359
2009-12-31 16:27:13 +00:00
Chris Lattner
4870f6a384
simple fix for an incorrect factoring which causes a
...
miscompilation, PR5458.
llvm-svn: 92354
2009-12-31 08:33:49 +00:00
Chris Lattner
d9ed31f6d0
merge some more tests in.
...
llvm-svn: 92353
2009-12-31 08:32:22 +00:00
Chris Lattner
67d96ee04c
filecheckize
...
llvm-svn: 92352
2009-12-31 08:29:56 +00:00
Chris Lattner
af22bc2328
fix refactoro
...
llvm-svn: 92349
2009-12-31 08:23:09 +00:00
Chris Lattner
d8516bddb2
factor code out into helper functions.
...
llvm-svn: 92347
2009-12-31 07:59:34 +00:00
Chris Lattner
b4d616f2d4
switch some std::vector's to smallvector. Reduce nesting.
...
llvm-svn: 92346
2009-12-31 07:48:51 +00:00
Chris Lattner
fe111bf087
use more modern datastructures.
...
llvm-svn: 92344
2009-12-31 07:33:14 +00:00
Chris Lattner
3ebdd96db7
clean up -debug output.
...
llvm-svn: 92343
2009-12-31 07:17:37 +00:00
Douglas Gregor
c4174c69ea
Document the edit-distance algorithm used in StringRef, switch it over
...
to SmallVector, and add a unit test.
llvm-svn: 92340
2009-12-31 04:24:34 +00:00
Chris Lattner
918e70e140
this #include is ok.
...
llvm-svn: 92338
2009-12-31 03:02:42 +00:00
Chris Lattner
ecba817b0e
fix Analysis/DebugInfo.h to not include Metadata.h. Do this
...
by moving one method out of line and eliminating redundant checks
from other methods.
llvm-svn: 92337
2009-12-31 03:02:08 +00:00
Chris Lattner
70788c5e57
add some basic named MD tests.
...
llvm-svn: 92336
2009-12-31 03:00:49 +00:00
Chris Lattner
f9012cc497
use early exits to reduce indentation.
...
llvm-svn: 92335
2009-12-31 02:33:14 +00:00