1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

614 Commits

Author SHA1 Message Date
Chris Lattner
4d05134df0 Fix bug with last patch which would occur when a call returned void and we
attempted to assign it a name.

llvm-svn: 3142
2002-07-30 02:42:49 +00:00
Chris Lattner
1980b35509 * Make sure the resolved function call instructions get the name from the
old call instruction
* Implement conversion of return values for calls.  This fixes bug:
   test/Regression/Transforms/FunctionResolve/retmismatch3.ll

llvm-svn: 3140
2002-07-30 00:50:49 +00:00
Chris Lattner
b9052f081a * Fix bug: test/Regression/Transforms/ADCE/2002-07-17-AssertionFailure.ll
which was caused by us not running the "drop references of dead
  instructions" code when there were no basic blocks that were dead.

  We still don't want to do some of the stuff we do if there are dead
  basic blocks, but we DO want to drop references of dead instructions,
  so we factor the common code out to a new method.

llvm-svn: 3137
2002-07-30 00:22:34 +00:00
Chris Lattner
72b8a38a26 Add code to ensure that no PHI nodes are left laying around with their
arguments dropped.  This fixes bug:
   test/Regression/Transforms/ADCE/2002-07-17-PHIAssertion.ll

llvm-svn: 3134
2002-07-29 23:40:46 +00:00
Chris Lattner
078c1024c0 Implement a new RemoveSuccessor function
llvm-svn: 3131
2002-07-29 22:32:08 +00:00
Chris Lattner
5aef91b716 Fix bug: test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll
llvm-svn: 3129
2002-07-29 22:31:39 +00:00
Chris Lattner
2f7ce877c5 Allow folding of basic blocks that have PHI nodes in them, fixing "bug":
test/Regression/Transforms/SimplifyCFG/2002-06-24-PHINode.ll

llvm-svn: 3128
2002-07-29 21:26:30 +00:00
Chris Lattner
ec2780457d * Standardize how analysis results/passes as printed with the print() virtual
methods
* Eliminate AnalysisID:  Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
  the analyses themselves.

llvm-svn: 3116
2002-07-27 01:12:17 +00:00
Chris Lattner
3f47f1065b * Standardize how analysis results/passes as printed with the print() virtual
methods
* Eliminate AnalysisID:  Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
  the analyses themselves.

llvm-svn: 3115
2002-07-27 01:12:15 +00:00
Chris Lattner
7a9eb848cd * Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses

llvm-svn: 3113
2002-07-26 21:12:46 +00:00
Chris Lattner
b934722f1b * Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses

llvm-svn: 3112
2002-07-26 21:12:44 +00:00
Chris Lattner
ec1a192b16 *** empty log message ***
llvm-svn: 3105
2002-07-26 18:40:14 +00:00
Chris Lattner
05fe67c0d2 *** empty log message ***
llvm-svn: 3075
2002-07-25 06:17:51 +00:00
Chris Lattner
0702eb18e6 *** empty log message ***
llvm-svn: 3072
2002-07-24 22:40:39 +00:00
Chris Lattner
4a9e674077 Eliminate several include/llvm/Transforms/IPO/*.h files, moving their contents into IPO.h
llvm-svn: 3043
2002-07-24 17:12:05 +00:00
Chris Lattner
921e366a5c Merge ChangeAllocations into scalar.h
llvm-svn: 3038
2002-07-23 22:04:17 +00:00
Chris Lattner
176a67ce61 Rename header
llvm-svn: 3037
2002-07-23 22:04:02 +00:00
Chris Lattner
46077f4e0f Cleanup and simplify code
llvm-svn: 3036
2002-07-23 22:03:41 +00:00
Chris Lattner
ac78173ee0 Incorporate ConstantMerge.h into IPO.h
llvm-svn: 3035
2002-07-23 19:57:40 +00:00
Chris Lattner
38adabd0a1 Rename LevelChange.h to RaisePointerReferences.h
llvm-svn: 3034
2002-07-23 19:57:08 +00:00
Chris Lattner
c482880f9e *** empty log message ***
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner
606421d005 * Remove getPassName implementation
* Register all Passes

llvm-svn: 3015
2002-07-23 18:06:30 +00:00
Chris Lattner
17d972ce72 * Cleanup the pass a bit more, making it more object oriented.
* Split the two behaviors of the InsertTraceCode class into two subclasses
* Register Passes

llvm-svn: 3014
2002-07-23 18:04:15 +00:00
Chris Lattner
670d7d06fe * Break the two different behaviors of SimpleStructMutation into two subclasses
* Register the passes

llvm-svn: 3013
2002-07-23 18:03:11 +00:00
Chris Lattner
b059058c80 * Make the ctor take a TargetData even though it's not using it yet
* Register the pass

llvm-svn: 3012
2002-07-23 18:02:23 +00:00
Chris Lattner
bdb978fa79 * Remove lots of dead stuff
* Register Pass

llvm-svn: 3011
2002-07-23 18:01:39 +00:00
Chris Lattner
24bcbdd155 *** empty log message ***
llvm-svn: 3002
2002-07-23 17:52:38 +00:00
Chris Lattner
4d05cb01b1 Hide extra argument
llvm-svn: 2986
2002-07-22 02:17:27 +00:00
Chris Lattner
99ad379582 *** empty log message ***
llvm-svn: 2985
2002-07-22 02:10:13 +00:00
Anand Shukla
60f4c16199 comeented out debug printing
llvm-svn: 2980
2002-07-21 09:41:18 +00:00
Anand Shukla
4c822342bf minor corrections
llvm-svn: 2971
2002-07-18 20:56:47 +00:00
Chris Lattner
c459d57fe3 Seperate stats for DCE'd functions and vars
llvm-svn: 2961
2002-07-18 06:40:04 +00:00
Chris Lattner
13b8b7c8fe *** empty log message ***
llvm-svn: 2959
2002-07-18 04:43:20 +00:00
Chris Lattner
1abd637044 Only functions with external linkage can be resolved to function declarations.
This change fixes programs that have multiple functions named the same thing,
where are least one of them is static/internal.

llvm-svn: 2954
2002-07-18 03:01:24 +00:00
Chris Lattner
d703fa0041 * Rewrite loop to be slightly more efficient (arguably)
* Fix a MAJOR thinko that was causing bad links to happen on Spec

llvm-svn: 2953
2002-07-18 02:31:03 +00:00
Chris Lattner
3710b0d6d1 * Correctly get prototype for void*malloc(size_t)
llvm-svn: 2951
2002-07-18 00:18:01 +00:00
Chris Lattner
b121676038 Implement linking of ConstExprs
llvm-svn: 2946
2002-07-18 00:13:08 +00:00
Chris Lattner
d842f9ff2d Anand forgot to check in the makefile corresponding to his previous change
which eliminated the EmitFunctions directory

llvm-svn: 2937
2002-07-17 17:13:01 +00:00
Chris Lattner
20c6eeb1e2 * Remove dead code from ExprTypeConvert.cpp
- I->use_empty() can never be true because of the IHolder's
* Fix bug: test/Regression/Transforms/LevelRaise/2002-07-16-SourceAndDestCrash.ll
   - Add a new NewCasts member to VMC to keep track of casts that have been
     created and to ensure there is always a reference to the cast.
   - Extend ValueHandle a bit so it can be used in an STL container
   - Make sure we destroy the ValueMapCache before verifying the function
     in LevelRaise.cpp

llvm-svn: 2936
2002-07-17 17:11:33 +00:00
Chris Lattner
85a9f9c4b3 * Add a bunch of debugging features to LevelRaise
- Verify the function every time it is exprconverted if DEBUG is on
  - Provide a way to start exprconversion AT a specific instruction.

llvm-svn: 2934
2002-07-16 23:49:24 +00:00
Chris Lattner
ee9a9d8017 Avoid !sized assertion failure if Ty is not a sized type
llvm-svn: 2933
2002-07-16 22:29:37 +00:00
Chris Lattner
a221573dba Fix bug: test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash2.ll
llvm-svn: 2932
2002-07-16 21:41:31 +00:00
Anand Shukla
4bb7a17266 Moved over EmitFunctions to this library
llvm-svn: 2928
2002-07-16 18:58:08 +00:00
Anand Shukla
4da4e0ba0a removed this directory
llvm-svn: 2927
2002-07-16 18:56:29 +00:00
Anand Shukla
03970aa8bf Moved EmitFunctions.cpp up to instrumentation directory
llvm-svn: 2926
2002-07-16 18:55:55 +00:00
Chris Lattner
22958b2e75 Bugfix to previous checkin
llvm-svn: 2924
2002-07-16 18:12:55 +00:00
Chris Lattner
0be1cc0f00 * Cleanup pass
* The global variable cannot be internal or else we cannot use it!
* Always add a function to the table, even if it only has a single basic
  block.

llvm-svn: 2921
2002-07-16 17:42:54 +00:00
Chris Lattner
43cfac7e68 * Add assertion to ExprTypeConvert to detect error earlier than without it
* Fix bug in LevelRaise.cpp, correcting this problem:
    test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll

llvm-svn: 2920
2002-07-16 17:33:13 +00:00
Anand Shukla
a10f139779 Added EmitFunctions directory
llvm-svn: 2883
2002-07-12 20:12:07 +00:00
Anand Shukla
d4dae682bc Initial makefile
llvm-svn: 2882
2002-07-12 20:11:24 +00:00
Anand Shukla
edba9ad8a9 Initial version: adds a function table to output code
llvm-svn: 2881
2002-07-12 20:10:50 +00:00
Chris Lattner
83577a047e Disable folding g-e-p instructions into loads and stores.
llvm-svn: 2870
2002-07-10 22:37:17 +00:00
Chris Lattner
a6842aa353 Disable pool allocation stuff until data structure analysis is sorted back out
llvm-svn: 2869
2002-07-10 22:36:47 +00:00
Vikram S. Adve
c98bc8cd5e Fix iteration and InsertPos bugs introduced when Chris changed over to ilist.
llvm-svn: 2840
2002-07-08 23:37:07 +00:00
Anand Shukla
43bbde3f76 changes BBsorting and oredering
llvm-svn: 2817
2002-07-08 19:37:06 +00:00
Anand Shukla
9d38b4b511 small corrections
llvm-svn: 2816
2002-07-08 19:36:39 +00:00
Anand Shukla
a5c08b7973 changed function numbering
llvm-svn: 2815
2002-07-08 19:36:01 +00:00
Chris Lattner
a590093513 *** empty log message ***
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Chris Lattner
63f4011a0c Clean up anands patch
llvm-svn: 2812
2002-06-30 16:25:21 +00:00
Anand Shukla
3ab9ffd5b1 changes to make it compatible with 64bit gcc
llvm-svn: 2795
2002-06-25 21:18:19 +00:00
Anand Shukla
25f890e009 additions and bug fixes
llvm-svn: 2794
2002-06-25 21:14:58 +00:00
Anand Shukla
0908af95f6 added include<iostream> for cerr
llvm-svn: 2793
2002-06-25 21:12:25 +00:00
Anand Shukla
85065832f1 changes to make it compatible with 64bit gcc
llvm-svn: 2792
2002-06-25 21:07:58 +00:00
Anand Shukla
ee7ed50bb4 changes to make it compatible with 64bit gcc
llvm-svn: 2791
2002-06-25 20:55:50 +00:00
Chris Lattner
dfd421a7df MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2779
2002-06-25 16:13:24 +00:00
Chris Lattner
d7cbd7d5d2 MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2778
2002-06-25 16:13:21 +00:00
Chris Lattner
cee706572b *** empty log message ***
llvm-svn: 2777
2002-06-25 16:12:52 +00:00
Chris Lattner
8e1476c302 Remove DynamicConstantMerge pass, because it did not fit in with the Pass
system correctly.

llvm-svn: 2772
2002-06-25 15:55:29 +00:00
Chris Lattner
ef6daeb534 Remove "fixers" for problems in GCC generated code that cannot be generated
anymore.

llvm-svn: 2771
2002-06-25 15:55:03 +00:00
Anand Shukla
92dcd43312 Relocating Graph.h
llvm-svn: 2770
2002-06-25 14:28:55 +00:00
Chris Lattner
779f966ce5 Avoid deleting individual instructions until AFTER dead blocks have dropped
their references.  This fixes bug:
    test/Regression/Transforms/ADCE/2002-05-28-Crash*.ll

llvm-svn: 2753
2002-05-28 21:38:16 +00:00
Chris Lattner
b95dde758a Simplify the interface to local DCE and Constant prop
llvm-svn: 2749
2002-05-26 20:18:18 +00:00
Chris Lattner
3611a1e91c Do not remove type names that contain a .
llvm-svn: 2747
2002-05-26 20:17:35 +00:00
Chris Lattner
d98e784be4 Fix "unimplemented features":
test/Regression/Transforms/FunctionResolve/retmismatch[12].ll

This makes it much more useful for running benchmarks that are missing
prototypes for some functions.

llvm-svn: 2745
2002-05-24 21:33:26 +00:00
Chris Lattner
5dc1524174 Split the FunctionResolution pass out of CleanGCCOutput.cpp.
llvm-svn: 2742
2002-05-24 20:42:13 +00:00
Chris Lattner
4c766269b7 Fix comments to reflect reality
llvm-svn: 2741
2002-05-24 20:41:51 +00:00
Chris Lattner
e69803b06f Support programs that do not #include <malloc.h> or give a full prototype
for malloc and free.  Lots of crufty benchmarks are using stuff like:
char *malloc();
void free();

to forward declare malloc and free.  Now we recognize and raise these forms

llvm-svn: 2740
2002-05-24 20:29:18 +00:00
Chris Lattner
9dde5c9df7 Fold add X, 0 for floating point types as well
llvm-svn: 2734
2002-05-23 17:11:38 +00:00
Chris Lattner
76bf940554 Convert code to use the DEBUG macro so that debug code can simply be
enabled with the -debug command line option.

llvm-svn: 2721
2002-05-22 21:56:32 +00:00
Chris Lattner
1f66858791 Fix and implement ADCE to finally work!
llvm-svn: 2720
2002-05-22 21:32:16 +00:00
Chris Lattner
d406cb7c9d Convert transforms over to standardize debugging output on -debug option
llvm-svn: 2714
2002-05-22 17:27:12 +00:00
Chris Lattner
1f2723a2c9 Use the new DEBUG(x) macro to allow debugging code to be enabled on the commandline
llvm-svn: 2713
2002-05-22 17:17:27 +00:00
Chris Lattner
245c8615e4 Fix bug: test/Regression/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
Improperly handling edges... by not marking them alive properly

llvm-svn: 2707
2002-05-22 16:07:20 +00:00
Chris Lattner
e7ce749d63 Add implementation of SimplifyCFG
llvm-svn: 2701
2002-05-21 20:50:24 +00:00
Chris Lattner
bb7416fa7f New CFG Simplification pass: removed from the old DCE pass
llvm-svn: 2700
2002-05-21 20:49:37 +00:00
Chris Lattner
4b29ff417d Simplify interface to ConstantFoldTerminator
llvm-svn: 2697
2002-05-21 20:04:50 +00:00
Chris Lattner
c7e2f5bbd7 * Change commandline options a bit to be nicer
* Insert accurate prototypes for functions
* Insert casts to use accurate prototypes

llvm-svn: 2677
2002-05-20 21:43:59 +00:00
Chris Lattner
c3d944c4f7 Fix bug: test/Regression/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll
That was causing a miscompilation of strtol/atoi plus others

llvm-svn: 2669
2002-05-20 20:48:03 +00:00
Vikram S. Adve
c0db1765f4 Hash pointer values to a sequence number to get identical results from
lli and llc.  This is controlled with options -tracehash on|off.

Also, added an option to specify which functions should be traced.
Particularly useful to reduce output volume in basic-block tracing.

llvm-svn: 2646
2002-05-19 15:39:02 +00:00
Chris Lattner
a524df6d1d * Make debug output conditional on #define
* Add optimization to rank computation to not recursively search when
  unneccesary.
* More agressively negate expressions to open reassociation opportunities.
* Linearize (A+B)+(C+D) into ((A+B)+C)+D

llvm-svn: 2637
2002-05-16 04:37:07 +00:00
Chris Lattner
fc21b26332 * Fix bug: test/Regression/Transforms/GCSE/2002-05-14-OperandSwap.ll
By making sure to consider binary expressions identical if their operands
are backwards, but swappable.

llvm-svn: 2629
2002-05-14 19:57:25 +00:00
Chris Lattner
8106c7a841 Fix bug: test/Regression/Transforms/InstCombine/2002-05-14-SubFailure.ll
llvm-svn: 2627
2002-05-14 16:44:07 +00:00
Chris Lattner
0ee0c26f4e Fix bug: test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll
"This testcase caused instcombine to fail because it got the same instruction on
it's worklist more than once (which is ok), but then deleted the instruction.
Since the inst stayed on the worklist, as soon as it came back up to be
processed, bad things happened, and opt asserted."

llvm-svn: 2623
2002-05-14 15:24:07 +00:00
Chris Lattner
f98fefc1ea Fix a major source of "type unsafety", where a cast is neccesary, but can
be put either before or after a load.  We chose to cast the value loaded
instead of the pointer to load from.

Fixes bug: test/Regression/Transforms/LevelRaise/2002-05-10-LoadPeephole.ll

llvm-svn: 2621
2002-05-14 05:23:45 +00:00
Chris Lattner
b7688286c1 Implement elimination of loads
llvm-svn: 2620
2002-05-14 05:02:40 +00:00
Chris Lattner
fc14cb90a2 Trivial cleanups
llvm-svn: 2617
2002-05-13 22:04:46 +00:00
Chris Lattner
1b769f2a94 Initial checkin of LICM pass
llvm-svn: 2615
2002-05-10 22:44:58 +00:00
Chris Lattner
adba963886 Add support for printing out statistics information when -stats is added to
the command line

llvm-svn: 2601
2002-05-10 15:38:35 +00:00
Chris Lattner
1bf8912c74 Fix some bugs, straighten stuff out, more work needs to be done.
llvm-svn: 2600
2002-05-10 15:37:35 +00:00
Chris Lattner
0671b3db5d * Add support for the -stats command line option to report how much is changed
* Make cast-of-self-ty DCE the dead cast instruction immediately instead of
  waiting for it to be DCE'd by another sweep over the function.  This speeds
  this up noticably.

llvm-svn: 2597
2002-05-10 15:29:25 +00:00
Chris Lattner
2d91be1ab7 Initial checkin of the PiNodeInsertion pass
llvm-svn: 2593
2002-05-10 05:41:34 +00:00
Chris Lattner
cd326f096f Handle setcc <global*>, 0 instructions, Global pointers are never null!
llvm-svn: 2582
2002-05-09 20:11:54 +00:00
Chris Lattner
9de1aeb91c Give the longer name to the instruction that will probably be eliminated later
llvm-svn: 2581
2002-05-09 20:11:23 +00:00
Chris Lattner
172488eb68 Add ability to transform (x - (y - z)) into (x + (z - y))
llvm-svn: 2566
2002-05-09 01:29:19 +00:00
Chris Lattner
34d5891f0a * Combine: A-(-B) -> A + B
* Bugfix:  A + -B and -A + B

llvm-svn: 2561
2002-05-08 22:46:53 +00:00
Chris Lattner
c38d2de2b5 Initial checkin of expression reassociation pass
llvm-svn: 2559
2002-05-08 22:19:27 +00:00
Chris Lattner
ce6632281f Give the unified exit node a name
llvm-svn: 2550
2002-05-07 22:14:45 +00:00
Chris Lattner
bbd8a94a9b Fix bug: test/Regression/Transforms/ADCE/2002-01-31-UseStuckAround.ll
Cleanup code a lot

llvm-svn: 2547
2002-05-07 22:11:39 +00:00
Chris Lattner
2a43c7c03d Merge all individual .h files into a single Scalar.h file
llvm-svn: 2537
2002-05-07 20:03:00 +00:00
Chris Lattner
e615c275c5 This doesn't use DCE!
llvm-svn: 2536
2002-05-07 20:02:44 +00:00
Chris Lattner
f7806b0212 Move UnifyFunctionExitNodes to Utils library: final resting place this time
llvm-svn: 2531
2002-05-07 19:18:48 +00:00
Chris Lattner
276dd3d721 fix comments and documentation in file
llvm-svn: 2530
2002-05-07 19:04:39 +00:00
Chris Lattner
e125e808a8 Split ChangeAllocations.cpp into Raise & LowerAllocations.cpp
llvm-svn: 2529
2002-05-07 19:02:48 +00:00
Chris Lattner
6ccbd5804a Cleanup implementation a bit
llvm-svn: 2526
2002-05-07 18:51:25 +00:00
Chris Lattner
9e1c79995e Updates to move some header files out of include/llvm/Transforms into
the Scalar and Utils subdirectories

llvm-svn: 2523
2002-05-07 18:36:35 +00:00
Chris Lattner
c5a6d978b8 Reduce dependance on TransformInternals.h, instead using the TransformUtils library
llvm-svn: 2518
2002-05-07 18:12:18 +00:00
Chris Lattner
a35a291f7b Add #include no longer included by llvm/Transforms/Scalar/ConstantProp.h
llvm-svn: 2517
2002-05-07 18:11:30 +00:00
Chris Lattner
c099f62190 Factor code out to the TransformUtils library
llvm-svn: 2516
2002-05-07 18:10:55 +00:00
Chris Lattner
7b20305ef9 Factor code out of TransformInternals into the Transform Utils library
llvm-svn: 2515
2002-05-07 18:09:15 +00:00
Chris Lattner
e817245564 Build Transforms Utils library
llvm-svn: 2514
2002-05-07 18:08:50 +00:00
Chris Lattner
d5477af051 Add code pulled out of TransformInternals.cpp, ConstProp.cpp, and DCE.cpp
llvm-svn: 2513
2002-05-07 18:07:59 +00:00
Chris Lattner
394781b660 * Convert InstWorkList to vector instead of set, because on big programs it
is empirically faster by a noticable margin, even though duplicates can
  happen.

llvm-svn: 2511
2002-05-07 04:29:32 +00:00
Chris Lattner
4a830e1a4a * Remove all cfg simplification stuff for a new cfg simplify pass (todo)
* Convert to worklist instead of iterative algorithm

llvm-svn: 2510
2002-05-07 04:24:11 +00:00
Chris Lattner
ca538273d4 Only do masking for unsigned values!
llvm-svn: 2504
2002-05-06 18:54:59 +00:00
Chris Lattner
66ff017174 * Eliminate dead code that should have been removed in last revision
* Convert main constant propogation pass to be worklist driven instead of
  iterative.
* -constprop pass no longer "constant propogates" terminator instructions
   - CFG is now preserved!

llvm-svn: 2502
2002-05-06 18:21:31 +00:00
Chris Lattner
24ebec1273 Handle X = phi Y --> X = Y
llvm-svn: 2501
2002-05-06 18:06:38 +00:00
Chris Lattner
910ca80941 * Use simplified interface to constant propogation stuff.
* Remove dead PHI case (which could not work due to getNumOperands rather than
  getNumIncomingValues.  This really belongs in InstCombine, anyway so we'll
  move it there.

llvm-svn: 2497
2002-05-06 17:54:10 +00:00
Chris Lattner
b40c1bf6f7 Clean up ADCE by removing extraneous wrapper class
llvm-svn: 2494
2002-05-06 17:27:57 +00:00
Chris Lattner
c5279917bc Combine not (not X) -> X
llvm-svn: 2493
2002-05-06 17:03:21 +00:00
Chris Lattner
24a94a50d8 Support more cases...
llvm-svn: 2490
2002-05-06 16:49:18 +00:00
Chris Lattner
24ebdf3f74 Add many more instruction combination simplifications
llvm-svn: 2484
2002-05-06 16:14:14 +00:00
Chris Lattner
ef7f8fc474 Merge blocks like this:
void "test3"(bool %T) {
        br bool %T, label %BB1, label %BB1
BB1:
        ret void
}

llvm-svn: 2472
2002-05-06 03:02:02 +00:00
Chris Lattner
d12eac0b1b Implement constant propogation of shift instructions
llvm-svn: 2471
2002-05-06 03:01:37 +00:00
Chris Lattner
9606fd4830 Ok, really it only takes me 3 times to get this right!
Now use #if 0 instead of #ifdef 0

llvm-svn: 2448
2002-05-02 21:49:50 +00:00
Chris Lattner
de442f70ac Oops, disable debugging code all the way. :)
llvm-svn: 2447
2002-05-02 21:47:40 +00:00
Chris Lattner
7d4f3ed1f2 * Finish the implementation of isEdgeFeasible this fixes bug:
test/Regression/Transforms/SCCP/2002-05-02-EdgeFailure.ll
* SCCP now preserves the CFG:  It leaves conditional branches the way they
  are in the program, not simplifying them.  A seperate pass should eliminate
  the potentially dead basic blocks and edges in the CFG.

llvm-svn: 2446
2002-05-02 21:44:00 +00:00
Chris Lattner
b30088a50d * Enable SCCP debugging to be turned on with a simple change of #define
* Change worklist to a set so that duplicates cannot happen
* Add support for the invoke instruction
* Avoid marking store and free instructions as overdefined, since they
  cannot produce a value anyway.
* Inline the OperandChangedState implementation
* Add isEdgeFeasible in preparation to fix a bug.  Right now it behaves
  exactly as before.
* Remove obsolete comment about constant pools

llvm-svn: 2445
2002-05-02 21:18:01 +00:00
Chris Lattner
28a8acc476 * Simplify the code by not bothering to name the folded constant
* Do not skip the instruction immediately after a folded instruction.  This
  was causing the testcase failure:
	test/Regression/Transforms/SCCP/2002-05-02-MissSecondInst.ll

llvm-svn: 2443
2002-05-02 20:32:51 +00:00
Chris Lattner
6212dd5c08 ExprTypeConvert will already do this transformation, no need to specialize
it here.

llvm-svn: 2431
2002-05-02 17:38:55 +00:00
Chris Lattner
2c44e5bca3 Be a little more efficient, do not generate loads and stores with indices in them.
llvm-svn: 2430
2002-05-02 17:38:14 +00:00
Chris Lattner
66f5b12141 Fix bug: test/Regression/Transforms/LevelRaise/2002-05-02-BadCastElimination.ll
llvm-svn: 2429
2002-05-02 17:37:34 +00:00
Chris Lattner
b7df910c1a * Add ability to eliminate a bunch of different cascading cast variations
* Allow elimination of getelementptr X, uint 0 (which is a noop)

llvm-svn: 2428
2002-05-02 17:06:02 +00:00
Chris Lattner
8a6104c3cb Fixed bug: test/Regression/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
llvm-svn: 2423
2002-05-01 15:38:23 +00:00
Chris Lattner
5879b0928b Remove unneccesary pass
llvm-svn: 2420
2002-04-30 20:52:49 +00:00
Chris Lattner
a6cb49c533 Add folding rules for mul X, 0 and mul X, 2
llvm-svn: 2417
2002-04-29 22:24:47 +00:00
Chris Lattner
5d1ac4dbc9 Significantly clean up SCCP pass. Now the two classes are merged and in
an anonymous namespace where they belong.

llvm-svn: 2415
2002-04-29 21:26:08 +00:00
Chris Lattner
48e73edf57 Range insertion now returns an iterator
llvm-svn: 2414
2002-04-29 21:25:34 +00:00
Chris Lattner
5d17e49ad5 Remove unused files: This is the old induction varaible cannonicalization
pass built on top of interval analysis

llvm-svn: 2411
2002-04-29 20:18:00 +00:00
Chris Lattner
4968cc38aa Fix for problem when allocating something like this:
malloc(100-i);

llvm-svn: 2409
2002-04-29 20:09:21 +00:00
Chris Lattner
f5d07697e6 changes because iMemory.h no longer #includes DerivedTypes.h
This only requires Type.h anyway

llvm-svn: 2405
2002-04-29 18:48:30 +00:00
Chris Lattner
cfc512e714 Eliminate dead global variables
llvm-svn: 2400
2002-04-29 18:13:11 +00:00
Chris Lattner
96e0c48175 Eliminate duplicate or unneccesary #include's
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner
3909059b6a Remove broken assertion.
llvm-svn: 2396
2002-04-29 16:20:25 +00:00
Chris Lattner
589debc4ba Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.

llvm-svn: 2395
2002-04-29 14:57:45 +00:00
Chris Lattner
56828a18c4 More cleanups
llvm-svn: 2392
2002-04-29 01:58:47 +00:00
Chris Lattner
a8688d69c5 Code cleanups
llvm-svn: 2391
2002-04-29 01:22:55 +00:00
Chris Lattner
ec70d92221 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
llvm-svn: 2386
2002-04-28 21:27:06 +00:00
Chris Lattner
321a8cf4ba Split ConstantVals.h into Constant.h and Constants.h
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner
50a089867d Eliminate the PromoteInstance class, incorporating it into the PromotePass
class.

llvm-svn: 2375
2002-04-28 19:12:38 +00:00
Chris Lattner
b8ade8715e Eliminate visited, CurrentValue, and WriteSets as instance variables of
PromoteInstance.  Make them local variables that are passed around as
appropriate.  Especially in the case of CurrentValue, this makes the
code simpler.

llvm-svn: 2374
2002-04-28 18:54:01 +00:00
Chris Lattner
1d9e63dca0 * Fix bug: test/Regression/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll
* Minor cleanup that was missed in last patch

llvm-svn: 2373
2002-04-28 18:39:46 +00:00
Chris Lattner
246083577b This huge changeset is a strictly cleanup change
Bugfixes will come in the next revision so that the diff is obvious.

llvm-svn: 2372
2002-04-28 18:27:55 +00:00
Chris Lattner
07fe96ca98 Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
to the global namespace

llvm-svn: 2370
2002-04-28 16:21:30 +00:00
Chris Lattner
e5d8bd9baf Be careful not to make "external" function internal
llvm-svn: 2363
2002-04-28 05:48:34 +00:00
Chris Lattner
23e713d49d Initial checkin of new "Internalize" pass for GCCLD
llvm-svn: 2362
2002-04-28 05:43:27 +00:00
Chris Lattner
0bd57e6e99 Initial checkin of simple&fast SSA based GCSE algorithm
llvm-svn: 2338
2002-04-28 00:47:11 +00:00
Chris Lattner
741453dd60 Change the Dominator info and LoopInfo classes to keep track of BasicBlock's, not
const BasicBlocks

llvm-svn: 2337
2002-04-28 00:15:57 +00:00
Chris Lattner
2f0ee1833d s/Method/Function
llvm-svn: 2336
2002-04-27 07:27:19 +00:00
Chris Lattner
536cf1b13f * Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
  - Method is now const
  - It now takes one AnalysisUsage object to fill in instead of 3 vectors
    to fill in
  - Pass's now specify which other passes they _preserve_ not which ones
    they modify (be conservative!)
  - A pass can specify that it preserves all analyses (because it never
    modifies the underlying program)
* s/Method/Function/g in other random places as well

llvm-svn: 2333
2002-04-27 06:56:12 +00:00
Chris Lattner
0c04e4d1ef Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null.

llvm-svn: 2332
2002-04-27 03:15:45 +00:00
Chris Lattner
1e7147c9e9 * Change Constant::getNullConstant to Constant::getNullValue
* Add support for pool allocating array allocations of varying size

llvm-svn: 2329
2002-04-27 02:29:32 +00:00
Chris Lattner
078d292f4c Change Constant::getNullConstant to Constant::getNullValue
llvm-svn: 2323
2002-04-27 02:25:14 +00:00
Chris Lattner
039edb92f3 Programs that actually free memory were broken
llvm-svn: 2307
2002-04-18 22:11:30 +00:00
Chris Lattner
8e2b6edf87 Add a fixme so that we don't forget this is broken.
llvm-svn: 2298
2002-04-18 18:52:03 +00:00
Chris Lattner
a392a80a60 Significantly rework InstructionCombining to work better and to be cleaner.
We now use an InstVisitor to delegate to different cases that we are
interested in handling.  We also fix the FIXME's by adding users to the
worklist when appropriate.

llvm-svn: 2292
2002-04-18 17:39:14 +00:00
Chris Lattner
bb60c83409 Convert SCCP over to use InstVisitor instead of hand crafted switch
llvm-svn: 2286
2002-04-18 15:13:15 +00:00
Chris Lattner
b736829547 GEP instructions can never be constant propogated.
llvm-svn: 2284
2002-04-18 14:44:13 +00:00
Chris Lattner
5e7d6d8066 Store instructions always return void, so they never get a name
llvm-svn: 2283
2002-04-18 14:43:54 +00:00
Chris Lattner
eee0e3f1f7 Correctly transform dependant arguments, allowing the perimeter bm to work.
llvm-svn: 2282
2002-04-18 14:43:30 +00:00
Chris Lattner
04437c9749 Add casts for documentation
llvm-svn: 2272
2002-04-16 22:10:52 +00:00
Chris Lattner
68c032623c * Clean up the code a bit
* Allow structs with negative offsets.  This enables the em3d benchmark to
  be made typesafe.  In this case, the struct had an array as the first
  element, so a negative index was ok (the expr was -8 + 8x)

llvm-svn: 2271
2002-04-16 22:10:36 +00:00
Chris Lattner
c004e8f534 run an extra pass after a function has been transformed to eliminate
obviously duplicate loads of the pool base.

llvm-svn: 2255
2002-04-15 22:42:23 +00:00
Chris Lattner
1923a5cfaa Eliminate cast of same type instructions.
llvm-svn: 2251
2002-04-15 19:45:29 +00:00
Chris Lattner
2e20403fad * s/Method/Function
* Fix bug where the character after a % was being discarded

llvm-svn: 2248
2002-04-14 06:15:24 +00:00
Chris Lattner
983272ba58 Turn off debug output
llvm-svn: 2247
2002-04-14 06:14:41 +00:00
Chris Lattner
3b7f72e4e4 * Allow datasize to be specified on the commandline
* Build new datatypes correctly
* Transform instructions that return null pointers from functions to return
  a null index.

llvm-svn: 2244
2002-04-13 23:13:18 +00:00
Chris Lattner
47b17915d5 * Give alloca's for pool descriptors better names than "pool<n>".
* Fill in the pool descriptor links in the pool descriptors.

llvm-svn: 2239
2002-04-13 19:52:54 +00:00
Chris Lattner
249f5243f1 * Add names to the symbol table for pool types and modified types
* Handle more complex structure so that power works almost
* Fix bug with pooldestroy call where we passed in the size of the object
  instead of the pool to destroy.  bisort is now pool allocated successfully!

llvm-svn: 2238
2002-04-13 19:25:57 +00:00
Chris Lattner
24f4497fe9 Implement function rewriting to use offsets instead of pointers in programs.
This now works with treeadd at least, and perhaps other programs as well.

llvm-svn: 2233
2002-04-12 20:23:15 +00:00
Chris Lattner
3b04124abd * Add documentation
* Split the CleanGCC pass into two passes, a global pass and an IP pass.
  Before it was just a global pass, but it did illegal things to the
  module, which broke other passes that were being scheduled with it by
  gccld.

llvm-svn: 2224
2002-04-10 20:33:11 +00:00
Chris Lattner
150fc89dcd Implement TODO, fixing bug:
test/Regression/Transforms/LevelRaise/2002-04-09-MissedRaise.ll

llvm-svn: 2219
2002-04-09 20:53:36 +00:00
Chris Lattner
5e12c7caf5 Move FunctionArgument out of iOther.h into Argument.h and rename class to
be 'Argument' instead of FunctionArgument.

llvm-svn: 2216
2002-04-09 19:48:49 +00:00
Chris Lattner
b2038512b2 Add explicit #includes of Function.h to make up for the removed #include
in iOther.h

llvm-svn: 2209
2002-04-09 19:08:28 +00:00
Chris Lattner
7ae20d642d Add #includes to make up for #includes pruned out of header files.
llvm-svn: 2207
2002-04-09 18:37:46 +00:00
Chris Lattner
31e5838296 s/Method/Function
Remove extraneous #includes of llvm/Assembly/Writer

llvm-svn: 2178
2002-04-08 22:03:00 +00:00
Chris Lattner
44f14449c4 ConstantHandling moved into VMCore library
llvm-svn: 2165
2002-04-08 20:18:09 +00:00
Chris Lattner
0cfa70b083 Eliminate explicit use of Writer library, using debug dump output instead.
llvm-svn: 2147
2002-04-07 22:31:23 +00:00
Chris Lattner
bc15ae64dd Change references to the Method class to be references to the Function
class.  The Method class is obsolete (renamed) and all references to it
are being converted over to Function.

llvm-svn: 2144
2002-04-07 20:49:59 +00:00
Chris Lattner
8afff0c29a s/MethodType/FunctionType
llvm-svn: 2115
2002-04-04 22:19:18 +00:00
Chris Lattner
1ee6bf5249 PATypeHolder is now not a template
llvm-svn: 2106
2002-04-04 19:24:34 +00:00