Commit Graph

121 Commits

Author SHA1 Message Date
Chris Lattner 531f9e92d4 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!

llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner ce274ce93d Silence warnings
llvm-svn: 19379
2005-01-08 19:34:41 +00:00
Chris Lattner cbc0161d1f If one side of and/or is known to be 0/-1, it doesn't matter
if the other side is overdefined.

This allows us to fold conditions like:  if (X < Y || Y > Z) in some cases.

llvm-svn: 18807
2004-12-11 23:15:19 +00:00
Chris Lattner 2f687fd9d6 Two bug fixes:
1. Actually increment the Statistic for the GV elim optzn
 2. When resolving undef branches, only resolve branches in executable blocks,
    avoiding marking a bunch of completely dead blocks live.  This has a big
    impact on the quality of the generated code.

With this patch, we positively rip up vortex, compiling Ut_MoveBytes to a
single memcpy call. In vortex we get this:

     12 ipsccp           - Number of globals found to be constant
    986 ipsccp           - Number of arguments constant propagated
   1378 ipsccp           - Number of basic blocks unreachable
   8919 ipsccp           - Number of instructions removed

llvm-svn: 18796
2004-12-11 06:05:53 +00:00
Chris Lattner 8525ebe465 Do not delete the entry block to a function.
llvm-svn: 18795
2004-12-11 05:32:19 +00:00
Chris Lattner 91dbae6fee Implement Transforms/SCCP/ipsccp-gvar.ll, by tracking values stored to
non-address-taken global variables.

llvm-svn: 18790
2004-12-11 05:15:59 +00:00
Chris Lattner 99e1295645 Fix a bug where we could delete dead invoke instructions with uses.
In functions where we fully constant prop the return value, replace all
ret instructions with 'ret undef'.

llvm-svn: 18786
2004-12-11 02:53:57 +00:00
Chris Lattner bae4b64553 Implement SCCP/ipsccp-conditional.ll, by totally deleting dead blocks.
llvm-svn: 18781
2004-12-10 22:29:08 +00:00
Chris Lattner 7285f43836 Fix SCCP/2004-12-10-UndefBranchBug.ll
llvm-svn: 18776
2004-12-10 20:41:50 +00:00
Chris Lattner b439464c61 This is the initial implementation of IPSCCP, as requested by Brian.
This implements SCCP/ipsccp-basic.ll, rips apart Olden/mst (as described in
PR415), and does other nice things.

There is still more to come with this, but it's a start.

llvm-svn: 18752
2004-12-10 08:02:06 +00:00
Chris Lattner 27af257ea0 Do not delete dead invoke instructions!
llvm-svn: 17897
2004-11-16 16:32:28 +00:00
Chris Lattner 1890f94413 Minor cleanups. There is no reason for SCCP to derive from instvisitor anymore.
llvm-svn: 17825
2004-11-15 07:15:04 +00:00
Chris Lattner 9a038a3a5e Count more accurately
llvm-svn: 17824
2004-11-15 07:02:42 +00:00
Chris Lattner d18c16b842 Two minor improvements:
1. Speedup getValueState by having it not consider Arguments.  It's better
    to just add them before we start SCCP'ing.
 2. SCCP can delete the contents of dead blocks.  No really, it's ok!  This
    reduces the size of the IR for subsequent passes, even though
    simplifycfg would do the same job.  In practice, simplifycfg does not
    run until much later than sccp in gccas

llvm-svn: 17820
2004-11-15 05:45:33 +00:00
Chris Lattner 4f0316229c rename InstValue to LatticeValue, as it holds for more than instructions.
llvm-svn: 17818
2004-11-15 05:03:30 +00:00
Chris Lattner 074be1f6e4 Substantially refactor the SCCP class into an SCCP pass and an SCCPSolver
class.  The only changes are minor:

 * Do not try to SCCP instructions that return void in the rewrite loop.
   This is silly and fool hardy, wasting a map lookup and adding an entry
   to the map which is never used.
 * If we decide something has an undefined value, rewrite it to undef,
   potentially leading to further simplications.

llvm-svn: 17816
2004-11-15 04:44:20 +00:00
Chris Lattner 7dfc2d29ac Convert 'struct' to 'class' in various places to adhere to the coding standards
and work better with VC++.  Patch contributed by Morten Ofstad!

llvm-svn: 17281
2004-10-27 16:14:51 +00:00
Chris Lattner 646354bae1 Handle undef values as undefined on the constant lattice
ignore unreachable instructions

llvm-svn: 17044
2004-10-16 18:09:41 +00:00
Chris Lattner 5c91c8f18b Use DEBUG instead of DebugFlag directly, as DebugFlag does not respect
-debug-only!

llvm-svn: 16868
2004-10-09 19:30:36 +00:00
Chris Lattner 3e86084641 Prototype these functions more accurately
llvm-svn: 16432
2004-09-20 04:43:15 +00:00
Reid Spencer 6614946443 Convert code to compile with vc7.1.
Patch contributed by Paolo Invernizzi. Thanks Paolo!

llvm-svn: 16368
2004-09-15 17:06:42 +00:00
Reid Spencer 7c16caa336 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.

llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Alkis Evlogimenos 832437255d Stop using getValues().
llvm-svn: 15487
2004-08-04 08:44:43 +00:00
Reid Spencer f0a5bcaae4 Delete a redundant if branch.
llvm-svn: 14967
2004-07-18 08:34:52 +00:00
Reid Spencer c5afc9512b bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass

llvm-svn: 14947
2004-07-18 00:31:05 +00:00
Chris Lattner d79334df33 This patch was contributed by Daniel Berlin!
Speed up SCCP substantially by processing overdefined values quickly.  This
patch speeds up SCCP by about 30-40% on large testcases.

llvm-svn: 14861
2004-07-15 23:36:43 +00:00
Chris Lattner 9a63520b1a Fixes working towards PR341
llvm-svn: 14839
2004-07-15 01:50:47 +00:00
Chris Lattner ff9362a8da Add SCCP support for constant folding calls, implementing:
test/Regression/Transforms/SCCP/calltest.ll

llvm-svn: 12921
2004-04-13 19:43:54 +00:00
Chris Lattner 69193f93b6 Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

llvm-svn: 12653
2004-04-05 01:30:19 +00:00
Chris Lattner 7a7b114871 Do not try to optimize PHI nodes with incredibly high degree. This reduces SCCP
time from 615s to 1.49s on a large testcase that has a gigantic switch statement
that all of the blocks in the function go to (an intepreter).

llvm-svn: 12442
2004-03-16 19:49:59 +00:00
Chris Lattner 59db22dcd4 Add sccp support for select instructions
llvm-svn: 12318
2004-03-12 05:52:44 +00:00
Chris Lattner 538fee7aa2 Since 'load null' is undefined, we can make it do whatever we want. Returning
a zero value is the most likely way to cause further simplification, so we do it.

llvm-svn: 12197
2004-03-07 22:16:24 +00:00
Chris Lattner 76b2ff4ded Adjustments to support the new ConstantAggregateZero class
llvm-svn: 11474
2004-02-15 05:55:15 +00:00
Chris Lattner 1b7d4d7b63 Don't use ConstantExpr::getShift anymore
llvm-svn: 10791
2004-01-12 19:08:43 +00:00
Chris Lattner 0fe5b32c01 Use constantexprs for casts. Eliminate use of the ConstantHandling interfaces
llvm-svn: 10779
2004-01-12 17:43:40 +00:00
Chris Lattner fe992d4332 Fix fairly severe bug in my last checking where we treated all unfoldable
constants as being "true" when evaluating branches.  This was introduced
because we now create constantexprs for the constants instead of failing the
fold.

llvm-svn: 10778
2004-01-12 17:40:36 +00:00
Chris Lattner 49f74522ec * Implement minor performance optimization for the getelementptr case
* Implement SCCP of load instructions, implementing Transforms/SCCP/loadtest.ll
  This allows us to fold expressions like "foo"[2], even if the pointer is only
  a conditional constant.

llvm-svn: 10767
2004-01-12 04:29:41 +00:00
Chris Lattner 05fe6847a8 Implement SCCP/phitest.ll
llvm-svn: 10763
2004-01-12 03:57:30 +00:00
Chris Lattner 49525f8cf4 Finegrainify namespacification
llvm-svn: 10725
2004-01-09 06:02:20 +00:00
Brian Gaeke 960707c335 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
John Criswell 482202a601 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner f0fc9be634 ADd support for the new varargs instructions
llvm-svn: 9225
2003-10-18 05:56:52 +00:00
Misha Brukman 8b2bd4ed47 Fix spelling.
llvm-svn: 9027
2003-10-10 17:57:28 +00:00
Chris Lattner 35e56e7372 Update comment
llvm-svn: 8965
2003-10-08 16:56:11 +00:00
Chris Lattner 0bbbe5d4c8 Use a set to keep track of which edges have been noticed as executable already
to avoid reprocessing PHI nodes needlessly.  This speeds up the big bad PHI
testcase 43%: from 104.9826 to 73.5157s

llvm-svn: 8964
2003-10-08 16:55:34 +00:00
Chris Lattner 7324f7cd03 Minor fixes here and there
llvm-svn: 8963
2003-10-08 16:21:03 +00:00
Chris Lattner 71ac22ffb5 Avoid building data structures we don't really need. This improves the runtime
of a test that Bill Wendling sent me from 228.5s to 105s.  Obviously there is
more improvement to be had, but this is a nice speedup which should be "felt"
by many programs.

llvm-svn: 8962
2003-10-08 15:47:41 +00:00
Chris Lattner 9c58cf6d03 Add support for the unwind instruction
llvm-svn: 8408
2003-09-08 18:54:55 +00:00
Chris Lattner df741d62de Fix bug: SCCP/2003-08-26-InvokeHandling.ll
llvm-svn: 8152
2003-08-27 01:08:35 +00:00
Misha Brukman 7eb05a170a Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00