Commit Graph

563 Commits

Author SHA1 Message Date
Chris Lattner
2144c25364 Remove some dead variables.
Fix a nasty bug in the memcmp optimizer where we used the wrong variable!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28269 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-12 23:35:26 +00:00
Andrew Lenharth
61e99c9db8 linear -> constant time
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27652 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-13 13:43:31 +00:00
Andrew Lenharth
3433141a3e Add a simple pass to make sure that all (non-library) calls to malloc and free
are visible to analysis as intrinsics.  That is, make sure someone doesn't pass
free around by address in some struct (as happens in say 176.gcc).

This doesn't get rid of any indirect calls, just ensure calls to free and malloc
are always direct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27560 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-10 19:26:09 +00:00
Jim Laskey
4ca9757a39 Strip changes to llvm.dbg intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26993 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-23 18:11:33 +00:00
Chris Lattner
b2f6c0075c Teach the strip pass to strip type names in addition to value names. This
is fallout from the type/value split in the symtab long long ago :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26785 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-15 19:22:41 +00:00
Jim Laskey
f4321a3a43 Handle the removal of the debug chain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26729 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-13 13:07:37 +00:00
Chris Lattner
e2b59d2760 fix a pasto
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26627 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-09 06:09:41 +00:00
Jim Laskey
e8c3e3b51c Switch to using a numeric id for anchors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26598 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-07 20:53:47 +00:00
Chris Lattner
e1c173bc77 Fix ConstantMerge/2006-03-07-DontMergeDiffSections.ll, a problem Jim
hypotheticalized about, where we would incorrectly merge two globals in
different sections.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26597 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-07 17:56:59 +00:00
Chris Lattner
aecb0627fa Make this work with renamed intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26482 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-03 01:30:23 +00:00
Andrew Lenharth
2f9859486a fix a bunch of alpha regressions. see bug 709
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26218 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-15 21:13:37 +00:00
Chris Lattner
e46f6e99a0 add a bunch more optimizations for unary double math functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25530 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-23 06:24:46 +00:00
Chris Lattner
7070c5f241 Refactor/genericize this, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25525 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-23 05:57:36 +00:00
Chris Lattner
dac58ad983 Make iostream #inclusion explicit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25514 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-22 23:32:06 +00:00
Chris Lattner
e05cf71616 Make this more efficient in the following ways:
1. Do not statically construct a map when the program starts up, this
   is expensive and cannot be optimized.  Instead, create a list.
2. Do not insert entries for all function in the module into a hashmap
   that lives the full life of the compiler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25512 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-22 23:10:26 +00:00
Chris Lattner
0f9f8c3759 Several non-functionality changing changes:
1. Use the varargs version of getOrInsertFunction to simplify code.
2. remove #include
3. Reduce the number of #ifdef's.
4. remove extraneous vertical whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25508 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-22 22:35:08 +00:00
Reid Spencer
aa87e0523d For PR696:
Don't do floor->floorf conversion if floorf is not available. This checks
the compiler's host, not its target, which is incorrect for cross-compilers
Not sure that's important as we don't build many cross-compilers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25456 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 08:36:56 +00:00
Chris Lattner
727552bb89 If not internalizing, don't mark llvm.global[cd]tors const, as a fix for a
hypothetical future boog.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25430 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 00:46:54 +00:00
Chris Lattner
ee9e14cb8a Don't internalize llvm.global[cd]tor unless there are uses of it. This
unbreaks front-ends that don't use __main (like the new CFE).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25429 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-19 00:40:39 +00:00
Chris Lattner
f91e97ae81 Clean up the FFS optimization code, and make it correctly create the appropriate
unsigned llvm.cttz.* intrinsic, fixing the 2005-05-11-Popcount-ffs-fls regression
last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25398 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-17 18:27:17 +00:00
Chris Lattner
432a205769 Let the inliner update the callgraph to reflect the changes it makes, instead
of doing it ourselves.  This fixes Transforms/Inline/2006-01-14-CallGraphUpdate.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25321 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-14 20:09:18 +00:00
Chris Lattner
ccca3ca85f Permit inlining functions that contain dynamic allocations now that
InlineFunction handles this case safely.  This implements
Transforms/Inline/dynamic_alloca_test.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25288 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-13 19:35:43 +00:00
Chris Lattner
8acb249725 Fix 80 column violations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25279 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-13 18:06:56 +00:00
Chris Lattner
4eb40df1a8 Pull inline methods out of the pass class definition to make it easier to
read the code.

Do not internalize debugger anchors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25067 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-03 19:13:17 +00:00
Reid Spencer
2f1890792c Improve ResolveFunctions to:
a) use better local variable names (OldMT -> OldFT) where "M" is used to
   mean "Function" (perhaps it was previously "Method"?)
b) print out the module identifier in a warning message so that it is
   possible to track down in which module the error occurred.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24698 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-13 19:56:51 +00:00
Chris Lattner
6b44ba2803 Wrap a long line, never internalize llvm.used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24602 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-05 05:07:38 +00:00
Nate Begeman
14b0529532 Add support alignment of allocation instructions.
Add support for specifying alignment and size of setjmp jmpbufs.

No targets currently do anything with this information, nor is it presrved
in the bytecode representation.  That's coming up next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24196 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-05 09:21:28 +00:00
Alkis Evlogimenos
e9c6d36377 Stop using deprecated types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23973 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-25 11:18:06 +00:00
Chris Lattner
f36aeedaa3 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23940 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-24 02:26:13 +00:00
Chris Lattner
ab0ed3592b Only build .a file versions of these libraries, instead of .a and .o versions.
This should speed up build times.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23933 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-24 01:59:48 +00:00
Jeff Cohen
66c5fd6c53 When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23888 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-23 04:37:20 +00:00
Chris Lattner
a27ea769eb Add an option to this pass. If it is set, we are allowed to internalize
all but main.  If it's not set, we can still internalize, but only if an
explicit symbol list is provided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23783 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-18 06:29:22 +00:00
Chris Lattner
a48bc53cad Fold isascii into a simple comparison. This speeds up 197.parser by 7.4%,
bringing the LLC time down to the CBE time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23521 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 06:17:27 +00:00
Chris Lattner
e9b6242780 remove a bunch of unneeded stuff, or self evident comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23519 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 06:16:11 +00:00
Chris Lattner
c330069e20 Implement a couple of memcmp folds from the todo list
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23517 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 04:54:20 +00:00
Chris Lattner
9a5582f251 Fix a regression in my previous patch, fixing GlobalOpt/2005-09-27-Crash.ll
and PR632.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23484 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 22:28:11 +00:00
Chris Lattner
a9ec8ab32b Add support for external calls that we know how to constant fold. This implements
ctor-list-opt.ll:CTOR8


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23465 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 05:02:43 +00:00
Chris Lattner
231308c545 Fix a bug where we would evaluate stores into linkonce objects which could be
potentially replaced at link-time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23463 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 04:50:03 +00:00
Chris Lattner
cd27142cc8 Implement support for static constructors with calls in them. This is useful
because gccas runs globalopt before inlining.

This implements ctor-list-opt.ll:CTOR7


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23462 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 04:45:34 +00:00
Chris Lattner
8a7cc6e71c Refactor this code a bit, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23460 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 04:27:01 +00:00
Chris Lattner
ff0c1ef9eb Remove some dead code. ctor evaluation subsumes empty ctor elim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23453 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 20:38:20 +00:00
Chris Lattner
a22fdb0a37 Add support for alloca, implementing ctor-list-opt.ll:CTOR6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23452 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 17:07:09 +00:00
Chris Lattner
aae4a1cd3f Add a debug printout, fix a crash on kc++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23450 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 07:34:35 +00:00
Chris Lattner
798b4d5bb3 Implement loads/stores through GEP's of globals. This implements
ctor-list-opt.ll:CTOR5.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23449 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 06:52:44 +00:00
Chris Lattner
0b142e3920 Replace TraverseGEPInitializer with ConstantFoldLoadThroughGEPConstantExpr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23447 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:34:07 +00:00
Chris Lattner
562a055ca7 add a comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23442 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:16:34 +00:00
Chris Lattner
04de1cfb2b Add support for getelementptr, load, and correctly reject volatile stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23441 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:15:37 +00:00
Chris Lattner
cdf98bed96 Add support for br/brcond/switch and phi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23439 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 04:57:38 +00:00
Chris Lattner
79c1101947 Add a simple interpreter to this code, allowing us to statically evaluate
global ctors that are simple enough.  This implements ctor-list-opt.ll:CTOR2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23437 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 04:44:35 +00:00
Chris Lattner
db973e60ce factor some code into a InstallGlobalCtors method, add comments. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23435 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 02:31:18 +00:00