Commit Graph

1172 Commits

Author SHA1 Message Date
Chris Lattner a02d5aa6ce Don't mind me, I'm just refactoring away. This patch makes room for LFTR, but
contains no functionality changes.

llvm-svn: 10583
2003-12-22 09:53:29 +00:00
Chris Lattner 6449dcefbc Implement IndVarsSimplify/pointer-indvars.ll, transforming pointer
arithmetic into "array subscripts"

llvm-svn: 10580
2003-12-22 05:02:01 +00:00
Chris Lattner d3678bc7c5 Fix PR194
llvm-svn: 10573
2003-12-22 03:58:44 +00:00
Chris Lattner fc7bdac1b3 Fix ADCE/2003-12-19-MergeReturn.llx
llvm-svn: 10539
2003-12-19 09:08:34 +00:00
Chris Lattner 918460190f Remove the wierd "Operands" loop, by traversing basicblocks in reverse order
llvm-svn: 10536
2003-12-19 08:18:16 +00:00
Chris Lattner 547192d688 Implement LICM/sink_multiple.ll, by sinking all possible instructions in the
loop before hoisting any.

llvm-svn: 10534
2003-12-19 07:22:45 +00:00
Chris Lattner 031a3f8cc7 Generalize a special case to fix PR187
llvm-svn: 10531
2003-12-19 06:27:08 +00:00
Chris Lattner 91daeb5431 Factor code out into the Utils library
llvm-svn: 10530
2003-12-19 05:58:40 +00:00
Chris Lattner 04efa4b155 Add new function
llvm-svn: 10529
2003-12-19 05:56:28 +00:00
John Criswell b22e9b4b35 Reverted back to previous revision - this was previously merged
according to the CVS log messages.

llvm-svn: 10517
2003-12-18 17:19:19 +00:00
John Criswell 86a3a48697 Merged in RELEASE_11.
llvm-svn: 10516
2003-12-18 16:43:17 +00:00
Chris Lattner 9e2b42a0c8 When we delete instructions from the loop, make sure to remove them from the
AliasSetTracker as well.

llvm-svn: 10507
2003-12-18 08:12:32 +00:00
Chris Lattner 6c08bb8b8e Fix for PR185 & IndVarsSimplify/2003-12-15-Crash.llx
llvm-svn: 10473
2003-12-15 17:34:02 +00:00
Chris Lattner 884e824534 Refactor code just a little bit, allowing us to implement TailCallElim/return_constant.ll
llvm-svn: 10467
2003-12-14 23:57:39 +00:00
Chris Lattner d1c371c32c Do not promote volatile alias sets into registers
llvm-svn: 10458
2003-12-14 04:52:31 +00:00
Chris Lattner 34399dda2d Fix LICM/2003-12-11-SinkingToPHI.ll, and quite possibly all of the other known problems in the universe.
llvm-svn: 10409
2003-12-11 22:23:32 +00:00
Chris Lattner 027253b0d5 verifyFunction depends on dominator info, which levelraise does not declare
that it needs.  This is pretty scary code!  This fixes

Regression.Transforms.LevelRaise.2002-07-16-SourceAndDestCrash
Regression.Transforms.LevelRaise.2002-07-31-AssertionFailure

llvm-svn: 10406
2003-12-11 21:47:37 +00:00
Chris Lattner 6281fd3ead Fix bug: LICM/sink_multiple_exits.ll
Thanks for pointing this out John  :)

llvm-svn: 10387
2003-12-10 22:35:56 +00:00
Chris Lattner 55c2113b7b Don't allow dead instructions to stop sinking early.
llvm-svn: 10386
2003-12-10 20:43:29 +00:00
Chris Lattner 713907e2b8 Fix bug: IndVarsSimplify/2003-12-10-RemoveInstrCrash.llx
llvm-svn: 10385
2003-12-10 20:43:04 +00:00
Chris Lattner 7e5bd59da2 Finegrainify namespacification
Fix bug: LowerInvoke/2003-12-10-Crash.llx

llvm-svn: 10382
2003-12-10 20:22:42 +00:00
Chris Lattner ccd9f3c1f8 Finegrainify namespacification
Reorder #includes
Implement: IndVarsSimplify/2003-12-10-IndVarDeadCode.ll

llvm-svn: 10376
2003-12-10 18:06:47 +00:00
Chris Lattner 7710f2f49e Finegrainify namespacification
Fix bug: LoopSimplify/2003-12-10-ExitBlocksProblem.ll

llvm-svn: 10373
2003-12-10 17:20:35 +00:00
Chris Lattner 6364314a6e Simplify code
llvm-svn: 10371
2003-12-10 16:58:24 +00:00
Chris Lattner 48b4b852b4 Avoid performing two identical lookups when one will suffice
llvm-svn: 10370
2003-12-10 16:57:24 +00:00
Chris Lattner edda1af35a Make LICM itself a bit more efficient, and make the generated code more efficient too: don't insert a store in every exit block, because a particular block may be exited to more than once by a loop
llvm-svn: 10369
2003-12-10 15:56:24 +00:00
Chris Lattner aaaea51090 Implement instruction sinking out of loops. This still can do a little bit
better job, but this is the majority of the work.  This implements
LICM/sink*.ll

llvm-svn: 10358
2003-12-10 06:41:05 +00:00
Chris Lattner 6c237bcdf2 Do not insert one entry PHI nodes in split exit blocks!
llvm-svn: 10348
2003-12-09 23:12:55 +00:00
Chris Lattner 65c1193d55 Refactor code a little bit, eliminating the gratuitous InstVisitor, which
should make subsequent changes simpler.  This also allows us to hoist vaarg
and vanext instructions

llvm-svn: 10342
2003-12-09 19:32:44 +00:00
Chris Lattner c05176843e Fine grainify namespacification
Code cleanups
Make LICM::SafeToHoist marginally more efficient

llvm-svn: 10341
2003-12-09 17:18:00 +00:00
Chris Lattner 50663a1a78 Implement: TailCallElim/accum_recursion_constant_arg.ll
Also make sure to clean up any PHI nodes that are inserted which are pointless.

llvm-svn: 10333
2003-12-08 23:37:35 +00:00
Chris Lattner 198e620752 Implement: test/Regression/Transforms/TailCallElim/accum_recursion.ll
We now insert accumulator variables as necessary to eliminate tail recursion
more aggressively.  This is still fairly limited, but allows us to transform
fib/factorial, and other functions into nice happy loops.  :)

llvm-svn: 10332
2003-12-08 23:19:26 +00:00
Chris Lattner a7b6f3ab9c Cleanup and restructure the code to make it easier to read and maintain.
The only functionality change is that we now implement:
  Regression/Transforms/TailCallElim/intervening-inst.ll

Which is really kinda pointless, because it means that trivially dead code
does not interfere with -tce, but trivially dead code probably wouldn't be
around anytime when this pass is run anyway.

The point of including this change it to support other more aggressive
transformations when we have the analysis capabilities to do so.

llvm-svn: 10312
2003-12-08 05:34:54 +00:00
Chris Lattner 771804b541 Implement RaiseAllocations/FreeCastConstantExpr.ll
llvm-svn: 10305
2003-12-07 01:42:08 +00:00
Chris Lattner 8427bffb9a * Finegrainify namespacification
* Transform: free <ty>* (cast <ty2>* X to <ty>*) into free <ty2>* X

llvm-svn: 10303
2003-12-07 01:24:23 +00:00
Chris Lattner 40d2aeb28f Finegrainify namespacification
Fix regressions ScalarRepl/basictest.ll & arraytest.ll

llvm-svn: 10287
2003-12-02 17:43:55 +00:00
Chris Lattner 8384f97ee4 Fix test: Transforms/LevelRaise/2003-11-28-IllegalTypeConversion.ll
Some gep generalization changes

llvm-svn: 10252
2003-11-29 05:31:25 +00:00
Chris Lattner 52310702a1 Do not use index type to determine what it is indexing into!
llvm-svn: 10226
2003-11-25 21:09:18 +00:00
Chris Lattner 28ebb3e0a6 Delete dead line
llvm-svn: 10164
2003-11-22 02:26:17 +00:00
Chris Lattner f40cdbe856 Fix bug: Transforms/PruneEH/2003-11-21-PHIUpdate.llx
llvm-svn: 10163
2003-11-22 02:20:36 +00:00
Chris Lattner 4cc2cc5c58 Do not crash when deleing a region with a dead invoke instruction
llvm-svn: 10161
2003-11-22 02:13:08 +00:00
Chris Lattner 1ad805977d Finegrainify namespacification
The module stripping pass should not strip symbols on external globals

llvm-svn: 10157
2003-11-22 01:29:35 +00:00
Chris Lattner 61b3f20bf1 Considering that CI is not even IN SCOPE here, I wooda thought the compiler
would have caught this.  *sigh*

llvm-svn: 10142
2003-11-21 21:57:29 +00:00
Chris Lattner f52e03c79e Finegrainify namespacification
llvm-svn: 10138
2003-11-21 21:54:22 +00:00
Chris Lattner 456031eed7 Get rid of using decls, finegrainify namespacification
llvm-svn: 10137
2003-11-21 21:52:10 +00:00
Chris Lattner 51c28a5c1b * 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.

llvm-svn: 10136
2003-11-21 21:46:09 +00:00
Chris Lattner a82f131abb Finegrainify namespacification
Print out the costs for functions that AREN'T inlined as well

llvm-svn: 10135
2003-11-21 21:45:31 +00:00
Chris Lattner a29600046d Minor cleanups and simplifications
llvm-svn: 10127
2003-11-21 16:52:05 +00:00
Chris Lattner 8791e26de1 * Finegrainify namespacification
* Implement FuncResolve/2003-11-20-BogusResolveWarning.ll
   ... which eliminates a large number of annoying warnings.  I know misha
   will miss them though!

llvm-svn: 10123
2003-11-20 21:21:31 +00:00
Chris Lattner 2af517281d Start using the nicer terminator auto-insertion API
llvm-svn: 10111
2003-11-20 18:25:24 +00:00
Chris Lattner 63a0ccff44 Spew symbolic types!
llvm-svn: 10110
2003-11-20 18:23:14 +00:00
Chris Lattner 18e5d5228a When spewing out warnings during function resolution, do not vomit out pages
and pages of non-symbolic types.

llvm-svn: 10109
2003-11-20 18:19:35 +00:00
Misha Brukman 4f7ce560d5 This file was somehow missing a top-level comment line.
llvm-svn: 10055
2003-11-17 19:35:17 +00:00
Chris Lattner 841dd53555 Fix PR116
llvm-svn: 10032
2003-11-16 21:39:27 +00:00
Chris Lattner d76fe4ea7d Implement feature: InstCombine/2003-11-13-ConstExprCastCall.ll
llvm-svn: 9981
2003-11-13 19:17:02 +00:00
Brian Gaeke 960707c335 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner 1e6d3053f2 Reorganize code for locality, improve comments
llvm-svn: 9857
2003-11-10 04:42:42 +00:00
Chris Lattner 4474336166 Adjust to new critical edge interface
llvm-svn: 9853
2003-11-10 04:10:50 +00:00
Chris Lattner 984e11792f 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.

llvm-svn: 9828
2003-11-09 05:05:36 +00:00
Chris Lattner d61abe82d3 Untypo
llvm-svn: 9827
2003-11-09 05:04:25 +00:00
Misha Brukman ad03afcb34 Declare FunctionPasses as such so that they can be used in FunctionPassManager.
llvm-svn: 9768
2003-11-07 17:20:18 +00:00
Chris Lattner 38cd27e450 Various cleanups and efficiency improvements
llvm-svn: 9753
2003-11-06 19:46:29 +00:00
Chris Lattner b0a4b49b23 Fix bug: PR93
llvm-svn: 9752
2003-11-06 19:18:49 +00:00
Chris Lattner 4e1b467594 Fix the problem with running cleanups in bugpoint: We were deleting arguments
of intrinsic functions, causing the verifier to fail.

llvm-svn: 9745
2003-11-05 21:53:41 +00:00
Chris Lattner 9e60aced2e Split behavior into two pieces
llvm-svn: 9741
2003-11-05 21:43:02 +00:00
Chris Lattner 8055fb3afa Yet more fixes for constant expr shifts
llvm-svn: 9739
2003-11-05 20:43:58 +00:00
Chris Lattner ba55bd37fe Further fixes for PR93
llvm-svn: 9738
2003-11-05 20:37:01 +00:00
Chris Lattner 7c94d1171a Fix flawed logic that was breaking several SPEC benchmarks, including gzip and crafty.
llvm-svn: 9731
2003-11-05 17:31:36 +00:00
Chris Lattner 813ec04735 Be gcc 3.4 clean
llvm-svn: 9725
2003-11-05 06:12:18 +00:00
Chris Lattner 8f2f598024 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)
llvm-svn: 9715
2003-11-05 01:06:05 +00:00
Chris Lattner e580666532 Minor cleanup, plus implement InstCombine/xor.ll:test17
llvm-svn: 9711
2003-11-04 23:50:51 +00:00
Chris Lattner 0f68fa6569 Implement InstCombine/xor.ll:test(15|16)
llvm-svn: 9708
2003-11-04 23:37:10 +00:00
John Criswell 81587e798a 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.

llvm-svn: 9693
2003-11-04 15:22:26 +00:00
Chris Lattner 6444c37488 Implement InstCombine/cast-set.ll:test6[a]. This improves code generated for
a hot function in em3d

llvm-svn: 9673
2003-11-03 05:17:03 +00:00
Chris Lattner 1693079e92 Implement InstCombine/cast-set.ll: test1, test2, test7
llvm-svn: 9670
2003-11-03 04:25:02 +00:00
Chris Lattner af7893203b Fix bug with zero sized casts
llvm-svn: 9667
2003-11-03 01:29:41 +00:00
Chris Lattner d4d987dd4a Fix bug in previous checkin
llvm-svn: 9656
2003-11-02 06:54:48 +00:00
Chris Lattner f4ad165e8b Implement transmogriphication of allocation instructions
llvm-svn: 9654
2003-11-02 05:57:39 +00:00
Chris Lattner 7f7285bab7 Fix PR78
llvm-svn: 9648
2003-11-02 02:06:27 +00:00
Chris Lattner b45d9077cb Strip off CPR's manually, because if we don't, the inliner doesn't delete dead
functions.  GRR

llvm-svn: 9641
2003-10-31 21:05:58 +00:00
Chris Lattner 686767f3f6 Fix bug: 2003-10-29-CallSiteResolve.ll & PR70
llvm-svn: 9600
2003-10-30 00:46:41 +00:00
Chris Lattner 3420137e63 Refactor code, initial implementation of -insert-block-profiling pass
llvm-svn: 9593
2003-10-29 21:24:22 +00:00
Chris Lattner bcb0f4bf2e Fix PR66 & ScalarRepl/2003-10-29-ArrayProblem.ll
llvm-svn: 9585
2003-10-29 17:55:44 +00:00
Chris Lattner e5f15cdc5f Fix bug: ConstantMerge/2003-10-28-MergeExternalConstants.ll & PR64
llvm-svn: 9579
2003-10-29 06:01:26 +00:00
Chris Lattner 3e5ff2568c Check in statistifying patch for Bill
llvm-svn: 9572
2003-10-28 23:14:59 +00:00
Chris Lattner 183fa7ceb3 Pass in argc & argv
llvm-svn: 9563
2003-10-28 22:42:24 +00:00
Chris Lattner c8ba0672ac 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.

llvm-svn: 9547
2003-10-28 18:59:04 +00:00
Chris Lattner 233989316c Eliminate using declarations
llvm-svn: 9543
2003-10-27 21:44:09 +00:00
Chris Lattner 5e004e8ce0 Propagating constants to arguments can make other arguments constant. For now
do something dumb, and inefficient, but more complete.

llvm-svn: 9542
2003-10-27 21:09:00 +00:00
Chris Lattner b727fb2663 Fix test: Linker/2003-10-27-LinkOncePromote.ll
Fix PR58

llvm-svn: 9530
2003-10-27 16:39:39 +00:00
Chris Lattner d9f4ffdf5e 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

llvm-svn: 9526
2003-10-27 05:33:09 +00:00
Chris Lattner 12b78db685 We might as well strip off any CPRs before propagation
llvm-svn: 9437
2003-10-23 18:49:23 +00:00
Chris Lattner 05c71fb3e6 * We were forgetting to pass varargs arguments through a call
* Add a work around for bug PR56, gross but necessary for now.

llvm-svn: 9428
2003-10-23 17:44:53 +00:00
Chris Lattner f516c698ff Check in initial version of ipcp
llvm-svn: 9423
2003-10-23 16:52:27 +00:00
Chris Lattner 0658cc20bd 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.

llvm-svn: 9398
2003-10-23 03:48:17 +00:00
Chris Lattner 9e8fe49c37 This important patch fixes two warnings in the linker which can occur from linking
valid pieces of code

llvm-svn: 9390
2003-10-22 23:03:38 +00:00
Chris Lattner 6d3425e87a Update the 'used' flag correctly
llvm-svn: 9366
2003-10-22 04:43:18 +00:00
Chris Lattner 12b3593dea Loop over the module, not the symbol table. This makes the code handle
unused external functions again

llvm-svn: 9365
2003-10-22 04:42:20 +00:00
Chris Lattner 4cd99ffa57 Implement FunctionResolve/2003-10-21-GlobalResolveHack.ll
llvm-svn: 9363
2003-10-22 03:35:34 +00:00
Chris Lattner af2c00bf14 Fix bug: FunctionResolve/2003-10-21-GlobalTypeDifference.ll
llvm-svn: 9359
2003-10-21 23:17:56 +00:00