Jeff Cohen
d45bdb45c1
Add SimplyLibCalls.cpp to VC++ build
...
llvm-svn: 21554
2005-04-26 02:57:49 +00:00
Reid Spencer
342fe9a833
Fix RUN: line to not always pass.
...
llvm-svn: 21553
2005-04-26 02:33:25 +00:00
Chris Lattner
cfa7ddd6e2
Fold (X > -1) | (Y > -1) --> (X&Y > -1)
...
llvm-svn: 21552
2005-04-26 01:18:33 +00:00
Reid Spencer
fe91dfec91
Changes due to code review and new implementation:
...
* Don't use std::string for the function names, const char* will suffice
* Allow each CallOptimizer to validate the function signature before
doing anything
* Repeatedly loop over the functions until an iteration produces
no more optimizations. This allows one optimization to insert a
call that is optimized by another optimization.
* Implement the ConstantArray portion of the StrCatOptimization
* Provide a template for the MemCpyOptimization
* Make ExitInMainOptimization split the block, not delete everything
after the return instruction.
(This covers revision 1.3 and 1.4, as the 1.3 comments were botched)
llvm-svn: 21548
2005-04-25 21:20:38 +00:00
Chris Lattner
f806459d90
implement some more logical compares with constants, so that:
...
int foo1(int x, int y) {
int t1 = x >= 0;
int t2 = y >= 0;
return t1 & t2;
}
int foo2(int x, int y) {
int t1 = x == -1;
int t2 = y == -1;
return t1 & t2;
}
produces:
_foo1:
or r2, r4, r3
srwi r2, r2, 31
xori r3, r2, 1
blr
_foo2:
and r2, r4, r3
addic r2, r2, 1
li r2, 0
addze r3, r2
blr
instead of:
_foo1:
srwi r2, r4, 31
xori r2, r2, 1
srwi r3, r3, 31
xori r3, r3, 1
and r3, r2, r3
blr
_foo2:
addic r2, r4, 1
li r2, 0
addze r2, r2
addic r3, r3, 1
li r3, 0
addze r3, r3
and r3, r2, r3
blr
llvm-svn: 21547
2005-04-25 21:20:28 +00:00
Reid Spencer
f2534c7291
Lots of changes based on review and new functionality:
...
* Use a
llvm-svn: 21546
2005-04-25 21:11:48 +00:00
Reid Spencer
172e9155c1
Update the test case to handle a few more (degenerate) cases and remove
...
the restriction that it is an XFAIL because it now passes.
llvm-svn: 21545
2005-04-25 21:08:34 +00:00
Chris Lattner
d373ff64aa
Codegen x < 0 | y < 0 as (x|y) < 0. This allows us to compile this to:
...
_foo:
or r2, r4, r3
srwi r3, r2, 31
blr
instead of:
_foo:
srwi r2, r4, 31
srwi r3, r3, 31
or r3, r2, r3
blr
llvm-svn: 21544
2005-04-25 21:03:25 +00:00
Chris Lattner
e093c6f565
Make dominates(A,B) work with post dominators. Patch contributed by
...
Naveen Neelakantam, thanks!
llvm-svn: 21543
2005-04-25 20:50:33 +00:00
Tanya Lattner
af0ac2744e
Added question about turning off all optimizations. I think this has been asked once or twice.
...
llvm-svn: 21542
2005-04-25 20:36:56 +00:00
Chris Lattner
a21bf8d1be
implement getelementptr.ll:test10
...
llvm-svn: 21541
2005-04-25 20:17:30 +00:00
Chris Lattner
20621b1e94
rename fn
...
llvm-svn: 21540
2005-04-25 20:17:16 +00:00
Chris Lattner
e680ee2a48
new testcase
...
llvm-svn: 21539
2005-04-25 20:17:00 +00:00
Chris Lattner
ecac782786
Correctly handle global-argument aliases induced in main
...
llvm-svn: 21537
2005-04-25 19:16:31 +00:00
Chris Lattner
5965359d8f
Don't mess up SCC traversal when a node has null edges out of it.
...
llvm-svn: 21536
2005-04-25 19:16:17 +00:00
Chris Lattner
37b6b097ff
document 'opaque' types
...
llvm-svn: 21535
2005-04-25 17:34:15 +00:00
Chris Lattner
d1039cc581
Add feedback from Vikram
...
llvm-svn: 21534
2005-04-25 15:47:57 +00:00
Reid Spencer
478d3b930a
Make sure the target buffer is null terminated so we don't blow up
...
strcat when its called.
llvm-svn: 21533
2005-04-25 15:40:35 +00:00
Reid Spencer
20b0e43e1f
A test case for testing the StrCatOptimizer, currently XFAILed everywhere.
...
llvm-svn: 21532
2005-04-25 07:29:30 +00:00
Reid Spencer
9bbaa2ab7f
Post-Review Cleanup:
...
* Fix comments at top of file
* Change algorithm for running the call optimizations from n*n to something
closer to n.
* Use a hash_map to store and lookup the optimizations since there will
eventually (or potentially) be a large number of them. This gets lookup
based on the name of the function to O(1). Each CallOptimizer now has a
std::string member named func_name that tracks the name of the function
that it applies to. It is this string that is entered into the hash_map
for fast comparison against the function names encountered in the module.
* Cleanup some style issues pertaining to iterator invalidation
* Don't pass the Function pointer to the OptimizeCall function because if
the optimization needs it, it can get it from the CallInst passed in.
* Add the skeleton for a new CallOptimizer, StrCatOptimizer which will
eventually replace strcat's of constant strings with direct copies.
llvm-svn: 21526
2005-04-25 03:59:26 +00:00
Reid Spencer
23423346f8
Use the %name rather than the "name" format so those familiar with the
...
llvm-dis output don't go blind.
llvm-svn: 21525
2005-04-25 03:18:19 +00:00
Reid Spencer
ff7b16c1d6
Shut GCC 4.0 up about classes that have virtual functions but a non-virtual
...
destructor. Just add the do-nothing virtual destructor.
llvm-svn: 21524
2005-04-25 02:55:55 +00:00
Reid Spencer
0c2d046aa4
Declare a function to create the SimplifyLibCalls pass.
...
llvm-svn: 21523
2005-04-25 02:54:00 +00:00
Reid Spencer
39a762d149
A new pass to provide specific optimizations for certain well-known library
...
calls. The pass visits all external functions in the module and determines
if such function calls can be optimized. The optimizations are specific to
the library calls involved. This initial version only optimizes calls to
exit(3) when they occur in main(): it changes them to ret instructions.
llvm-svn: 21522
2005-04-25 02:53:12 +00:00
Reid Spencer
985f484263
A test case for the the ExitInMain libcall simplification.
...
llvm-svn: 21521
2005-04-25 02:50:08 +00:00
Reid Spencer
8edc8beacf
Older compilers won't like the inline virtual destructor in the header file
...
so we put the destructor in Pass.cpp and make it non-inline.
llvm-svn: 21520
2005-04-25 01:01:35 +00:00
Chris Lattner
fc104de06d
fix some bugs
...
llvm-svn: 21515
2005-04-25 00:38:52 +00:00
Reid Spencer
756d049c06
Fix a thinko in the documentation of the splitBasicBlock method. The branch
...
instruction is added to the original block, not the new block.
llvm-svn: 21513
2005-04-25 00:31:53 +00:00
Reid Spencer
9c47b25868
Shut GCC 4.0 up about classes with virtual functions but no virtual
...
destructor.
llvm-svn: 21510
2005-04-24 22:27:20 +00:00
Reid Spencer
ad750a80eb
Shut GCC 4.0 up when it complains about classes with virtual functions that
...
don't have virtual destructors.
llvm-svn: 21507
2005-04-24 22:20:32 +00:00
Reid Spencer
4da978466d
Make this readable for newbies and those who can only understand one set of
...
grammar rules for the English language.
llvm-svn: 21503
2005-04-24 20:56:18 +00:00
Misha Brukman
6818b33096
extract has been renamed to llvm-extract to avoid conflicting with another tool
...
llvm-svn: 21501
2005-04-24 17:46:58 +00:00
Chris Lattner
2f1457fd83
Eliminate cases where we could << by 64, which is undefined in C.
...
llvm-svn: 21500
2005-04-24 17:46:05 +00:00
Misha Brukman
ca1e0c6ae0
There are still uses for spaces in Makefiles -- to make text line up together,
...
regardless of the tab size/stop settings on the developer side
llvm-svn: 21499
2005-04-24 17:43:41 +00:00
Misha Brukman
e22594f3d7
extract has been renamed to llvm-extract to avoid conflicting with another tool
...
llvm-svn: 21498
2005-04-24 17:36:05 +00:00
Misha Brukman
3e9634eaa0
elisp code to help with LLVM code standards compliance
...
llvm-svn: 21497
2005-04-24 17:09:19 +00:00
Misha Brukman
831ad84eea
.vimrc file to aid in LLVM coding standards conformance
...
llvm-svn: 21496
2005-04-24 17:05:04 +00:00
Chris Lattner
d6f636a340
Implement xor.ll:test21: select (not C), A, B -> select C, B, A
...
llvm-svn: 21495
2005-04-24 07:30:14 +00:00
Chris Lattner
b57d040464
Test that xor/select are folded into a select with inverted operands.
...
llvm-svn: 21494
2005-04-24 07:28:53 +00:00
Chris Lattner
2c7d177d25
Allow these methods to take a generic Value* to simplify clients. Use
...
const_cast instead of c casts.
llvm-svn: 21493
2005-04-24 07:28:37 +00:00
Chris Lattner
b220952aca
allow these to take a generic Value*
...
llvm-svn: 21492
2005-04-24 07:28:04 +00:00
Chris Lattner
d1f46d3bf9
Use getPrimitiveSizeInBits() instead of getPrimitiveSize()*8
...
Completely rework the 'setcc (cast x to larger), y' code. This code has
the advantage of implementing setcc.ll:test19 (being more general than
the previous code) and being correct in all cases.
This allows us to unxfail 2004-11-27-SetCCForCastLargerAndConstant.ll,
and close PR454.
llvm-svn: 21491
2005-04-24 06:59:08 +00:00
Chris Lattner
0de0638522
unxfail this.
...
llvm-svn: 21490
2005-04-24 06:55:40 +00:00
Chris Lattner
624d5cb006
add a new testcase which occurs in 181.mcf
...
llvm-svn: 21489
2005-04-24 06:55:33 +00:00
Misha Brukman
1c8d93b08f
* The aesthetic police is on patrol!!...
...
* ... but it wasn't so busy as to not smell the roses and doxygenify comments
llvm-svn: 21487
2005-04-23 22:35:26 +00:00
Chris Lattner
396890d3ac
Add a helper method
...
llvm-svn: 21486
2005-04-23 22:20:22 +00:00
Chris Lattner
8a878ccb25
Fix a bug in my previous checkin
...
llvm-svn: 21485
2005-04-23 22:01:39 +00:00
Chris Lattner
2908bc1e7a
This file is never referenced
...
llvm-svn: 21484
2005-04-23 22:00:26 +00:00
Chris Lattner
6263766133
Add a method, remove last use of Type.def
...
llvm-svn: 21483
2005-04-23 22:00:09 +00:00
Chris Lattner
816394d7ad
add a method, remove a dead #include
...
llvm-svn: 21482
2005-04-23 21:59:42 +00:00