Commit Graph

1152 Commits

Author SHA1 Message Date
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
Misha Brukman
7bc439a4b6 Spell `definitely' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8466 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-11 15:31:17 +00:00
Chris Lattner
545a76ced8 Unwind instructions are intrinsically alive, just like returns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8462 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 20:38:14 +00:00
Chris Lattner
1df2998451 Update for new UnifyFunction... API
Remove using decl


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8458 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 20:35:33 +00:00
Chris Lattner
4ea31ca391 Remove #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8457 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 20:35:21 +00:00
Chris Lattner
f46057be77 Expand the pass to unify all of the unwind blocks as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8456 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 20:34:51 +00:00
Chris Lattner
065a616ada Fix spell-o's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8431 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 05:29:43 +00:00
Chris Lattner
3adf51d022 Spelling fixes. I think that "cannonical" is ok, but "canonical" appears to
be the canonical form for the word


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8430 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 05:24:46 +00:00
Chris Lattner
c01ccfd503 Fix up file header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8428 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-10 05:10:34 +00:00
Misha Brukman
dfa5f83c8e Spell `occurrence' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8425 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-09 21:54:45 +00:00
Chris Lattner
ee5457cbe8 Eliminate support for the llvm.unwind intrinisic, using the Unwind instruction instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8411 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 19:44:26 +00:00
Chris Lattner
e4d9096409 Should invokify is always true
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8409 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 19:00:30 +00:00
Chris Lattner
36143fc444 Add support for the unwind instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8408 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:54:55 +00:00
Chris Lattner
61c1e7e32d Do not hoist volatile loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8399 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-08 18:17:14 +00:00
Brian Gaeke
85ce5f3ccc Correct comments
Don't include InstLoops.h
Don't export factory functions for these passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8373 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 19:43:19 +00:00
Chris Lattner
bf8810040e Prototype for creator function got moved
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8315 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 20:45:33 +00:00
Chris Lattner
758fefc0f0 Final cleanup: remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8291 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 18:01:36 +00:00
Chris Lattner
273328e8e0 Not only is this a lot smaller, it actually works if there is already a
function with the right name in the module.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8290 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 16:53:46 +00:00
Chris Lattner
a0201eaca8 Dead files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8289 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 16:49:57 +00:00
Chris Lattner
09a670587a If "These should be used only by the auto-parallelization pass", we might as
well put them INTO the auto-par pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8288 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 16:49:38 +00:00
Chris Lattner
60a3518cf9 Moved all of the cilkifier stuff into lib/Transforms/IPO, as it really is not
support stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8287 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 16:45:30 +00:00
Chris Lattner
aa9214524d Minor cleanups
Do not #include Parallelize.h, it's just a subset of Cilkifier.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8285 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 16:42:16 +00:00
Chris Lattner
2dbfa03fd8 Change the RaiseAllocations pass to be a Pass instead of a BasicBlock pass.
This makes it more efficient: it doesn't have to scan the whole program, so
it performs work proportional to the number of malloc/free calls in the
program, not the size of the program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8280 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-01 03:14:56 +00:00
Chris Lattner
3186d275f7 Fix bug: TailDuplicate/2003-08-31-UnreachableBlocks.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8276 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 21:17:44 +00:00
Chris Lattner
237ef567f6 Heavily refactor code:
* Separate the policy decisions into a derived class [InlineSimple]
  * Move the inlining mechanics into a base class [Inliner]
  * Change the inliner to be an SCCPass, making it more structured and
    eventually pipelinable with other SCC passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8257 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 19:10:30 +00:00
Chris Lattner
f6fb96f559 Add accessor function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8253 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 16:30:07 +00:00
Chris Lattner
3e64b2e1a4 Initial checkin of the -prune-eh pass, a very simple exception handling removal pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8250 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 02:47:32 +00:00
Chris Lattner
a15854c9fe ScalarRepl does not modify the CFG. Say so!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8243 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 00:45:13 +00:00
Chris Lattner
7d8a86aa59 Use new interface, simplifies code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8242 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 00:22:27 +00:00
Chris Lattner
034636444b Use the new interface, simplifies code
NOTE that these two files are _BUGGY_ and need to be fixed, just not by me  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8241 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 00:21:59 +00:00
Chris Lattner
30aef423d1 Use the new interface, simplifies code
Delete a bunch of commented out code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8240 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 00:21:05 +00:00
Chris Lattner
5f07c877b3 Use the new interface, simplifies code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8239 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-31 00:20:36 +00:00
Chris Lattner
841e00b962 Fix bug where we considered function types equivalent even if they had differing numbers of arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8178 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-28 16:42:50 +00:00
Chris Lattner
99b28e632f Fix bug: SCCP/2003-08-26-InvokeHandling.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8152 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-27 01:08:35 +00:00
Chris Lattner
f30862f33b Remove special casing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8144 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-25 22:34:15 +00:00
Chris Lattner
77c5f733ac Fix bug: Linker/2003-08-23-GlobalVarLinking.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8130 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 19:30:20 +00:00
Chris Lattner
873c5e7859 Implement: Linker/2003-08-24-InheritPtrSize.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8129 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 19:26:42 +00:00
Chris Lattner
dc3602bf0d Implement SimplifyCFG/InvokeEliminate.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8126 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 18:36:16 +00:00
Chris Lattner
657fbe68b8 rethrow is really the language independent primitive here. "throw" can be written
in terms of it and llvm.exc.setcurrent.
Rework the intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8111 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 12:24:11 +00:00
Chris Lattner
e544533874 Inline invoke instructions as well as call instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8107 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 06:59:28 +00:00
Chris Lattner
80a38d2453 *** Implement inlining of Invoke instructions!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8106 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 06:59:16 +00:00
Chris Lattner
6a67393e19 Big diff for a small change: delete inlined functions if all callees have
inlined the function.
Implements: Inline/inline_dce.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8101 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 05:03:14 +00:00
Chris Lattner
7152c237b4 Implement: Inline/cfg_preserve_test.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8099 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-24 04:06:56 +00:00
Chris Lattner
7d6c24cdbf Implement SimplifyCFG/2003-08-17-FoldSwitch.ll:test5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8093 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 23:18:19 +00:00
Chris Lattner
44bb541c01 Fix bug: LowerSwitch/2003-08-23-EmptySwitch.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8087 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 22:54:34 +00:00
Chris Lattner
f44c6051e0 Do not consider any types that exist in the global symbol table!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8084 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 21:32:24 +00:00
Chris Lattner
e3092c94ad Fix bug: Linker/2003-08-23-RecursiveOpaqueTypeResolve.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8083 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 21:25:54 +00:00
Chris Lattner
fcd0234de6 Implement Linker/2003-08-23-GlobalVarLinking.ll, which should fix 176.gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8080 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 20:31:10 +00:00
Chris Lattner
086cb002d2 Fix bug: TailDup/2003-08-23-InvalidatedPointers.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8078 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 20:08:30 +00:00
Chris Lattner
a0f85e56c9 Fix bug: FunctionResolve/2003-08-23-ArgumentWarning.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8076 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-23 20:03:05 +00:00
Chris Lattner
9732be769e Fix typeo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8059 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-22 20:16:48 +00:00
Chris Lattner
43f4ba8c7d The process of linking types can cause their addresses to become invalid. For this reason, we must use TypeHandles!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8057 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-22 19:12:55 +00:00
Chris Lattner
e76c57ad46 Implement Linker/2003-08-20-OpaqueTypeResolve.ll
Hopefully this will fix the 176.gcc spec test as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8051 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-22 06:07:12 +00:00
Misha Brukman
ef6a6a69ff The word dependent' has no a'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8030 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-21 22:14:26 +00:00
Chris Lattner
b29170fa40 Unless we CANNOT merge the arguments, do so
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7999 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-20 23:50:38 +00:00
Chris Lattner
e6f7f61cda Fix grammar, add comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7967 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-18 22:54:06 +00:00
Misha Brukman
5560c9d49c Spell `necessary' correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7944 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-18 14:43:39 +00:00
Chris Lattner
10b1f5a941 Implement folding of switch instructions.
Implements SimplifyCFG/2003-08-17-FoldSwitch.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7923 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-17 20:21:14 +00:00
Chris Lattner
694e37f08a Fix bug: SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7921 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-17 19:41:53 +00:00
Chris Lattner
342a9d1464 The fixme is irrelevant: if that happens, the LLVM bytecode is malformed.
This fixes testcase: SimplifyCFG/2003-08-17-BranchFold.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7919 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-17 19:34:55 +00:00
Brian Gaeke
bf3c4cfaad Factory methods for function passes now return type FunctionPass *.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7839 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-14 06:09:32 +00:00
Chris Lattner
250d91b4bf Fix FIXME by removing FIXME
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7832 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 22:15:04 +00:00
Chris Lattner
aa9c1f13a1 Implement instcombine optimizations:
(A <setcc1> B) logicalop (A <setcc2> B)  -> (A <setcc3> B) or true or false

Where setcc[123] is one of the 6 setcc instructions, and logicalop is one of: And, Or, Xor


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7828 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 20:16:26 +00:00
Chris Lattner
564a727969 Generalize some of the add tests to allow for reassociation to take place
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7825 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 19:01:45 +00:00
Brian Gaeke
19df3876e6 Factory methods for FunctionPasses now return type FunctionPass *.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7823 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 18:18:15 +00:00
Chris Lattner
fb5be090f5 Assign arguments different ranks so they get grouped together
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7813 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 16:16:26 +00:00
John Criswell
478b3a9682 Removing the pool allocator from the main CVS tree.
Use the poolalloc module in CVS from now on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7810 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 15:36:15 +00:00
Chris Lattner
3ccd17ea2a Implement InstCombine/2003-08-12-AllocaNonNull.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7807 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 05:38:46 +00:00
Chris Lattner
934754bed6 Do not cannonicalize (X != 0) into (cast X to bool)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7806 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 05:33:12 +00:00
Chris Lattner
e92d2f450a Change cannonicalization rules: add X,X is represented as multiplies, multiplies
of a power of two are represented as a shift.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7803 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-13 04:18:28 +00:00
Brian Gaeke
aee2fdf069 Give std::map<BasicBlock *, BasicBlock *> the short name BBMap, because
it's used 7 different times.
Rename `getBackEdges' to `findAndInstrumentBackEdges', for clarity.
Remove some excess whitespace and commented-out code.
Use shorter forms of CallInst ctors.
Do not make `reopt_threshold' visible to the LLVM program, and do not
 pass it to the call to `reoptimizerInitialize'.  Don't pass the
 GlobalVariable representing it to any of our helper methods.
 `reopt_threshold' is an internal parameter of the reoptimizer, which
 InstLoops does not need to know about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7794 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-12 22:00:24 +00:00
Chris Lattner
df17af1dc7 Allow pulling logical operations through shifts.
This implements InstCombine/shift.ll:test14*


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7793 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-12 21:53:41 +00:00
Chris Lattner
e9608e37fc Fix bug: Reassociate/2003-08-12-InfiniteLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7792 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-12 21:45:24 +00:00
Chris Lattner
6007cb6c4d Assign finer grained ranks, make sure to reassociate top-level after reassociating bottom level
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7787 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-12 20:14:27 +00:00
Chris Lattner
e132d95b62 Simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7783 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-12 19:17:27 +00:00
Chris Lattner
67ca768927 Implement testcases InstCombine/or.ll:test16/test17
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7782 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-12 19:11:07 +00:00
Sumant Kowshik
233d0758a1 Bug fix: Some nodes pointed to by globals may not be marked incomplete and need to be tracked to find pool arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7763 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-12 00:45:13 +00:00
Chris Lattner
1f28e8ce4d Fix handling of 'free' if it has absolutely no prototype
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7721 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-11 15:05:08 +00:00
John Criswell
7d3c5795f9 Fixed a segfault in gccld.
The original code does not work because the value from WorkList.end() is
invalidated once WorkList.erase() is called.  To ensure proper functionality,
we must ensure that WorkList.erase() is always called before WorkList.end().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7673 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-07 14:43:13 +00:00
Sumant Kowshik
8e37bd0330 Added code for pool allocating only the pool-allocatable data structures in the presence of collapsed nodes + a couple of bug fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7662 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-07 05:29:28 +00:00
Chris Lattner
8043127860 Remove unnecessary use of NonCopyable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7641 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-06 17:16:24 +00:00
Tanya Lattner
11a49a722f Fixed minor bug in SafeToHoist and made some changes suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7614 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-05 20:39:02 +00:00
Tanya Lattner
9966c03aad Fixed LICM bug that hoists trapping instructions that are not guaranteed to execute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7612 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-05 18:45:46 +00:00
Chris Lattner
c8afdc150c Minor changes:
* Expand most tabs into spaces
  * Move #define DEBUG_TYPE to top of file to avoid warning


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7611 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-05 18:44:12 +00:00
Sumant Kowshik
f67e7fc7b1 Major bug fixes including a memory leak and tracking some exceptional conditions. Also added support for including global and indirect call information in the DS graphs used by the pool allocation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7605 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-05 17:01:54 +00:00
Chris Lattner
122558b05b Fix bug: SimplifyCFG/2003-08-05-InvokeCrash.ll
Fix bug: SimplifyCFG/2003-08-05-MishandleInvoke.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7599 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-05 16:27:44 +00:00
Chris Lattner
6806f5614d DEBUG got moved to Support/Debug.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7492 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-01 22:15:03 +00:00
Chris Lattner
943c713c65 Instcombine: (A >> c1) << c2 for signed integers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7295 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 18:38:56 +00:00
Chris Lattner
08fd7abb42 Reorganization of code, no functional changes.
Now it shoudl be a bit more efficient


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7292 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 17:52:58 +00:00
Chris Lattner
24c8e38455 Allow folding several instructions into casts, which can simplify a lot
of codes.  For example,
short kernel (short t1) {
  t1 >>= 8; t1 <<= 8;
  return t1;
}

became:

short %kernel(short %t1.1) {
        %tmp.3 = shr short %t1.1, ubyte 8               ; <short> [#uses=1]
        %tmp.5 = cast short %tmp.3 to int               ; <int> [#uses=1]
        %tmp.7 = shl int %tmp.5, ubyte 8                ; <int> [#uses=1]
        %tmp.8 = cast int %tmp.7 to short               ; <short> [#uses=1]
        ret short %tmp.8
}

before, now it becomes:
short %kernel(short %t1.1) {
        %tmp.3 = shr short %t1.1, ubyte 8               ; <short> [#uses=1]
        %tmp.8 = shl short %tmp.3, ubyte 8              ; <short> [#uses=1]
        ret short %tmp.8
}

which will become:
short %kernel(short %t1.1) {
        %tmp.3 = and short %t1.1, 0xFF00
        ret short %tmp.3
}

This implements cast-set.ll:test4 and test5


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7290 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 17:35:25 +00:00
Chris Lattner
8baa92ef0b Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7289 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 17:31:56 +00:00
Chris Lattner
1078d11854 Fix bug: FunctionResolve/2003-07-23-CPR-Reference.ll
This fixes a long time annoyance which caused prototypes for bzero, bcopy,
bcmp, fputs, and fputs_unlocked to never get deleted.  Grr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7285 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 22:03:18 +00:00
Chris Lattner
2cd9196e87 Add comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7283 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 21:41:57 +00:00
Chris Lattner
eca0c5c379 Remove explicit check for: not (not X) = X, it is already handled because xor is commutative
- InstCombine: (X & C1) ^ C2 --> (X & C1) | C2 iff (C1&C2) == 0
  - InstCombine: (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7282 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 21:37:07 +00:00
Chris Lattner
06782f804f InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7272 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 19:36:21 +00:00
Chris Lattner
5840326ae6 - InstCombine: (X | C1) & C2 --> X & C2 iff C1 & C1 == 0
- InstCombine: (X | C) & C --> C
  - InstCombine: (X | C1) & C2 --> (X | (C1&C2)) & C2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7269 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 19:25:52 +00:00
Chris Lattner
ad44ebfff0 IC: (X & C1) | C2 --> (X | C2) & (C1|C2)
IC: (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)

We are now guaranteed that all 'or's will be inside of 'and's, and all 'and's
will be inside of 'xor's, if the second operands are constants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7264 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 18:29:44 +00:00
Chris Lattner
c6a8aff3f6 IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
Minor code cleanup


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7262 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:57:01 +00:00
Chris Lattner
00b1a7e23e InstCombine: (X ^ 4) == 8 --> X == 12
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7260 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:26:36 +00:00
Chris Lattner
bc5d414823 IC: (X & 5) == 13 --> false
IC: (X | 8) == 4  --> false


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7257 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:02:11 +00:00
Chris Lattner
c07736a397 Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7252 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:22:26 +00:00
Chris Lattner
00f185fbfd Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7243 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 03:32:41 +00:00
Chris Lattner
1ba5bcd1ae - InstCombine (cast (xor A, B) to bool) ==> (setne A, B)
- InstCombine (cast (and X, (1 << size(X)-1)) to bool) ==> x < 0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7241 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-22 21:46:59 +00:00
John Criswell
067947380c Added code that checks to see if a global variable is external before replacing
a load of the global variable with the variable's constant value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7216 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21 19:42:57 +00:00
Anand Shukla
a235e14eaf Added check for inlinable function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7206 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 20:55:26 +00:00
Anand Shukla
0df7ddbd31 A pass to combine multiple backedges that go to same target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7201 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 16:08:32 +00:00
John Criswell
a676b78791 Dinakar and I fixed a bug where we were trying to get the initializer of
an external constant.  Since external constants don't have initializers, we
were failing on an assert() call in llvm/GlobalVariable.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7193 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17 19:06:55 +00:00
Vikram S. Adve
919fc8c367 Trace loads and stores as they happen (stores were being
remembered in valuesStoredInFunction, but never traced at function return,
and that's too late to be finding the error anyway).
Stores trace both the value and the address being stored to,
but after some experience I think only values should be traced.
The pointer hash table just fills up far too quickly if every
store address were traced.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7169 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-11 21:57:43 +00:00
Anand Shukla
666ff520e6 Added functionality to instrmentation pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7161 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 21:55:57 +00:00
John Criswell
7a73b80b90 Merged in autoconf branch. This provides configuration via the autoconf
system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 21:59:07 +00:00
Chris Lattner
8bc95a176a Eliminate using declarations, adjust for new DSGraph API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6992 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 03:14:44 +00:00
Chris Lattner
cf6bac3b56 Allow the inlining limit to be controlled from the command line!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6929 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 15:57:04 +00:00
Chris Lattner
b12b75365a Add support to globaldce for deleting dead function prototypes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6918 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:41:18 +00:00
Chris Lattner
81d4e14449 When internalizing global ctor/dtor list, also mark it constant. This is gross, but
until DSA is working all of the time and is totally reliable, we do this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6917 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:30:40 +00:00
Chris Lattner
833b8a4181 Add support for elimination of load instruction from global constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6912 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:06:25 +00:00
Chris Lattner
0af1fab019 Instcombine: X * -1 -> -X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6904 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 17:09:20 +00:00
Chris Lattner
83c39d2edb Fix bug: Mem2Reg/2003-06-26-IterativePromote.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6901 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 14:58:56 +00:00
Chris Lattner
9b2a14b6f1 Add argument to DAE to allow operation on non-internal functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6895 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 04:12:49 +00:00
Chris Lattner
837e42ccef Fix bug: ADCE/2003-06-24-BadSuccessor.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6891 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 23:02:45 +00:00
Chris Lattner
99c91e021a Do not mark ALL terminators live if any instruciton in the block is live. We only
want to mark it live if it is an unconditional branch.  This fixes bug:
ADCE/2002-05-28-Crash.ll and makes this pass _much_ more useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6887 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 21:49:45 +00:00
Chris Lattner
38b5ae4b48 Fix bug: SCCP/2003-06-24-OverdefinedPHIValue.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6883 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 20:29:52 +00:00
Chris Lattner
fcd74e2e31 Fix bug: TailDup/2003-06-24-Simpleloop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6881 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 19:48:06 +00:00
Chris Lattner
79d35b3f8b Implement new transforms:
Replace (cast (sub A, B) to bool) -> (setne A, B)
  Replace (cast (add A, B) to bool) -> (setne A, -B)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6873 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 21:59:52 +00:00
Chris Lattner
8a334a4035 avoid dividing by zero when dealing with zero sized types (like [0 x double])
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6862 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 17:36:49 +00:00
Chris Lattner
066ab6ac80 Add paranoia checking
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6856 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 20:46:00 +00:00
Chris Lattner
ea635cd072 Test change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6852 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 20:25:27 +00:00
Chris Lattner
7a7bef4355 Initial checkin of Tail duplication pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6846 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 20:10:28 +00:00
Chris Lattner
797249bc13 Instcombine cast (getelementptr Ptr, 0, 0, 0) to ... into: cast Ptr to ...
This fixes type safety problems in a variety of benchmarks that were confusing
DSA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6837 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 23:12:02 +00:00
Chris Lattner
1c6d6c996a Fix the build. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6797 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-20 14:36:52 +00:00
Chris Lattner
31f612589f Changes to privatize NodeType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6795 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 21:15:26 +00:00
Chris Lattner
9fe3886678 Implement the functionality of InstCombine/call.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6783 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 17:00:31 +00:00
Chris Lattner
a3df1ff807 Remove a bunch of complicated code. The functionality is implemented in instcombine instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6782 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 16:59:19 +00:00
Chris Lattner
97f4b664cd Handle arguments passed in through the va_arg area
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6769 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-18 16:25:51 +00:00
Chris Lattner
08227e4f17 Initial checkin of DAE pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6759 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 22:21:05 +00:00
Chris Lattner
bea68b3021 Don't corrupt memory when removing an instruction from the program, but
not the worklist


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6733 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 03:57:18 +00:00
Chris Lattner
34e353e560 Fix bug: ADCE/2003-06-11-InvalidCFG.ll
This was because we were deleting large chunks of functions without an exit block, because the post-dominance
information was not useful.  This broke crafty and twolf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6698 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-16 12:10:45 +00:00
Chris Lattner
e32487ebff Fix bug: LevelRaise/2003-06-07-EmptyArrayTest.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6669 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-07 21:45:42 +00:00
Chris Lattner
4432d8f3b5 Fix compilation problem on GCC 2.9x
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6667 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-07 20:29:58 +00:00
Chris Lattner
9b5fd22bd9 Fix bug: InstCombine/2003-06-05-BranchInvertInfLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6630 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-05 20:12:51 +00:00
Anand Shukla
cd0cc61329 Fixed a bug so initialization code is always inserted in main
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6622 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-05 06:02:46 +00:00
Chris Lattner
d3646f1586 Use a constant expr GEP instead of an actual instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6620 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-05 04:48:18 +00:00
Chris Lattner
fa9ee73a7d Make this work with counter > 127
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6613 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-04 20:08:47 +00:00
Sumant Kowshik
9271ade15b Made changes suggested by Chris
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6606 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-04 08:03:57 +00:00
Chris Lattner
40f5d70db4 Clean up previous code.
Add new combination to turn seteq X, 0 -> not(cast X to bool)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6604 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-04 05:10:11 +00:00
Chris Lattner
c4d10ebcd7 Implement combination of boolean not with branch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6599 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-04 04:46:00 +00:00
Chris Lattner
074d84c746 Implement xform: (X != 0) -> (bool)X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6506 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 03:35:25 +00:00
Anand Shukla
619754fb18 Added the #(internal functions) to output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6502 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 02:40:49 +00:00
Chris Lattner
c16e631e94 Fix bug: FunctionResolve/2003-05-31-AllInternalDecls.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6486 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-31 21:57:06 +00:00
Chris Lattner
12ce59d3c5 Fix bug: FuncResolve/2003-05-31-InternalDecl.ll
Count resolutions correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6482 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-31 21:08:45 +00:00
Chris Lattner
40c4959e9f Simplify funcresolve a bit more
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6480 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-31 20:44:46 +00:00
Chris Lattner
567cceea49 Fix bug: FunctionResolve/2003-05-31-FuncPointerResolve.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6479 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-31 20:33:31 +00:00
Tanya Lattner
658c5bcdb2 Fixed comment width, changed arg to be const, fixed indentation, removed unnecessary includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6476 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-31 20:01:37 +00:00
Chris Lattner
b37923f9a1 Okay totally give up on trying to optimize aggregates that cannot be completely
broken up into their elements.  Too many programs break because of this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6440 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-30 19:22:14 +00:00
Chris Lattner
26d2ca1d13 add a check that allows the SRoA pass to avoid breaking programs, even if their
behavior is technically undefined


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6438 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-30 18:09:57 +00:00
Tanya Lattner
6074d2f37a Added the CloneTrace function which clones traces. It takes a vector of basic blocks, removes
internal phi nodes, and returns a new vector of basic blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6431 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-30 15:50:18 +00:00
Chris Lattner
261d686737 Fix bug: ScalarRepl/2003-05-30-MultiLevel.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6428 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-30 05:26:30 +00:00
Chris Lattner
5e062a1eda Fix bug: ScalarRepl/2003-05-29-ArrayFail.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6425 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-30 04:15:41 +00:00
Sumant Kowshik
a78220fe2d Added support for function pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6420 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-29 22:42:44 +00:00
Chris Lattner
faf4cc2da0 Add comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6415 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-29 20:26:30 +00:00
Chris Lattner
ab2b328c78 Eliminate unnecessary ->get calls that are now automatically handled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6397 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-29 15:12:27 +00:00
Chris Lattner
ca398dc398 * Separate all of the grunt work of inlining out into the Utils library.
* Make the function inliner _significantly_ smarter.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6396 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-29 15:11:31 +00:00
Chris Lattner
2a9c847f25 Fix bug: Instcombine/2003-05-27-ConstExprCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6352 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-27 16:40:51 +00:00
Chris Lattner
d10376bee5 * Actually USE the statistic that we made
* Implement SRoA for arrays


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6349 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-27 16:09:27 +00:00
Chris Lattner
ed7b41ea90 Implementation of the simple "scalar replacement of aggregates" transformation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6346 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-27 15:45:27 +00:00
Chris Lattner
bd4ecf769d Fix bug: InstCombine/2003-05-26-CastMiscompile.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6338 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-26 23:41:32 +00:00
Chris Lattner
de579f11ff Remove using declarations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6306 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 22:00:07 +00:00
Chris Lattner
88c7c3295d Make the list accept comma separated names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6295 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 20:27:13 +00:00
Chris Lattner
2345d71853 * Revert to old behavior of ignoring a module if it doesn't contain a main
function and no symbols were explicitly marked to be externalized.
* Add new -internalize-public-api-list option that can be used if the symbol
  list is small, and making a new file is annoying.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6289 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 19:48:00 +00:00
Chris Lattner
c7a2c7f0c9 Add option to internalize to allow it to read a file to determine which symbols
should not be internalized


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6288 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 19:34:49 +00:00
Chris Lattner
c54e2b8f84 Minor cleanups.
This hunk:
-    } else if (Src->getNumOperands() == 2 && Src->use_size() == 1) {
+    } else if (Src->getNumOperands() == 2) {

Allows GEP folding to be more aggressive, which reduces the number of instructions
and can dramatically speed up BasicAA in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6286 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-22 19:07:21 +00:00
Chris Lattner
c52b30dcfb Fix bug: FunctionResolve/2003-05-21-MissingArguments.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6273 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-21 20:51:52 +00:00
Misha Brukman
82c89b9f3a Hopefully, the final fix for `[Pp]ropogate'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6251 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-20 21:01:22 +00:00
Misha Brukman
f117cc9ee6 s/convertable/convertible/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6248 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-20 18:45:36 +00:00
Chris Lattner
6d23d97e90 Fix long standing bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6232 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-15 18:25:13 +00:00
Chris Lattner
4c00e53b81 Fix Bug: Linker/2003-05-15-TypeProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6225 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-15 16:30:55 +00:00
Chris Lattner
f41464618f Fix major problem with appending linkage changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6185 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 12:11:51 +00:00
Chris Lattner
8166e6eef6 Implement linkage of appending global variables!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6178 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-13 21:33:43 +00:00
Chris Lattner
8f6396e80f Fix bug: LoopPreheaders/2003-05-12-PreheaderExitOfChild.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6153 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 22:04:34 +00:00
Chris Lattner
1d16ec7381 Handle va_arg instruction correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6030 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-08 02:50:13 +00:00
Chris Lattner
8d8f20e47a Don't inline functions that take variable numbers of arguments!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6024 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-08 02:36:43 +00:00
Chris Lattner
1b27cb7159 Remove using decl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6023 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-08 02:34:52 +00:00
Chris Lattner
2d399096cf Attempt to fix sumant's typesafety issue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5984 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-02 19:32:04 +00:00
Chris Lattner
e96fda3002 Fix spelling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5983 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-02 19:26:34 +00:00
Chris Lattner
20af3222da Fix Bug: LowerSwitch/2003-05-01-PHIProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5979 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-01 22:21:21 +00:00
Chris Lattner
cdeb81d412 Fix bug: LevelRaise/2003-05-01-CallCast.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5975 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-01 21:02:53 +00:00
Chris Lattner
3f2ec3925f Fix another case where constexprs could cause a crash
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5972 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-30 22:34:06 +00:00
Chris Lattner
fe32e0c578 Fix constant folding of constexprs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5971 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-30 22:19:10 +00:00
Chris Lattner
95549281ec Create constant expression casts instead of constant instructions if possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5968 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-28 01:25:38 +00:00
Chris Lattner
1fd95afab3 Fix several bugs:
* Warnings were emitted all of the time and were really annoying
  * Functions could not be resolved unless they had external linkage.  Linkonce
    linkage was not allowed
  * ConstantPointerRef's were not handled when linking functions
    we now actually handle cast (CPR) to X -> cast (NewCPR) to X


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5967 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-28 01:23:29 +00:00
Chris Lattner
b53a198613 Avoid naming things exactly the same
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5966 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-27 22:55:56 +00:00
Chris Lattner
619f825640 Fix bug: ADCE/2003-04-25-PHIPostDominateProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5952 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-25 22:53:27 +00:00
Chris Lattner
bceb2b0061 Fix major problem with PHI node traversal: rechecking PHIs should go into
the visit function.  The worklist is for when their lattice value changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5927 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-25 03:35:10 +00:00
Chris Lattner
9de28289f8 Minor non-functional changes:
* Spell propagate right
  * Improve performance of phi node handling
  * Delete using directive
  * Other minor changes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5920 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-25 02:50:03 +00:00
Chris Lattner
c8789cb40b Fix bug: mem2reg/2003-04-24-MultipleIdenticalSuccessors.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5919 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-25 00:54:58 +00:00
Chris Lattner
16125fb749 Make the levelraise pass be well behaved w.r.t the TargetData that the current
PassMAnager provides.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5896 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-24 18:25:27 +00:00
Chris Lattner
ad80a46caa Fix iterator invalidation problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5895 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-24 17:52:20 +00:00
Chris Lattner
892310eaff Make sure that the cloned module retains the type symbol table entries!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5894 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-24 17:15:33 +00:00
Chris Lattner
7899b74fdb Make sure to preserve endiannes and pointer size when cloning modules!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5892 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-24 15:54:40 +00:00
Chris Lattner
c2b97d43a0 Fix Bug: Linker/2003-04-23-LinkOnceLost.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5879 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 18:38:39 +00:00
Chris Lattner
e408e25132 Remove unnecesary &*'s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5872 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 16:37:45 +00:00
Chris Lattner
14383485ac New pass to lower switch instructions to branch instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5865 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 16:23:59 +00:00
Chris Lattner
350c0a8216 Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5863 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 16:18:14 +00:00
Chris Lattner
43a9994c01 Add warning when linking modules with disagreeing target properties
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5845 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-22 19:13:20 +00:00
Chris Lattner
37f59419b8 Preserve the new moduleID field
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5835 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-22 18:02:26 +00:00
Chris Lattner
2719bac905 Fix bug: 2003-01-30-LinkerRename.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5828 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-21 21:15:04 +00:00
Chris Lattner
0fec08eb58 Fix linking a function with qualifiers to a external function declaration:
Fixed bug: Linker/2003-04-21-Linkage.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5827 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-21 21:07:05 +00:00
Chris Lattner
085c801dee Fix bug where use still existed in dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5824 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-21 19:15:26 +00:00
Chris Lattner
ea2294a498 Implement: FunctionResolve/2003-04-18-ForwardDeclGlobal.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5816 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-19 00:15:27 +00:00
Chris Lattner
393689afa9 Fix bug: Mem2reg/2003-04-18-DeadBlockProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5810 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-18 19:25:22 +00:00
Chris Lattner
156bcf3f65 Global constants CAN be external
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5808 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-18 04:34:29 +00:00
Chris Lattner
17d145d26f Refactor CloneFunction to expose the new CloneBasicBlock function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5806 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-18 03:50:09 +00:00
Chris Lattner
15faa8498c New const_cast instead of c style cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5805 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-18 03:49:49 +00:00
Chris Lattner
fb242b6edc Change the interface to constant expressions to allow automatic folding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5793 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-16 22:40:51 +00:00
Chris Lattner
4ad02e726d Add new linkage types to support a real frontend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5786 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-16 20:28:45 +00:00
Chris Lattner
af7ccd9bba Make help message more clear
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5775 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-13 03:50:14 +00:00
Chris Lattner
d4bd3eba5d * Fix bug: Mem2Reg/2003-04-10-DFNotFound.ll
* Make Mem2Reg assign version numbers now for renamed variables instead of
  .mem2reg suffixes.  This produces what people think of as SSA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5771 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-10 19:41:13 +00:00
Chris Lattner
e941291a7a Initial checkin of PRE on LLVM. This implementation is still lacking in
several ways:

 * Load expressions are not PRE'd well.  Alias Analysis should be used to
   get accurate information when computing anticipatibility.
 * The expression collection implementation does not handle PHI nodes properly,
   thus the implementation misses many opportunities to PRE.
 * This code could be sped up quite a bit

Despite these flaws, the code seems to work well, and handles PR's as one
would expect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5759 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-31 19:55:43 +00:00
Chris Lattner
6c0e0496dc * We now preserve the no-critical-edge pass (because we cannot insert critical edges)
* Small modification to be more efficient


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5757 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-31 17:30:25 +00:00
Chris Lattner
c277eaa41e Move BreakCriticalEdges pass to lib/Transforms/Utils
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5754 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-21 21:43:19 +00:00
Chris Lattner
c8802d2c16 Add the following instcombine xforms:
- Implement simple reassociation: (A|c1)|(B|c2) == (A|B)|(c1|c2)
  - (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
  - (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5743 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-11 00:12:48 +00:00
Chris Lattner
a4f445b28c Implement: -A*-B == A*B
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5740 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-10 23:23:04 +00:00
Chris Lattner
a27231acc0 Add new transformation: // (~A | ~B) == (~(A & B))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5738 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-10 23:13:59 +00:00
Chris Lattner
8d96964e29 Generalize not and neg comparison testers to allow constant to be considered not'able and neg'able. This
allows optimization of this:
int %test4(int %A, int %B) {
        %a = xor int %A, -1
        %c = and int %a, 5    ; 5 = ~c2
        %d = xor int %c, -1
        ret int %d
}

into this:
int %test4(int %A, int %B) {            ; No predecessors!
        %c.demorgan = or int %A, -6             ; <int> [#uses=1]
        ret int %c.demorgan
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5736 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-10 23:06:50 +00:00
Chris Lattner
4f98c56936 Generalize (A+c1)+c2 optimization to work with all associative operators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5733 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-10 21:43:22 +00:00
Chris Lattner
28ba1aad99 Minor change, no functionality diff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5731 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-10 19:20:30 +00:00
Chris Lattner
ea34005404 Fix bug: (x << 100) wasn't folded to 0, but (x >> 100) was (when x is unsigned)
Implement new shift optimizations for shifting the result of a shift.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5729 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-10 19:16:08 +00:00
Chris Lattner
cb40a3749a Implement: (A|B)^B == A & (~B)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5728 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-10 18:24:17 +00:00
Chris Lattner
3a43837d85 Fix bug: SimplifyCFG/2003-03-07-DominateProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5722 91177308-0d34-0410-b5e6-96231b3b80d8
2003-03-07 18:13:41 +00:00