Commit Graph

1179 Commits

Author SHA1 Message Date
Chris Lattner
1e2385b941 Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10138 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 21:54:22 +00:00
Chris Lattner
1192283096 Get rid of using decls, finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10137 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 21:52:10 +00:00
Chris Lattner
869adc283c * Finegrainify namespacification
* Make the cost metric for passing constants in as arguments to functions MUCH
  more accurate, by actually estimating the amount of code that will be constant
  propagated away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10136 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 21:46:09 +00:00
Chris Lattner
a51bcb50b0 Finegrainify namespacification
Print out the costs for functions that AREN'T inlined as well


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10135 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 21:45:31 +00:00
Chris Lattner
108e4ab159 Minor cleanups and simplifications
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10127 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 16:52:05 +00:00
Chris Lattner
03fb8b2a42 * Finegrainify namespacification
* Implement FuncResolve/2003-11-20-BogusResolveWarning.ll
   ... which eliminates a large number of annoying warnings.  I know misha
   will miss them though!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10123 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-20 21:21:31 +00:00
Chris Lattner
f8485c6434 Start using the nicer terminator auto-insertion API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10111 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-20 18:25:24 +00:00
Chris Lattner
adbc0b5287 Spew symbolic types!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10110 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-20 18:23:14 +00:00
Chris Lattner
143df9a1bb When spewing out warnings during function resolution, do not vomit out pages
and pages of non-symbolic types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10109 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-20 18:19:35 +00:00
Misha Brukman
444fdea19d This file was somehow missing a top-level comment line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10055 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-17 19:35:17 +00:00
Chris Lattner
faa45ce300 Fix PR116
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10032 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-16 21:39:27 +00:00
Chris Lattner
917e804253 Implement feature: InstCombine/2003-11-13-ConstExprCastCall.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9981 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-13 19:17:02 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00
Chris Lattner
363ca610d1 Reorganize code for locality, improve comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9857 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-10 04:42:42 +00:00
Chris Lattner
d23520cd94 Adjust to new critical edge interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9853 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-10 04:10:50 +00:00
Chris Lattner
d77922f1a2 Do NOT inline self recursive calls into other functions. This is causing the
pool allocator no end of trouble, and doesn't make a lot of sense anyway.  This
does not solve the problem with mutually recursive functions, but they are much less common.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9828 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-09 05:05:36 +00:00
Chris Lattner
b045e14111 Untypo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9827 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-09 05:04:25 +00:00
Misha Brukman
ed1f7c81aa Declare FunctionPasses as such so that they can be used in FunctionPassManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9768 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 17:20:18 +00:00
Chris Lattner
0c7e8e17ff Various cleanups and efficiency improvements
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9753 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-06 19:46:29 +00:00
Chris Lattner
d7222ec801 Fix bug: PR93
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9752 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-06 19:18:49 +00:00
Chris Lattner
b6e0631a94 Fix the problem with running cleanups in bugpoint: We were deleting arguments
of intrinsic functions, causing the verifier to fail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9745 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 21:53:41 +00:00
Chris Lattner
fdcc3acb7b Split behavior into two pieces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9741 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 21:43:02 +00:00
Chris Lattner
e7a6663eb1 Yet more fixes for constant expr shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9739 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 20:43:58 +00:00
Chris Lattner
d981f8af79 Further fixes for PR93
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9738 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 20:37:01 +00:00
Chris Lattner
1bcc70d240 Fix flawed logic that was breaking several SPEC benchmarks, including gzip and crafty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9731 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 17:31:36 +00:00
Chris Lattner
646f8d7457 Be gcc 3.4 clean
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9725 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 06:12:18 +00:00
Chris Lattner
d65460f133 Fix bug with previous implementation:
-      // ~(c-X) == X-(c-1) == X+(-c+1)
+      // ~(c-X) == X-c-1 == X+(-c-1)

Implement: C - ~X == X + (1+C)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9715 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 01:06:05 +00:00
Chris Lattner
ad5b4fb6b7 Minor cleanup, plus implement InstCombine/xor.ll:test17
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9711 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-04 23:50:51 +00:00
Chris Lattner
689d24b6ed Implement InstCombine/xor.ll:test(15|16)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9708 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-04 23:37:10 +00:00
John Criswell
700867bb69 Checking in Chris's suggestions:
Added assert() to ensure symbol table is well formed.
Added code to remember the value that was found; resolving types can change
the symbol table and invalidate the value of the iterator.
Added comments to the ResolveTypes() function (mainly for my own benefit).
Please feel free to correct the comments if they are not accurate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9693 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-04 15:22:26 +00:00
Chris Lattner
6870805117 Implement InstCombine/cast-set.ll:test6[a]. This improves code generated for
a hot function in em3d


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9673 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-03 05:17:03 +00:00
Chris Lattner
de90b76670 Implement InstCombine/cast-set.ll: test1, test2, test7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9670 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-03 04:25:02 +00:00
Chris Lattner
8ee9204309 Fix bug with zero sized casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9667 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-03 01:29:41 +00:00
Chris Lattner
fc07a3473a Fix bug in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9656 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-02 06:54:48 +00:00
Chris Lattner
bc61e661bd Implement transmogriphication of allocation instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9654 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-02 05:57:39 +00:00
Chris Lattner
d6d0d8c18d Fix PR78
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9648 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-02 02:06:27 +00:00
Chris Lattner
bb9ae1512e Strip off CPR's manually, because if we don't, the inliner doesn't delete dead
functions.  GRR


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9641 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-31 21:05:58 +00:00
Chris Lattner
bb60904469 Fix bug: 2003-10-29-CallSiteResolve.ll & PR70
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9600 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-30 00:46:41 +00:00
Chris Lattner
942457564d Refactor code, initial implementation of -insert-block-profiling pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9593 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-29 21:24:22 +00:00
Chris Lattner
546fc40d69 Fix PR66 & ScalarRepl/2003-10-29-ArrayProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9585 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-29 17:55:44 +00:00
Chris Lattner
6ace4daa57 Fix bug: ConstantMerge/2003-10-28-MergeExternalConstants.ll & PR64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9579 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-29 06:01:26 +00:00
Chris Lattner
fe2143d87d Check in statistifying patch for Bill
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9572 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-28 23:14:59 +00:00
Chris Lattner
c0204e0b73 Pass in argc & argv
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9563 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-28 22:42:24 +00:00
Chris Lattner
baa2007fae Initial checkin of profiling instrumentation pass. So far, despite the
file name, we only support function profiling.  This will be fixed in the
near future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9547 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-28 18:59:04 +00:00
Chris Lattner
7b6dd2950f Eliminate using declarations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9543 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-27 21:44:09 +00:00
Chris Lattner
2e8dfb8221 Propagating constants to arguments can make other arguments constant. For now
do something dumb, and inefficient, but more complete.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9542 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-27 21:09:00 +00:00
Chris Lattner
35956558e2 Fix test: Linker/2003-10-27-LinkOncePromote.ll
Fix PR58


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9530 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-27 16:39:39 +00:00
Chris Lattner
198f4507e2 Get the list of PHI node values before the basic block is split. Also, add
PHI node entries for unwind instructions just like for call instructions which
became invokes!  This fixes PR57, tested by
Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9526 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-27 05:33:09 +00:00
Chris Lattner
2e56dd82b3 We might as well strip off any CPRs before propagation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9437 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-23 18:49:23 +00:00
Chris Lattner
ff5bf9c62b * We were forgetting to pass varargs arguments through a call
* Add a work around for bug PR56, gross but necessary for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9428 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-23 17:44:53 +00:00
Chris Lattner
d358e6fed5 Check in initial version of ipcp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9423 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-23 16:52:27 +00:00
Chris Lattner
c3afd9bf4b Make this pass substantially stronger by having it delete dead return values
as well as arguments.  Now it can delete arguments and return values which are
only passed into other arguments or are returned, if they are dead.  This causes
it to delete several hundred extra args/retvals from the C++ hello world program,
shrinking it by about 2K.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9398 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-23 03:48:17 +00:00
Chris Lattner
ce94319558 This important patch fixes two warnings in the linker which can occur from linking
valid pieces of code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9390 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-22 23:03:38 +00:00
Chris Lattner
6be5e567ce Update the 'used' flag correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9366 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-22 04:43:18 +00:00
Chris Lattner
4cb766af4a Loop over the module, not the symbol table. This makes the code handle
unused external functions again


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9365 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-22 04:42:20 +00:00
Chris Lattner
efd47ba3ac Implement FunctionResolve/2003-10-21-GlobalResolveHack.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9363 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-22 03:35:34 +00:00
Chris Lattner
5858e1e3f3 Fix bug: FunctionResolve/2003-10-21-GlobalTypeDifference.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9359 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-21 23:17:56 +00:00
Chris Lattner
aeb18ce9c0 Fix bug: Linker/2003-10-21-ConflictingTypesTolerance.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9357 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-21 22:46:38 +00:00
Chris Lattner
f85770c9a6 Fix message to make more sense and confuse Chris less
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9354 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-21 21:52:20 +00:00
John Criswell
856ba76200 Added LLVM copyright header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9321 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-21 15:17:13 +00:00
John Criswell
e488e9360b Added LLVM copyright notice to Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9312 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 22:26:57 +00:00
John Criswell
b576c94c15 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9298 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 19:43:21 +00:00
Chris Lattner
bacc773d20 Reorder for minor efficiency gain
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9285 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 05:54:26 +00:00
Chris Lattner
3b237fcd38 Change the Opcode enum for PHI nodes from "Instruction::PHINode" to "Instruction::PHI" to be more consistent with the other instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9269 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-19 21:34:28 +00:00
Chris Lattner
3c4a34e8db Fix PR#50
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9227 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-18 06:14:59 +00:00
Chris Lattner
cda965e28a ADd support for the new varargs instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9225 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-18 05:56:52 +00:00
Chris Lattner
9493101409 Do not crash on empty structures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9195 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-17 18:03:54 +00:00
Chris Lattner
72ac148d49 Add support for 'weak' linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9171 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-16 18:29:00 +00:00
Chris Lattner
76590640cf This code does not require random access use_lists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9156 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-16 16:49:12 +00:00
Chris Lattner
28b2265eb9 Eliminate using declaration
Rewrite code to work with use_lists what are either random access or bidirectional


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9155 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-16 16:48:53 +00:00
Chris Lattner
fd05924946 Decrease usage of use_size()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9135 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-15 16:48:29 +00:00
Chris Lattner
fb42dd83f8 Cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9133 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-15 16:42:21 +00:00
Chris Lattner
f775f95369 Do not move variable sized allocations to the top of the caller, which might
break dominance relationships, and is otherwise bad.  This fixes bug:
Inline/2003-10-13-AllocaDominanceProblem.ll.  This also fixes miscompilation
of 3 176.gcc source files (reload1.c, global.c, flow.c)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9109 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-14 01:11:07 +00:00
Chris Lattner
8b716f66ad Whoops, we inserted into the wrong set. What's up with the dead set anyway?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9094 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 16:49:21 +00:00
Chris Lattner
46e033d28d Use external df iterators to avoid revisiting blocks in functions with
multiple setjmp calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9093 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 16:44:50 +00:00
Chris Lattner
4a650af599 Wrap code at 80 columns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9073 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 05:04:27 +00:00
Chris Lattner
cf3056db0f Regularize header file comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9071 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 03:32:08 +00:00
Chris Lattner
21fb3afe73 Regularize header file comment, eliminate using's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9069 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 03:30:47 +00:00
Chris Lattner
6d3906be28 Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9067 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 01:02:33 +00:00
Chris Lattner
bb2d4de409 Checkin an improvement contributed by Bill:
Only transform call sites in a setjmp'ing function which are reachable from
the setjmp.  If the call dominates the setjmp (for example), the called
function cannot longjmp to the setjmp.

This dramatically reduces the number of invoke instructions created in some
large testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9066 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 00:57:16 +00:00
Chris Lattner
2ab6a7358e Add support to the loop canonicalization pass to make it transform loops to
have a SINGLE backedge.  This is useful to, for example, the -indvars pass.

This implements testcase LoopSimplify/single-backedge.ll and closes PR#34


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9065 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-13 00:37:13 +00:00
Chris Lattner
98bf436e2e Rename loop preheaders pass to loop simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9061 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-12 21:52:28 +00:00
Chris Lattner
67a9801bc5 File is renamed to LoopSimplify.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9059 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-12 21:44:18 +00:00
Chris Lattner
ee2c50cca5 First step in renaming the preheaders pass to loopsimplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9058 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-12 21:43:28 +00:00
Chris Lattner
bebd86d58e The preheader insertion pass only depends on the CFG. Mark it as such, which
allows GCCAS to only run it once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9056 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-12 19:33:10 +00:00
Brian Gaeke
17634f7668 Include <cstdio> instead of <stdio.h>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9032 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-10 18:46:52 +00:00
Brian Gaeke
e24b616faa Don't include Config/stdio.h or <stdio.h>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9031 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-10 18:46:29 +00:00
Misha Brukman
cf00c4ab3b Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9027 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-10 17:57:28 +00:00
Misha Brukman
9c9c90df8f Fixing the spelling of this filename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9009 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-10 16:57:31 +00:00
Chris Lattner
929c6fbcbc Update comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8965 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 16:56:11 +00:00
Chris Lattner
16b18fdc35 Use a set to keep track of which edges have been noticed as executable already
to avoid reprocessing PHI nodes needlessly.  This speeds up the big bad PHI
testcase 43%: from 104.9826 to 73.5157s


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8964 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 16:55:34 +00:00
Chris Lattner
3d405b07b4 Minor fixes here and there
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8963 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 16:21:03 +00:00
Chris Lattner
7d275f459b Avoid building data structures we don't really need. This improves the runtime
of a test that Bill Wendling sent me from 228.5s to 105s.  Obviously there is
more improvement to be had, but this is a nice speedup which should be "felt"
by many programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8962 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-08 15:47:41 +00:00
Chris Lattner
d558dc3464 whoops, don't accidentally lose variable names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8955 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 22:58:41 +00:00
Chris Lattner
6c266db54c Fix bug: InstCombine/cast.ll:test11 / PR#7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8954 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 22:54:13 +00:00
Chris Lattner
a44d8a2897 Refactor code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8952 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 22:32:43 +00:00
Chris Lattner
da78b002ca Fix bugzilla bug #5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8930 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 19:33:31 +00:00
Chris Lattner
ebbc1a5aa0 Bill contributed this major rewrite of the -lowerswitch pass to make it generate
logarithmic conditional branch sequences instead of linear sequences.  Thanks Bill!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8928 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 18:46:23 +00:00
Chris Lattner
6061000b54 Fix bug in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8922 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-07 15:17:02 +00:00
Chris Lattner
4bb7c02eba Minor speedups for the instcombine pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8894 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 17:11:01 +00:00
Chris Lattner
884d6c4e10 Speed up the predicate used to decide when to inline by caching the size
of callees between executions.

On eon, in release mode, this changes the inliner from taking 11.5712s
to taking 2.2066s.  In debug mode, it went from taking 14.4148s to
taking 7.0745s.  In release mode, this is a 24.7% speedup of gccas, in
debug mode, it's a total speedup of 11.7%.

This also makes it slightly more aggressive.  This could be because we
are not judging the size of the functions quite as accurately as before.
When we start looking at the performance of the generated code, this can
be investigated further.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8893 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 15:52:43 +00:00
Chris Lattner
5f92e2b11f Avoid doing pointless work. Amazingly, this makes us go faster.
Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s.

In release mode, it went from taking 25.8741s to taking 11.5712s.

This also fixes a FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8890 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-06 15:23:43 +00:00
Chris Lattner
69091be83b This changes the PromoteMemToReg function to create "pruned" SSA form, not
"minimal" SSA form (in other words, it doesn't insert dead PHIs).  This
speeds up the mem2reg pass very significantly because it doesn't have to
do a lot of frivolous work in many common cases.

In the 252.eon function I have been playing with, this doesn't even insert
the 120 PHI nodes that it used to which were trivially dead (in the process
of promoting 356 alloca instructions overall).  This speeds up the mem2reg
pass from 1.2459s to 0.1284s.  More significantly, the DCE pass used to take
2.4138s to remove the 120 dead PHI nodes that mem2reg constructed, now it
takes 0.0134s (which is the time to scan the function and decide that there
is nothing dead).  So overall, on this one function, we speed things up a
total of 3.5179s, which is a 24.8x speedup!  :)

This change is tested by the Mem2Reg/2003-10-05-DeadPHIInsertion.ll test,
which now passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8884 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 22:19:20 +00:00
Chris Lattner
43f820d1f7 Change the interface to PromoteMemToReg to also take a DominatorTree
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8883 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 21:20:13 +00:00
Chris Lattner
24011be956 Speed up the mem2reg transform for allocas which are only read/written in a single
basic block.  This is amazingly common in code generated by the C/C++ front-ends.
This change makes it not have to insert ANY phi nodes, whereas before it would insert
a ton of dead ones which DCE would have to clean up.

Thus, this fix improves compile-time performance of these trivial allocas in two ways:
  1. It doesn't have to do the walking and book-keeping for renaming
  2. It does not insert dead phi nodes for them which would have to
     subsequently be cleaned up.

On my favorite testcase from 252.eon, this special case handles 305 out of
356 promoted allocas in the function.  It speeds up the mem2reg pass from 7.5256s
to 1.2505s.  It inserts 677 fewer dead PHI nodes, which speeds up a subsequent
-dce pass from 18.7524s to 2.4806s.

There are still 120 trivially dead PHI nodes being inserted for variables used
in multiple basic blocks, but they are not handled by this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8881 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 20:54:03 +00:00
Chris Lattner
86e4445ec3 Initial checkin of the LLVM->LLVM transform to support code generators which
do not support stack unwinding yet


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8869 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 19:14:42 +00:00
Chris Lattner
b55803a9f4 simplify-cfg is really a function pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8868 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 19:14:16 +00:00
Chris Lattner
92e4975af4 The first PHI node may be null, scan for the first non-null one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8865 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 05:34:39 +00:00
Chris Lattner
3c881cb4ce The VersionNumbers vector is only used during PHI placement. Turn it into an argument, allowing us to get rid of the vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8864 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 04:33:22 +00:00
Chris Lattner
afa060ea3f * Update file header comment
*** Revamp the code which handled unreachable code in the function.  Now the
    code is much more efficient for high-degree basic blocks, such as those
    that occur in the 252.eon SPEC benchmark.

For the interested, the time to promote a SINGLE alloca in _ZN7mrScene4ReadERSi
function used to be > 3.5s.  Now it is < .075s.  The function has a LOT of
allocas in it, so it appeared to be infinite looping, this should make it much
nicer.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8863 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 04:26:39 +00:00
Chris Lattner
521c16aadd Simplify the loop a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8862 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:45:44 +00:00
Chris Lattner
92581c24a3 There is no need for separate WriteSets and PhiNodeBlocks lists. It is just a
work-list of value definitions.  This allows elimination of the explicit
'iterative' step of the algorithm, and also reuses temporary memory better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8861 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:39:10 +00:00
Chris Lattner
036f1e7478 The PhiNodes 2D vector is only used during PHI node placement. It doesn't
need to be an instance variable!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8860 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:26:25 +00:00
Chris Lattner
9e38fbf57f * Document instance vars better
* Fuse two parallel loops
* Use a more specific type for AllocaLookup


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8859 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 03:16:07 +00:00
Chris Lattner
9157f041ab Two small cleanups/speedups:
* Do not insert a new entry into NewPhiNodes during the rename pass if there are no PHIs in a block.
 * Do not compute WriteSets in parallel


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8858 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 02:37:36 +00:00
Chris Lattner
0fa157127f * Minor cleanups
* Eliminate the KillList instance variable, instead, just delete loads and
  stores as they are "renamed", and delete allocas when they are done
* Make the 'visited' set an instance variable to avoid passing it on the stack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8857 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-05 01:52:53 +00:00
Chris Lattner
6b032052cc Implement InstCombine/add.ll:test17 & 18
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8817 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-02 15:11:26 +00:00
Chris Lattner
23ed9c1c97 Use global *_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8703 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:07:33 +00:00
Chris Lattner
f8b5b6ddb4 Do not use BasicBlock::*_iterator, just use *_iterator itself.
Isn't updating copy and pasted code a joy


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8702 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-24 22:06:25 +00:00
Chris Lattner
332ae7f501 Fix bug: IndVarsSimplify/2003-09-23-NotAtTop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8689 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-23 20:26:48 +00:00
Chris Lattner
dd7036d19a Fix bugs in the last change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8667 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 23:30:59 +00:00
Chris Lattner
f98a084908 Fix bug: Inline/2003-09-22-PHINodesInNormalInvokeDest.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8666 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 22:35:39 +00:00
Chris Lattner
51d6816089 Fix bug: Inline/2003-09-22-PHINodesInExceptionDest.ll
... by making sure to update PHI nodes to take into consideration the
extra edges we get if we inline a call instruction through an invoke.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8664 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 21:59:27 +00:00
Misha Brukman
22b9aab760 Credits now go into the top-level CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8662 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 21:57:56 +00:00
Misha Brukman
763f5ae902 Credits are now in top-level CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8661 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 21:57:15 +00:00
Chris Lattner
021c190f8d Squelch warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8659 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 20:33:34 +00:00
Chris Lattner
a2d51afd79 Global variables with APPENDING linkage are very important to keep around!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8632 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 19:00:50 +00:00
Chris Lattner
02a3be020a Rename Function::getEntryNode -> getEntryBlock
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8625 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 14:39:18 +00:00
Chris Lattner
ab4536e353 Minor cleanups, no functional changes
Rename Function::getEntryNode -> getEntryBlock


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8623 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 14:36:23 +00:00
Chris Lattner
d452ebd0bf Fix a really obvious huge gaping bug, add a comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8620 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 05:24:00 +00:00
Chris Lattner
3fc6ef1bb9 Expose the TCE pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8619 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 05:14:13 +00:00
Chris Lattner
2240d2b3f7 New transformation: tail recursion elimination
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8618 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-20 05:03:31 +00:00
Chris Lattner
62a355cc6e Implement InstCombine/and.ll:test(15|16)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8607 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-19 19:05:02 +00:00
Chris Lattner
bd7b5fff82 pull a large nested conditional out into its own function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8605 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-19 17:17:26 +00:00
Chris Lattner
9d5890d435 Implement InstCombine/add.ll:test(15|16)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8604 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-19 15:35:42 +00:00
Chris Lattner
cc838348fc Fix bug raising allocations whose call sites were invoke instructions.
Thanks to brg for tracking down the problem so precisely!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8568 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-16 19:42:21 +00:00
Chris Lattner
1cbcd0fd48 This is effectively a complete rewrite of the globaldce algorithm, resulting
in it being both shorter and more effective.  It no longer depends on the
callgraph, so one FIXME has been fixed.

Additionally, this pass was not able to delete recursive (but dead) functions
if they were pointed to by global variables which were also dead.  In fact
this pass had a lot of problems deleting functions which were only pointed
to by dead globals and other stuff.

Fixing this means that the entire EH library should be stripped away now from
programs that don't use sjlj or exceptions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8567 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-16 19:27:31 +00:00
Chris Lattner
77b398cd5f Minor cleanups, give credit, remove code that should not be necessary, and
was a "major hack"  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8524 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 05:43:05 +00:00
Chris Lattner
6420f1cd50 Initial checkin of the Setjmp/Longjmp lowering/transformation pass,
contributed by the masterful Bill Wendling!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8520 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 04:56:27 +00:00
Chris Lattner
c9d3e5721b Ugh, a bug fix needed because of the bug in the CallGraph code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8519 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 04:52:00 +00:00
Chris Lattner
ad9b5f31ea Fix bug: PruneEH/2003-09-14-ExternalCall.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8516 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 02:22:50 +00:00
Chris Lattner
e07007c2bd Fix bug: Inline/2003-09-14-InlineValue.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8514 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-15 02:10:16 +00:00
Chris Lattner
a497748fb1 Make sure to cannonicalize loops before running indvar simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8502 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-12 16:45:01 +00:00
Chris Lattner
8fce16ef1a Do not return success after checking only the FIRST USE of a gep instruction.
Instead, check all uses.
This fixes bug: ScalarRepl/2003-09-12-IncorrectPromote.ll
This also fixes the miscompilation of Ptrdist/bc


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8493 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-12 16:02:12 +00:00
Chris Lattner
fe7ea0da17 Minor optimization efficiency improvement:
- Run mem2reg promotion first
  - Only rerun passes if the previous thing changed something


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8490 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-12 15:36:03 +00:00
Chris Lattner
515c97c230 Simplify code
Implement InstCombine/mul.ll:test9


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8488 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 22:24:54 +00:00
Misha Brukman
3cfb6b13c0 Apostrophes are only used for possession and quoting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8473 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 16:58:31 +00:00
Chris Lattner
38aec32560 Integrate functionality of the mem2reg pass directly into this pass to make
the combination more effective


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8471 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 16:45:55 +00:00
Chris Lattner
c444a4228f Renamed DominatorTree::Node::getNode() -> getBlock()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8469 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 16:26:13 +00:00
Misha Brukman
352361b409 Spell `definite' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8467 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 15:32:37 +00:00