Commit Graph

373 Commits

Author SHA1 Message Date
Chris Lattner 3215bb6049 Implement SimplifyCFG/DeadSetCC.ll
SimplifyCFG is one of those passes that we use for final cleanup: it should
not rely on other passes to clean up its garbage.  This fixes the "why are
trivially dead setcc's in the output of gccas" problem.

llvm-svn: 19212
2005-01-01 16:02:12 +00:00
Chris Lattner ffefea0772 The split bb is really the exit of the old function
llvm-svn: 18799
2004-12-11 16:59:54 +00:00
Chris Lattner 4fc998da2e Fix Regression/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll,
and the failure on make_dparser last night.

llvm-svn: 18766
2004-12-10 17:42:31 +00:00
Chris Lattner 019445715e Squelch warning
llvm-svn: 18381
2004-11-30 07:47:34 +00:00
Chris Lattner 868ae13dc0 Fix test/Regression/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llx
This only fails on darwin or on X86 under valgrind.

llvm-svn: 18377
2004-11-30 07:01:15 +00:00
Chris Lattner fd8cbc257e Alkis noticed that this variable is dead. Thanks!
llvm-svn: 18369
2004-11-30 04:01:44 +00:00
Chris Lattner 389cfac0d1 If we have something like this:
if (x) {
    code
    ...
  } else {
    code
    ...
  }

Turn it into:

  code
  if (x) {
    ...
  } else {
    ...
  }

This reduces code size and in some common cases allows us to completely
eliminate the conditional.  This turns several if/then/else blocks in loops
into straightline code in 179.art, turning the loops into single basic blocks
(good for modsched even!).

Maybe now brg will leave me alone ;-)

llvm-svn: 18366
2004-11-30 00:29:14 +00:00
Misha Brukman 72a57c3259 Allow constructor parameter to override aggregating args; fix spacing
llvm-svn: 18028
2004-11-20 02:20:27 +00:00
Chris Lattner 9b0291b18d Fix: CodeExtractor/2004-11-12-InvokeExtract.ll
llvm-svn: 17699
2004-11-13 00:06:45 +00:00
Chris Lattner 5bcca6058a Fix a bug where the code extractor would get a bit confused handling invoke
instructions, setting DefBlock to a block it did not have dom info for.

llvm-svn: 17697
2004-11-12 23:50:44 +00:00
Chris Lattner 93d1e39f3e Do not compute the predecessor list for a block unless we need it.
This speeds up simplifycfg on this program, from 44.87s to 0.29s (with
a profiled build):

 #define CL0(a) case a: goto c;
 #define CL1(a) CL0(a##0) CL0(a##1) CL0(a##2) CL0(a##3) CL0(a##4) CL0(a##5) \
 CL0(a##6) CL0(a##7) CL0(a##8) CL0(a##9)
 #define CL2(a) CL1(a##0) CL1(a##1) CL1(a##2) CL1(a##3) CL1(a##4) CL1(a##5) \
 CL1(a##6) CL1(a##7) CL1(a##8) CL1(a##9)
 #define CL3(a) CL2(a##0) CL2(a##1) CL2(a##2) CL2(a##3) CL2(a##4) CL2(a##5) \
 CL2(a##6) CL2(a##7) CL2(a##8) CL2(a##9)
 #define CL4(a) CL3(a##0) CL3(a##1) CL3(a##2) CL3(a##3) CL3(a##4) CL3(a##5) \
 CL3(a##6) CL3(a##7) CL3(a##8) CL3(a##9)

 void f();

 void a() {
     int b;
  c: switch (b) {
         CL4(1)
     }
 }

This testcase is contrived to expose N^2 behavior, but this patch should speedup
simplifycfg on any programs that use large switch statements.  This testcase
comes from GCC PR17895.

llvm-svn: 17389
2004-11-01 06:53:58 +00:00
Reid Spencer 57cbe39d1e Change Library Names Not To Conflict With Others When Installed
llvm-svn: 17286
2004-10-27 23:18:45 +00:00
Reid Spencer fad217c847 Eliminate compilation warning on uninitialized variable.
llvm-svn: 17163
2004-10-22 16:10:39 +00:00
Reid Spencer c1c320c335 We won't use automake
llvm-svn: 17155
2004-10-22 03:35:04 +00:00
Reid Spencer 6a11a75f31 Initial automake generated Makefile template
llvm-svn: 17136
2004-10-18 23:55:41 +00:00
Reid Spencer ce0783318b Correction to allow compilation with Visual C++.
Patch contributed by Morten Ofstad. Thanks Morten!

llvm-svn: 17123
2004-10-18 14:38:48 +00:00
Chris Lattner 5edb2f32d0 Simplify code by deleting instructions that preceed unreachable instructions.
Simplify code by simplifying terminators that branch to blocks that start
with an unreachable instruction.

llvm-svn: 17116
2004-10-18 04:07:22 +00:00
Chris Lattner 34ae670706 Fix a bug that occurs when the constant value is the result of an invoke. In
particular, invoke ret values are only live in the normal dest of the invoke
not in the unwind dest.

llvm-svn: 17108
2004-10-18 01:21:17 +00:00
Chris Lattner 6e79e55aea Fix Regression/Transforms/Inline/2004-10-17-InlineFunctionWithoutReturn.ll
If a function had no return instruction in it, and the result of the inlined
call instruction was used, we would crash.

llvm-svn: 17104
2004-10-17 23:21:07 +00:00
Chris Lattner 215c7ebaa6 When inserting PHI nodes, don't insert any phi nodes that are obviously
unneccesary.  This allows us to delete several hundred phi nodes of the
form PHI(x,x,x,undef) from 253.perlbmk and probably other programs as well.

This implements Mem2Reg/UndefValuesMerge.ll

llvm-svn: 17098
2004-10-17 21:25:56 +00:00
Chris Lattner 96db59e48a Enhance hasConstantValue to ignore undef values in phi nodes. This allows it
to think that PHI[4, undef] == 4.

llvm-svn: 17096
2004-10-17 21:23:26 +00:00
Chris Lattner 98e541457b Add support for unreachable
llvm-svn: 17056
2004-10-16 18:21:33 +00:00
Chris Lattner 7e6d4a12b5 Add support for UndefValue
llvm-svn: 17046
2004-10-16 18:10:31 +00:00
Chris Lattner c0e2e82477 When promoting mem2reg, make uninitialized values become undef isntead of 0.
llvm-svn: 17045
2004-10-16 18:10:06 +00:00
Chris Lattner 45c35b1d1f When converting phi nodes into select instructions, we shouldn't promote PHI
nodes unless we KNOW that we are able to promote all of them.

This fixes: test/Regression/Transforms/SimplifyCFG/PhiNoEliminate.ll

llvm-svn: 16973
2004-10-14 05:13:36 +00:00
Reid Spencer ace94df71f Update to reflect changes in Makefile rules.
llvm-svn: 16950
2004-10-13 11:46:52 +00:00
Reid Spencer 97327f05fc Initial version of automake Makefile.am file.
llvm-svn: 16893
2004-10-10 22:20:40 +00:00
Chris Lattner 879ce7894c Do not insert trivially dead select instructions, which allows us to
potentially fold more in one pass.

llvm-svn: 16583
2004-09-29 05:43:32 +00:00
Chris Lattner 855a4ff4dd Remove a whole bunch of horrible hacky code that was used to promote allocas
whose addresses where used by trivial phi nodes and select instructions.  This
is now performed by the instcombine pass, which is more powerful, is much
simpler, and is faster.  This allows the deletion of a bunch of code, two
FIXME's and two gotos.

llvm-svn: 16406
2004-09-19 18:51:51 +00:00
Chris Lattner 475dc2c93d Make sure to remove the Select instruction as well
llvm-svn: 16389
2004-09-18 00:32:40 +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
Chris Lattner 9b9932bd94 If given an AliasSetTracker object to update, update it.
llvm-svn: 16347
2004-09-15 01:02:54 +00:00
Alkis Evlogimenos a5c04ee50f Fixes to make LLVM compile with vc7.1.
Patch contributed by Paolo Invernizzi!

llvm-svn: 16152
2004-09-03 18:19:51 +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
Chris Lattner 56273827b1 If we are extracting a block that has multiple successors that are the same
block (common in a switch), make sure to remove extra edges in successor
blocks.  This fixes CodeExtractor/2004-08-12-BlockExtractPHI.ll and should
be pulled into LLVM 1.3 (though the regression test need not be, as that
would require pulling in the LoopExtract.cpp changes).

llvm-svn: 15717
2004-08-13 03:27:07 +00:00
Chris Lattner f06b043204 When we code extract some stuff, leave the codeRepl block in the place where
the extracted code was, instead of putting it at the end of the function

llvm-svn: 15716
2004-08-13 03:17:39 +00:00
Chris Lattner 889d346e6e Add value mapper support for select constant exprs. This should fix a bug
Nate ran into when bugpointing siod.  This fix should go into LLVM 1.3

llvm-svn: 15712
2004-08-13 02:43:19 +00:00
Chris Lattner 7f1c7ede5b Fix code extraction of unwind blocks. This fixed bugs that bugpoint can
run into.  This should go into 1.3

llvm-svn: 15679
2004-08-12 03:17:02 +00:00
Alkis Evlogimenos 832437255d Stop using getValues().
llvm-svn: 15487
2004-08-04 08:44:43 +00:00
Chris Lattner 7471b96a05 Expose this as a functionpass
llvm-svn: 15369
2004-07-31 10:01:58 +00:00
Misha Brukman f4a410f907 Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15337
2004-07-29 17:30:57 +00:00
Misha Brukman 63b38bd2ed Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15334
2004-07-29 17:30:56 +00:00
Alkis Evlogimenos fd7a2d4477 Merge i*.h headers into Instructions.h as part of bug403.
llvm-svn: 15325
2004-07-29 12:17:34 +00:00
Brian Gaeke 902dcf0729 These files don't need to include <iostream> since they include "Support/Debug.h".
llvm-svn: 15089
2004-07-21 20:50:33 +00:00
Chris Lattner 45b50d14c9 Fix a serious code pessimization problem. If an inlined function has a single
return, clone the 'ret' BB code into the block AFTER the inlined call, not the
other way around.

llvm-svn: 15030
2004-07-20 05:45:24 +00:00
Chris Lattner 5823ac1c21 Implement SimplifyCFG/BrUnwind.ll
llvm-svn: 15022
2004-07-20 01:17:38 +00:00
Reid Spencer 3b4e83ec83 Remove an if statement that would never be reached.
llvm-svn: 14968
2004-07-18 08:41:47 +00:00
Reid Spencer cb3fb5d4f5 bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage

llvm-svn: 14953
2004-07-18 00:44:37 +00:00
Reid Spencer ef784f01dd bug 122:
- Minimize redundant isa<GlobalValue> usage

llvm-svn: 14948
2004-07-18 00:32:14 +00:00
Chris Lattner 32c518e526 Progress on PR341
llvm-svn: 14840
2004-07-15 02:06:12 +00:00