Commit Graph

133 Commits

Author SHA1 Message Date
Chris Lattner
ea54ab9cd2 Fix bug: test/Regression/Transforms/ADCE/2002-01-31-UseStuckAround.ll
Cleanup code a lot


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2547 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 22:11:39 +00:00
Chris Lattner
022103b3f3 Merge all individual .h files into a single Scalar.h file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2537 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 20:03:00 +00:00
Chris Lattner
c8cc4cb03b Updates to move some header files out of include/llvm/Transforms into
the Scalar and Utils subdirectories


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2523 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:36:35 +00:00
Chris Lattner
497c60c0ed Reduce dependance on TransformInternals.h, instead using the TransformUtils library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2518 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:12:18 +00:00
Chris Lattner
6d7491c3cc Add #include no longer included by llvm/Transforms/Scalar/ConstantProp.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2517 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:11:30 +00:00
Chris Lattner
2ed01d8f0b Factor code out to the TransformUtils library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2516 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:10:55 +00:00
Chris Lattner
071d0ad2f1 * Convert InstWorkList to vector instead of set, because on big programs it
is empirically faster by a noticable margin, even though duplicates can
  happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2511 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 04:29:32 +00:00
Chris Lattner
92deeaf7a3 * Remove all cfg simplification stuff for a new cfg simplify pass (todo)
* Convert to worklist instead of iterative algorithm


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2510 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 04:24:11 +00:00
Chris Lattner
d661937352 Only do masking for unsigned values!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2504 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 18:54:59 +00:00
Chris Lattner
89df1b58a9 * 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2502 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 18:21:31 +00:00
Chris Lattner
473945d1dc Handle X = phi Y --> X = Y
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2501 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 18:06:38 +00:00
Chris Lattner
f51825e3fb * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2497 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:54:10 +00:00
Chris Lattner
dfe81ab87a Clean up ADCE by removing extraneous wrapper class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2494 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:27:57 +00:00
Chris Lattner
ed3a55005d Combine not (not X) -> X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2493 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:03:21 +00:00
Chris Lattner
b35dde1df4 Support more cases...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2490 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:49:18 +00:00
Chris Lattner
3f5b877dd4 Add many more instruction combination simplifications
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2484 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:14:14 +00:00
Chris Lattner
cdac78b8a4 Merge blocks like this:
void "test3"(bool %T) {
        br bool %T, label %BB1, label %BB1
BB1:
        ret void
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2472 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:02:02 +00:00
Chris Lattner
4c1061f58c Implement constant propogation of shift instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2471 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:01:37 +00:00
Chris Lattner
904ec289c2 Ok, really it only takes me 3 times to get this right!
Now use #if 0 instead of #ifdef 0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2448 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:49:50 +00:00
Chris Lattner
52a9a1def8 Oops, disable debugging code all the way. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2447 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:47:40 +00:00
Chris Lattner
b9a6634466 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2446 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:44:00 +00:00
Chris Lattner
59f0ce2a41 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2445 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:18:01 +00:00
Chris Lattner
0e9c515439 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2443 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 20:32:51 +00:00
Chris Lattner
a1be566213 * Add ability to eliminate a bunch of different cascading cast variations
* Allow elimination of getelementptr X, uint 0 (which is a noop)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2428 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 17:06:02 +00:00
Chris Lattner
6c1ce21ee6 Add folding rules for mul X, 0 and mul X, 2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2417 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 22:24:47 +00:00
Chris Lattner
0dbfc05a2a Significantly clean up SCCP pass. Now the two classes are merged and in
an anonymous namespace where they belong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2415 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 21:26:08 +00:00
Chris Lattner
f737121054 Range insertion now returns an iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2414 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 21:25:34 +00:00
Chris Lattner
94cf3b1c67 Remove unused files: This is the old induction varaible cannonicalization
pass built on top of interval analysis


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2411 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 20:18:00 +00:00
Chris Lattner
72a1d4e126 changes because iMemory.h no longer #includes DerivedTypes.h
This only requires Type.h anyway


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2405 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:48:30 +00:00
Chris Lattner
c6f3ae5c66 Eliminate duplicate or unneccesary #include's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2397 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 17:42:12 +00:00
Chris Lattner
8b054c0eb9 Remove broken assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2396 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 16:20:25 +00:00
Chris Lattner
96c466b06a Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2395 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 14:57:45 +00:00
Chris Lattner
097632eae3 More cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2392 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 01:58:47 +00:00
Chris Lattner
2f6f03bddd Code cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2391 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 01:22:55 +00:00
Chris Lattner
97e52e4336 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2386 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 21:27:06 +00:00
Chris Lattner
31bcdb822f Split ConstantVals.h into Constant.h and Constants.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2378 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 19:55:58 +00:00
Chris Lattner
1b7f7dc4b4 Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
to the global namespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2370 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 16:21:30 +00:00
Chris Lattner
d80e973cec Initial checkin of simple&fast SSA based GCSE algorithm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2338 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 00:47:11 +00:00
Chris Lattner
f57b845547 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2333 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 06:56:12 +00:00
Chris Lattner
f2361c5e5c Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2332 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 03:15:45 +00:00
Chris Lattner
1a18b7cf80 Change Constant::getNullConstant to Constant::getNullValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2323 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:25:14 +00:00
Chris Lattner
dd841aeb8d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2292 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 17:39:14 +00:00
Chris Lattner
2a632551a7 Convert SCCP over to use InstVisitor instead of hand crafted switch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2286 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 15:13:15 +00:00
Chris Lattner
6428a27ee3 GEP instructions can never be constant propogated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2284 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 14:44:13 +00:00
Chris Lattner
27e3420ce9 Store instructions always return void, so they never get a name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2283 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 14:43:54 +00:00
Chris Lattner
8d70cd9607 Eliminate cast of same type instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2251 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-15 19:45:29 +00:00
Chris Lattner
73e214244f Move FunctionArgument out of iOther.h into Argument.h and rename class to
be 'Argument' instead of FunctionArgument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2216 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-09 19:48:49 +00:00
Chris Lattner
42a412711c Add #includes to make up for #includes pruned out of header files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2207 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-09 18:37:46 +00:00
Chris Lattner
237e6d10f2 s/Method/Function
Remove extraneous #includes of llvm/Assembly/Writer


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2178 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-08 22:03:00 +00:00
Chris Lattner
968ddc921e ConstantHandling moved into VMCore library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2165 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-08 20:18:09 +00:00