1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
Commit Graph

407 Commits

Author SHA1 Message Date
Chris Lattner
1685a3af78 Move to the IPO library. Utils shouldn't contain passes.
llvm-svn: 12372
2004-03-14 02:32:27 +00:00
Chris Lattner
5003f9e473 DemoteRegToStack got moved from DemoteRegToStack.h to Local.h
llvm-svn: 12368
2004-03-14 02:13:38 +00:00
Chris Lattner
76457c9c13 Add constant folding wrapper support for select instructions.
llvm-svn: 12319
2004-03-12 05:53:03 +00:00
Misha Brukman
c58f772803 Implement ExtractCodeRegion()
llvm-svn: 12070
2004-03-02 00:20:57 +00:00
Misha Brukman
8a60e317f0 Make a note that this is usually used via bugpoint.
llvm-svn: 12068
2004-03-02 00:19:09 +00:00
Misha Brukman
f93e6ab769 * Add implementation of ExtractBasicBlock()
* Add comments to ExtractLoop()

llvm-svn: 12053
2004-03-01 18:28:34 +00:00
Chris Lattner
9736130083 Fix bug: test/Regression/Transforms/LowerInvoke/2004-02-29-PHICrash.llx
... which tickled the lowerinvoke pass because it used the BCE routines.

llvm-svn: 12012
2004-02-29 22:24:41 +00:00
Chris Lattner
a854ddd528 Implement switch->br and br->switch folding by ripping out the switch->switch
and br->br code and generalizing it.  This allows us to compile code like this:

int test(Instruction *I) {
  if (isa<CastInst>(I))
    return foo(7);
  else if (isa<BranchInst>(I))
    return foo(123);
  else if (isa<UnwindInst>(I))
    return foo(1241);
  else if (isa<SetCondInst>(I))
    return foo(1);
  else if (isa<VAArgInst>(I))
    return foo(42);
  return foo(-1);
}

into:

int %_Z4testPN4llvm11InstructionE("struct.llvm::Instruction"* %I) {
entry:
        %tmp.1.i.i.i.i.i.i.i = getelementptr "struct.llvm::Instruction"* %I, long 0, ubyte 4            ; <uint*> [#uses=1]
        %tmp.2.i.i.i.i.i.i.i = load uint* %tmp.1.i.i.i.i.i.i.i          ; <uint> [#uses=2]
        %tmp.2.i.i.i.i.i.i = seteq uint %tmp.2.i.i.i.i.i.i.i, 27                ; <bool> [#uses=0]
        switch uint %tmp.2.i.i.i.i.i.i.i, label %endif.0 [
                 uint 27, label %then.0
                 uint 2, label %then.1
                 uint 5, label %then.2
                 uint 14, label %then.3
                 uint 15, label %then.3
                 uint 16, label %then.3
                 uint 17, label %then.3
                 uint 18, label %then.3
                 uint 19, label %then.3
                 uint 32, label %then.4
        ]
...

As well as handling the cases in 176.gcc and many other programs more effectively.

llvm-svn: 11964
2004-02-28 21:28:10 +00:00
Misha Brukman
0b846ae65c Right, it's really Extractor, not Extraction.
llvm-svn: 11939
2004-02-28 03:37:58 +00:00
Misha Brukman
f14fbb1a0b A pass that uses the generic CodeExtractor to rip out *every* loop in every
function, as long as the loop isn't the only one in that function. This should
help debugging passes easier with BugPoint.

llvm-svn: 11936
2004-02-28 03:33:01 +00:00
Misha Brukman
26e90f8776 A generic code extractor: given a list of BasicBlocks, it will rip them out into
a new function, taking care of inputs and outputs.

llvm-svn: 11935
2004-02-28 03:26:20 +00:00
Chris Lattner
e07d786aa6 turn things like:
if (X == 0 || X == 2)

...where the comparisons and branches are in different blocks... into a switch
instruction.  This comes up a lot in various programs, and works well with
the switch/switch merging code I checked earlier.  For example, this testcase:

int switchtest(int C) {
  return C == 0 ? f(123) :
         C == 1 ? f(3123) :
         C == 4 ? f(312) :
         C == 5 ? f(1234): f(444);
}

is converted into this:
        switch int %C, label %cond_false.3 [
                 int 0, label %cond_true.0
                 int 1, label %cond_true.1
                 int 4, label %cond_true.2
                 int 5, label %cond_true.3
        ]

instead of a whole bunch of conditional branches.

Admittedly the code is ugly, and incomplete.  To be complete, we need to add
br -> switch merging and switch -> br merging.  For example, this testcase:

struct foo { int Q, R, Z; };
#define A (X->Q+X->R * 123)
int test(struct foo *X) {
  return A  == 123 ? X1() :
        A == 12321 ? X2():
        (A == 111 || A == 222) ? X3() :
        A == 875 ? X4() : X5();
}

Gets compiled to this:
        switch int %tmp.7, label %cond_false.2 [
                 int 123, label %cond_true.0
                 int 12321, label %cond_true.1
                 int 111, label %cond_true.2
                 int 222, label %cond_true.2
        ]
...
cond_false.2:           ; preds = %entry
        %tmp.52 = seteq int %tmp.7, 875         ; <bool> [#uses=1]
        br bool %tmp.52, label %cond_true.3, label %cond_false.3

where the branch could be folded into the switch.

This kind of thing occurs *ALL OF THE TIME*, especially in programs like
176.gcc, which is a horrible mess of code.  It contains stuff like *shudder*:

#define SWITCH_TAKES_ARG(CHAR) \
  (   (CHAR) == 'D' \
   || (CHAR) == 'U' \
   || (CHAR) == 'o' \
   || (CHAR) == 'e' \
   || (CHAR) == 'u' \
   || (CHAR) == 'I' \
   || (CHAR) == 'm' \
   || (CHAR) == 'L' \
   || (CHAR) == 'A' \
   || (CHAR) == 'h' \
   || (CHAR) == 'z')

and

#define CONST_OK_FOR_LETTER_P(VALUE, C)                 \
  ((C) == 'I' ? SMALL_INTVAL (VALUE)                    \
   : (C) == 'J' ? SMALL_INTVAL (-(VALUE))               \
   : (C) == 'K' ? (unsigned)(VALUE) < 32                \
   : (C) == 'L' ? ((VALUE) & 0xffff) == 0               \
   : (C) == 'M' ? integer_ok_for_set (VALUE)            \
   : (C) == 'N' ? (VALUE) < 0                           \
   : (C) == 'O' ? (VALUE) == 0                          \
   : (C) == 'P' ? (VALUE) >= 0                          \
   : 0)

and

#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)                     \
{                                                               \
  if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 0),                   \
                   copy_to_mode_reg (SImode, XEXP (X, 1)));     \
  if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 1),                   \
                   copy_to_mode_reg (SImode, XEXP (X, 0)));     \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT)   \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 1),                   \
                   force_operand (XEXP (X, 0), 0));             \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT)   \
    (X) = gen_rtx (PLUS, SImode, XEXP (X, 0),                   \
                   force_operand (XEXP (X, 1), 0));             \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS)   \
    (X) = gen_rtx (PLUS, Pmode, force_operand (XEXP (X, 0), NULL_RTX),\
                   XEXP (X, 1));                                \
  if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS)   \
    (X) = gen_rtx (PLUS, Pmode, XEXP (X, 0),                    \
                   force_operand (XEXP (X, 1), NULL_RTX));      \
  if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST       \
           || GET_CODE (X) == LABEL_REF)                        \
    (X) = legitimize_address (flag_pic, X, 0, 0);               \
  if (memory_address_p (MODE, X))                               \
    goto WIN; }

and others.  These macros get used multiple times of course.  These are such
lovely candidates for macros, aren't they?  :)

This code also nicely handles LLVM constructs that look like this:

  if (isa<CastInst>(I))
   ...
  else if (isa<BranchInst>(I))
   ...
  else if (isa<SetCondInst>(I))
   ...
  else if (isa<UnwindInst>(I))
   ...
  else if (isa<VAArgInst>(I))
   ...

where the isa can obviously be a dyn_cast as well.  Switch instructions are a
good thing.

llvm-svn: 11870
2004-02-26 07:13:46 +00:00
Chris Lattner
7845e4f7f0 If a block is made dead, make sure to promptly remove it.
llvm-svn: 11799
2004-02-24 16:09:21 +00:00
Chris Lattner
d678669018 Implement SimplifyCFG/switch_switch_fold.ll
This case occurs many times in various benchmarks, especially when combined
with the previous patch.  This allows it to get stuff like:
  if (X == 4 || X == 3)
    if (X == 5 || X == 8)

and

switch (X) {
case 4: case 5: case 6:
  if (X == 4 || X == 5)

llvm-svn: 11797
2004-02-24 07:23:58 +00:00
Chris Lattner
1293e1d00c Rearrange code a bit
llvm-svn: 11793
2004-02-24 05:54:22 +00:00
Chris Lattner
e5db7dc4c6 Implement: test/Regression/Transforms/SimplifyCFG/switch_create.ll
This turns code like this:
  if (X == 4 | X == 7)
and
  if (X != 4 & X != 7)
into switch instructions.

llvm-svn: 11792
2004-02-24 05:38:11 +00:00
Chris Lattner
4fa2e7a67f Fix PR245: Linking weak and strong global variables is dependent on link order
llvm-svn: 11565
2004-02-17 21:56:04 +00:00
Chris Lattner
f51bbb7eec Implement test/Regression/Transforms/SimplifyCFG/UncondBranchToReturn.ll,
see the testcase for the reasoning.

llvm-svn: 11496
2004-02-16 06:35:48 +00:00
Chris Lattner
28131460da Adjustments to support the new ConstantAggregateZero class
llvm-svn: 11474
2004-02-15 05:55:15 +00:00
Chris Lattner
2265790f9f Fix compilation of 126.gcc: intrinsic functions cannot throw, so they are not
allowed in invoke instructions.  Thus, if we are inlining a call to an intrinsic
function into an invoke site, we don't need to turn the call into an invoke!

llvm-svn: 11384
2004-02-13 16:47:35 +00:00
Chris Lattner
4418633216 Implement SimplifyCFG/PhiEliminate.ll
Having a proper 'select' instruction would allow the elimination of a lot
of the special case cruft in this patch, but we don't have one yet.

llvm-svn: 11307
2004-02-11 03:36:04 +00:00
Chris Lattner
754914b142 The hasConstantReferences predicate always returns false.
llvm-svn: 11301
2004-02-11 01:17:07 +00:00
Chris Lattner
68fdb35576 rename the "exceptional" destination of an invoke instruction to the 'unwind' dest
llvm-svn: 11202
2004-02-08 21:44:31 +00:00
Chris Lattner
342b7276d6 Minor speedup, don't query ValueMap each time through the loop
llvm-svn: 11123
2004-02-04 21:44:26 +00:00
Chris Lattner
cbe1dd55f4 Two changes:
1. Don't scan to the end of alloca instructions in the caller function to
     insert inlined allocas, just insert at the top.  This saves a lot of
     time inlining into functions with a lot of allocas.
  2. Use splice to move the alloca instructions over, instead of remove/insert.
     This allows us to transfer a block at a time, and eliminates a bunch of
     silly symbol table manipulations.

This speeds up the inliner on the testcase in PR209 from 1.73s -> 1.04s (67%)

llvm-svn: 11118
2004-02-04 21:33:42 +00:00
Chris Lattner
790d7321b4 Optimize the case where we are inlining a function that contains only one basic block,
and that basic block ends with a return instruction.  In this case, we can just splice
the cloned "body" of the function directly into the source basic block, avoiding a lot
of rearrangement and splitBasicBlock's linear scan over the split block.  This speeds up
the inliner on the testcase in PR209 from 2.3s to 1.7s, a 35% reduction.

llvm-svn: 11116
2004-02-04 04:17:06 +00:00
Chris Lattner
8f0a362cd4 More refactoring. Move alloca instructions and handle invoke instructions
before we delete the original call site, allowing slight simplifications of
code, but nothing exciting.

llvm-svn: 11109
2004-02-04 02:51:48 +00:00
Chris Lattner
ab01a0e982 Move the cloning of the function body much earlier in the inlinefunction
process.  The only optimization we did so far is to avoid creating a
PHI node, then immediately destroying it in the common case where the
callee has one return statement.  Instead, we just don't create the return
value.  This has no noticable performance impact, but paves the way for
future improvements.

llvm-svn: 11108
2004-02-04 01:41:09 +00:00
Chris Lattner
aa44b4de3e Give CloneBasicBlock an optional function argument to specify which function
to add the cloned block to.  This allows the block to be added to the function
immediately, and all of the instructions to be immediately added to the function
symbol table, which speeds up the inliner from 3.7 -> 3.38s on the PR209.

llvm-svn: 11107
2004-02-04 01:19:43 +00:00
Chris Lattner
2998d508b0 Bunch up all locally used allocas by the block they are allocated in, and
process them all as a group.  This speeds up SRoA/mem2reg from 28.46s to
0.62s on the testcase from PR209.

llvm-svn: 11100
2004-02-03 22:34:12 +00:00
Chris Lattner
eee884cc98 Handle extremely trivial cases extremely efficiently. This speeds up
SRoA/mem2reg from 41.2s to 27.5s on the testcase in PR209.

llvm-svn: 11099
2004-02-03 22:00:33 +00:00
Chris Lattner
7bfaf8bba8 Clean up #includes
llvm-svn: 10799
2004-01-12 19:56:36 +00:00
Chris Lattner
47e9056669 Remove use of ConstantExpr::getShift
llvm-svn: 10792
2004-01-12 19:10:58 +00:00
Chris Lattner
23da5dbed6 Remove use of ConstantHandling
llvm-svn: 10789
2004-01-12 18:35:03 +00:00
Chris Lattner
7242f6af5f Move llvm::ConstantFoldInstruction from VMCore to here, next to ConstantFoldTerminator
llvm-svn: 10785
2004-01-12 18:25:22 +00:00
Chris Lattner
40c667e0bc Implement Transforms/ScalarRepl/phinodepromote.ll, which is an important
case that the C/C++ front-end generates.

llvm-svn: 10761
2004-01-12 01:18:32 +00:00
Chris Lattner
031bd7e9f3 Finegrainify namespacification
llvm-svn: 10727
2004-01-09 06:12:26 +00:00
Chris Lattner
c1952a1fd6 Add new function
llvm-svn: 10529
2003-12-19 05:56:28 +00:00
Chris Lattner
2b7309dd1c Minor cleanups and simplifications
llvm-svn: 10127
2003-11-21 16:52:05 +00:00
Chris Lattner
feeb3261f2 Start using the nicer terminator auto-insertion API
llvm-svn: 10111
2003-11-20 18:25:24 +00:00
Chris Lattner
071bf19ef5 Spew symbolic types!
llvm-svn: 10110
2003-11-20 18:23:14 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner
7dd63c59d1 Reorganize code for locality, improve comments
llvm-svn: 9857
2003-11-10 04:42:42 +00:00
Chris Lattner
e0d83d79e4 Adjust to new critical edge interface
llvm-svn: 9853
2003-11-10 04:10:50 +00:00
Chris Lattner
8e2385eb4d Various cleanups and efficiency improvements
llvm-svn: 9753
2003-11-06 19:46:29 +00:00
Chris Lattner
a8d3699eb3 Yet more fixes for constant expr shifts
llvm-svn: 9739
2003-11-05 20:43:58 +00:00
Chris Lattner
dba798775b Further fixes for PR93
llvm-svn: 9738
2003-11-05 20:37:01 +00:00
John Criswell
3e30e40801 Checking in Chris's suggestions:
Added assert() to ensure symbol table is well formed.
Added code to remember the value that was found; resolving types can change
the symbol table and invalidate the value of the iterator.
Added comments to the ResolveTypes() function (mainly for my own benefit).
Please feel free to correct the comments if they are not accurate.

llvm-svn: 9693
2003-11-04 15:22:26 +00:00
Chris Lattner
00fed59c28 Fix test: Linker/2003-10-27-LinkOncePromote.ll
Fix PR58

llvm-svn: 9530
2003-10-27 16:39:39 +00:00
Chris Lattner
4fb1540128 Get the list of PHI node values before the basic block is split. Also, add
PHI node entries for unwind instructions just like for call instructions which
became invokes!  This fixes PR57, tested by
Inline/2003-10-26-InlineInvokeExceptionDestPhi.ll

llvm-svn: 9526
2003-10-27 05:33:09 +00:00
Chris Lattner
1519122fa7 Fix bug: Linker/2003-10-21-ConflictingTypesTolerance.ll
llvm-svn: 9357
2003-10-21 22:46:38 +00:00
Chris Lattner
4f65be9ac3 Fix message to make more sense and confuse Chris less
llvm-svn: 9354
2003-10-21 21:52:20 +00:00
John Criswell
de34542f41 Added LLVM copyright header.
llvm-svn: 9321
2003-10-21 15:17:13 +00:00
John Criswell
71d2894956 Added LLVM copyright notice to Makefiles.
llvm-svn: 9312
2003-10-20 22:26:57 +00:00
John Criswell
b402729b30 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
e4a69325ff Fix PR#50
llvm-svn: 9227
2003-10-18 06:14:59 +00:00
Chris Lattner
f46c45682a Add support for 'weak' linkage.
llvm-svn: 9171
2003-10-16 18:29:00 +00:00
Chris Lattner
c6778e91f4 Cleanup
llvm-svn: 9133
2003-10-15 16:42:21 +00:00
Chris Lattner
a567862e89 Do not move variable sized allocations to the top of the caller, which might
break dominance relationships, and is otherwise bad.  This fixes bug:
Inline/2003-10-13-AllocaDominanceProblem.ll.  This also fixes miscompilation
of 3 176.gcc source files (reload1.c, global.c, flow.c)

llvm-svn: 9109
2003-10-14 01:11:07 +00:00
Chris Lattner
f4ca01758d Rename loop preheaders pass to loop simplify
llvm-svn: 9061
2003-10-12 21:52:28 +00:00
Misha Brukman
868eac95dd Fix spelling.
llvm-svn: 9027
2003-10-10 17:57:28 +00:00
Chris Lattner
5b814e067a Avoid doing pointless work. Amazingly, this makes us go faster.
Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s.

In release mode, it went from taking 25.8741s to taking 11.5712s.

This also fixes a FIXME.

llvm-svn: 8890
2003-10-06 15:23:43 +00:00
Chris Lattner
87f1ce9b96 This changes the PromoteMemToReg function to create "pruned" SSA form, not
"minimal" SSA form (in other words, it doesn't insert dead PHIs).  This
speeds up the mem2reg pass very significantly because it doesn't have to
do a lot of frivolous work in many common cases.

In the 252.eon function I have been playing with, this doesn't even insert
the 120 PHI nodes that it used to which were trivially dead (in the process
of promoting 356 alloca instructions overall).  This speeds up the mem2reg
pass from 1.2459s to 0.1284s.  More significantly, the DCE pass used to take
2.4138s to remove the 120 dead PHI nodes that mem2reg constructed, now it
takes 0.0134s (which is the time to scan the function and decide that there
is nothing dead).  So overall, on this one function, we speed things up a
total of 3.5179s, which is a 24.8x speedup!  :)

This change is tested by the Mem2Reg/2003-10-05-DeadPHIInsertion.ll test,
which now passes.

llvm-svn: 8884
2003-10-05 22:19:20 +00:00
Chris Lattner
d1c3f771f8 Change the interface to PromoteMemToReg to also take a DominatorTree
llvm-svn: 8883
2003-10-05 21:20:13 +00:00
Chris Lattner
47c12a2771 Speed up the mem2reg transform for allocas which are only read/written in a single
basic block.  This is amazingly common in code generated by the C/C++ front-ends.
This change makes it not have to insert ANY phi nodes, whereas before it would insert
a ton of dead ones which DCE would have to clean up.

Thus, this fix improves compile-time performance of these trivial allocas in two ways:
  1. It doesn't have to do the walking and book-keeping for renaming
  2. It does not insert dead phi nodes for them which would have to
     subsequently be cleaned up.

On my favorite testcase from 252.eon, this special case handles 305 out of
356 promoted allocas in the function.  It speeds up the mem2reg pass from 7.5256s
to 1.2505s.  It inserts 677 fewer dead PHI nodes, which speeds up a subsequent
-dce pass from 18.7524s to 2.4806s.

There are still 120 trivially dead PHI nodes being inserted for variables used
in multiple basic blocks, but they are not handled by this patch.

llvm-svn: 8881
2003-10-05 20:54:03 +00:00
Chris Lattner
ada012bfcd The first PHI node may be null, scan for the first non-null one
llvm-svn: 8865
2003-10-05 05:34:39 +00:00
Chris Lattner
a5fd39ee21 The VersionNumbers vector is only used during PHI placement. Turn it into an argument, allowing us to get rid of the vector.
llvm-svn: 8864
2003-10-05 04:33:22 +00:00
Chris Lattner
4877c37b80 * Update file header comment
*** Revamp the code which handled unreachable code in the function.  Now the
    code is much more efficient for high-degree basic blocks, such as those
    that occur in the 252.eon SPEC benchmark.

For the interested, the time to promote a SINGLE alloca in _ZN7mrScene4ReadERSi
function used to be > 3.5s.  Now it is < .075s.  The function has a LOT of
allocas in it, so it appeared to be infinite looping, this should make it much
nicer.  :)

llvm-svn: 8863
2003-10-05 04:26:39 +00:00
Chris Lattner
baba417853 Simplify the loop a bit
llvm-svn: 8862
2003-10-05 03:45:44 +00:00
Chris Lattner
59281d3581 There is no need for separate WriteSets and PhiNodeBlocks lists. It is just a
work-list of value definitions.  This allows elimination of the explicit
'iterative' step of the algorithm, and also reuses temporary memory better.

llvm-svn: 8861
2003-10-05 03:39:10 +00:00
Chris Lattner
5958d93c95 The PhiNodes 2D vector is only used during PHI node placement. It doesn't
need to be an instance variable!

llvm-svn: 8860
2003-10-05 03:26:25 +00:00
Chris Lattner
91d69f2693 * Document instance vars better
* Fuse two parallel loops
* Use a more specific type for AllocaLookup

llvm-svn: 8859
2003-10-05 03:16:07 +00:00
Chris Lattner
773a1c4474 Two small cleanups/speedups:
* Do not insert a new entry into NewPhiNodes during the rename pass if there are no PHIs in a block.
 * Do not compute WriteSets in parallel

llvm-svn: 8858
2003-10-05 02:37:36 +00:00
Chris Lattner
9f0a542057 * Minor cleanups
* Eliminate the KillList instance variable, instead, just delete loads and
  stores as they are "renamed", and delete allocas when they are done
* Make the 'visited' set an instance variable to avoid passing it on the stack.

llvm-svn: 8857
2003-10-05 01:52:53 +00:00
Chris Lattner
253c5f582e Fix bugs in the last change
llvm-svn: 8667
2003-09-22 23:30:59 +00:00
Chris Lattner
7ff5b8a024 Fix bug: Inline/2003-09-22-PHINodesInNormalInvokeDest.ll
llvm-svn: 8666
2003-09-22 22:35:39 +00:00
Chris Lattner
2cb1e9f0a6 Fix bug: Inline/2003-09-22-PHINodesInExceptionDest.ll
... by making sure to update PHI nodes to take into consideration the
extra edges we get if we inline a call instruction through an invoke.

llvm-svn: 8664
2003-09-22 21:59:27 +00:00
Chris Lattner
fabd2617fc Minor cleanups, no functional changes
Rename Function::getEntryNode -> getEntryBlock

llvm-svn: 8623
2003-09-20 14:36:23 +00:00
Chris Lattner
7a55e0b56d Fix bug: Inline/2003-09-14-InlineValue.ll
llvm-svn: 8514
2003-09-15 02:10:16 +00:00
Chris Lattner
ee577bdc08 Expand the pass to unify all of the unwind blocks as well
llvm-svn: 8456
2003-09-10 20:34:51 +00:00
Chris Lattner
e8ae7bf114 Eliminate support for the llvm.unwind intrinisic, using the Unwind instruction instead
llvm-svn: 8411
2003-09-08 19:44:26 +00:00
Chris Lattner
5f9de6e523 Should invokify is always true
llvm-svn: 8409
2003-09-08 19:00:30 +00:00
Chris Lattner
a295c0d706 Fix bug where we considered function types equivalent even if they had differing numbers of arguments
llvm-svn: 8178
2003-08-28 16:42:50 +00:00
Chris Lattner
399ad7c300 Remove special casing
llvm-svn: 8144
2003-08-25 22:34:15 +00:00
Chris Lattner
bca7655aa9 Fix bug: Linker/2003-08-23-GlobalVarLinking.ll
llvm-svn: 8130
2003-08-24 19:30:20 +00:00
Chris Lattner
64c658e617 Implement: Linker/2003-08-24-InheritPtrSize.ll
llvm-svn: 8129
2003-08-24 19:26:42 +00:00
Chris Lattner
a0203709f4 Implement SimplifyCFG/InvokeEliminate.ll
llvm-svn: 8126
2003-08-24 18:36:16 +00:00
Chris Lattner
7e3e38b76d rethrow is really the language independent primitive here. "throw" can be written
in terms of it and llvm.exc.setcurrent.
Rework the intrinsics.

llvm-svn: 8111
2003-08-24 12:24:11 +00:00
Chris Lattner
d5be33fded *** Implement inlining of Invoke instructions!
llvm-svn: 8106
2003-08-24 06:59:16 +00:00
Chris Lattner
b3db526a4f Implement: Inline/cfg_preserve_test.ll
llvm-svn: 8099
2003-08-24 04:06:56 +00:00
Chris Lattner
c499f5486f Implement SimplifyCFG/2003-08-17-FoldSwitch.ll:test5
llvm-svn: 8093
2003-08-23 23:18:19 +00:00
Chris Lattner
9274d2d21a Do not consider any types that exist in the global symbol table!
llvm-svn: 8084
2003-08-23 21:32:24 +00:00
Chris Lattner
c94a7e8904 Fix bug: Linker/2003-08-23-RecursiveOpaqueTypeResolve.ll
llvm-svn: 8083
2003-08-23 21:25:54 +00:00
Chris Lattner
f063146af6 Implement Linker/2003-08-23-GlobalVarLinking.ll, which should fix 176.gcc
llvm-svn: 8080
2003-08-23 20:31:10 +00:00
Chris Lattner
d6bf205b7d Fix typeo
llvm-svn: 8059
2003-08-22 20:16:48 +00:00
Chris Lattner
fafb0d5a3c The process of linking types can cause their addresses to become invalid. For this reason, we must use TypeHandles!
llvm-svn: 8057
2003-08-22 19:12:55 +00:00
Chris Lattner
b382d33401 Implement Linker/2003-08-20-OpaqueTypeResolve.ll
Hopefully this will fix the 176.gcc spec test as well.

llvm-svn: 8051
2003-08-22 06:07:12 +00:00
Misha Brukman
56f7db4178 Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Chris Lattner
382a3a3708 Implement folding of switch instructions.
Implements SimplifyCFG/2003-08-17-FoldSwitch.ll

llvm-svn: 7923
2003-08-17 20:21:14 +00:00
Chris Lattner
1f5afd2a1c Fix bug: SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
llvm-svn: 7921
2003-08-17 19:41:53 +00:00
Chris Lattner
17f985bfa4 The fixme is irrelevant: if that happens, the LLVM bytecode is malformed.
This fixes testcase: SimplifyCFG/2003-08-17-BranchFold.ll

llvm-svn: 7919
2003-08-17 19:34:55 +00:00
Chris Lattner
488b0e52a8 Fix bug: SimplifyCFG/2003-08-05-InvokeCrash.ll
Fix bug: SimplifyCFG/2003-08-05-MishandleInvoke.ll

llvm-svn: 7599
2003-08-05 16:27:44 +00:00
Tanya Lattner
eaa01f0821 Fixed comment width, changed arg to be const, fixed indentation, removed unnecessary includes.
llvm-svn: 6476
2003-05-31 20:01:37 +00:00
Tanya Lattner
ce23a1f169 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.

llvm-svn: 6431
2003-05-30 15:50:18 +00:00
Chris Lattner
01cbfa9317 Eliminate unnecessary ->get calls that are now automatically handled.
llvm-svn: 6397
2003-05-29 15:12:27 +00:00
Chris Lattner
24947af013 * Separate all of the grunt work of inlining out into the Utils library.
* Make the function inliner _significantly_ smarter.  :)

llvm-svn: 6396
2003-05-29 15:11:31 +00:00
Chris Lattner
e58f6153f4 Remove using declarations
llvm-svn: 6306
2003-05-22 22:00:07 +00:00
Misha Brukman
825e174bf7 Hopefully, the final fix for `[Pp]ropogate'.
llvm-svn: 6251
2003-05-20 21:01:22 +00:00
Chris Lattner
d0f6311c43 Fix Bug: Linker/2003-05-15-TypeProblem.ll
llvm-svn: 6225
2003-05-15 16:30:55 +00:00
Chris Lattner
be0b81a4e9 Fix major problem with appending linkage changes
llvm-svn: 6185
2003-05-14 12:11:51 +00:00
Chris Lattner
576323e25e Implement linkage of appending global variables!
llvm-svn: 6178
2003-05-13 21:33:43 +00:00
Chris Lattner
e1c995e9b6 Fix bug: mem2reg/2003-04-24-MultipleIdenticalSuccessors.ll
llvm-svn: 5919
2003-04-25 00:54:58 +00:00
Chris Lattner
043b4a7621 Fix iterator invalidation problem
llvm-svn: 5895
2003-04-24 17:52:20 +00:00
Chris Lattner
f0c01a508b Make sure that the cloned module retains the type symbol table entries!
llvm-svn: 5894
2003-04-24 17:15:33 +00:00
Chris Lattner
868b3316c9 Make sure to preserve endiannes and pointer size when cloning modules!
llvm-svn: 5892
2003-04-24 15:54:40 +00:00
Chris Lattner
b6050c264d Fix Bug: Linker/2003-04-23-LinkOnceLost.ll
llvm-svn: 5879
2003-04-23 18:38:39 +00:00
Chris Lattner
db6b7ba364 Remove unnecesary &*'s
llvm-svn: 5872
2003-04-23 16:37:45 +00:00
Chris Lattner
69b54208f4 Add warning when linking modules with disagreeing target properties
llvm-svn: 5845
2003-04-22 19:13:20 +00:00
Chris Lattner
ce0beca3fc Preserve the new moduleID field
llvm-svn: 5835
2003-04-22 18:02:26 +00:00
Chris Lattner
21967df20a Fix bug: 2003-01-30-LinkerRename.ll
llvm-svn: 5828
2003-04-21 21:15:04 +00:00
Chris Lattner
6da72fd92a Fix linking a function with qualifiers to a external function declaration:
Fixed bug: Linker/2003-04-21-Linkage.ll

llvm-svn: 5827
2003-04-21 21:07:05 +00:00
Chris Lattner
a489b529fe Fix bug where use still existed in dead code
llvm-svn: 5824
2003-04-21 19:15:26 +00:00
Chris Lattner
61d704329e Fix bug: Mem2reg/2003-04-18-DeadBlockProblem.ll
llvm-svn: 5810
2003-04-18 19:25:22 +00:00
Chris Lattner
f171f30deb Refactor CloneFunction to expose the new CloneBasicBlock function
llvm-svn: 5806
2003-04-18 03:50:09 +00:00
Chris Lattner
5403f79db0 New const_cast instead of c style cast
llvm-svn: 5805
2003-04-18 03:49:49 +00:00
Chris Lattner
fa4f750f3e Add new linkage types to support a real frontend
llvm-svn: 5786
2003-04-16 20:28:45 +00:00
Chris Lattner
0ac391e6c8 * 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.

llvm-svn: 5771
2003-04-10 19:41:13 +00:00
Chris Lattner
44370a85d9 * We now preserve the no-critical-edge pass (because we cannot insert critical edges)
* Small modification to be more efficient

llvm-svn: 5757
2003-03-31 17:30:25 +00:00
Chris Lattner
9f2f48a648 Fix bug: SimplifyCFG/2003-03-07-DominateProblem.ll
llvm-svn: 5722
2003-03-07 18:13:41 +00:00
Chris Lattner
4a9f0be9dd Implement CFGSimplify/PhiBlockMerge*.ll
llvm-svn: 5702
2003-03-05 21:36:33 +00:00
Chris Lattner
e025920ff8 Implement testcase CFGSimplify/EqualPHIEdgeBlockMerge.ll
llvm-svn: 5699
2003-03-05 21:01:52 +00:00
Chris Lattner
a49e96dda5 Change the mem2reg interface to accept a TargetData argument
llvm-svn: 5685
2003-03-03 17:25:18 +00:00
Chris Lattner
497c0d443c Rename Instruction::hasSideEffects() -> mayWriteToMemory()
llvm-svn: 5620
2003-02-24 20:48:32 +00:00
Chris Lattner
2e4c1c8640 Split mem2reg promotion into two parts: a function which does the work, and
a pass which wraps the function.  This allows other passes to use the functionality

llvm-svn: 5610
2003-02-22 23:57:48 +00:00
Chris Lattner
283d117dad Clean up std namespace references
llvm-svn: 5608
2003-02-22 22:25:17 +00:00
Chris Lattner
f1f1b83cbe * Fix linking of opaque types and their non-opaque versions
* Fix bug: Linker/2003-01-30-LinkerTypeRename.ll

llvm-svn: 5441
2003-01-30 20:53:43 +00:00
Chris Lattner
f9ace7ffb1 Eliminate using decls
llvm-svn: 5439
2003-01-30 19:53:34 +00:00
Chris Lattner
31a6321785 Add debugging helper
llvm-svn: 5235
2003-01-13 00:52:25 +00:00
Vikram S. Adve
a9966ae8ad This file implements the function DemoteRegToStack(), which takes a
virtual register computed by an Instruction& X and replaces it with
a slot in the stack frame, allocated via alloca.

llvm-svn: 4964
2002-12-10 13:07:58 +00:00
Chris Lattner
fc15b7a661 Fix bug that was bugging bugpoint
llvm-svn: 4953
2002-12-07 21:27:16 +00:00
Chris Lattner
dd9d97436d Fix big bug introduced with symbol table changes
llvm-svn: 4885
2002-12-03 18:32:30 +00:00
Chris Lattner
6aa0ec26d5 Initial checkin of Module cloning support stuff
llvm-svn: 4788
2002-11-20 20:47:41 +00:00
Chris Lattner
b5027095e5 - Eliminated the deferred symbol table stuff in Module & Function, it really
wasn't an optimization and it was causing lots of bugs.

llvm-svn: 4779
2002-11-20 18:36:02 +00:00
Chris Lattner
ec0df74910 Fix minor bugs
llvm-svn: 4778
2002-11-20 18:32:31 +00:00
Chris Lattner
62629300d3 Remove unneccesary #include
llvm-svn: 4772
2002-11-19 23:12:53 +00:00
Chris Lattner
4053d2dd12 Implement the CloneFunction function
llvm-svn: 4771
2002-11-19 23:12:22 +00:00
Chris Lattner
e5a05ec13b Minor changes to cloning interface
llvm-svn: 4770
2002-11-19 22:54:01 +00:00
Chris Lattner
aff50cfe1d Fix two fixmes: integrate with inlining, and document
llvm-svn: 4769
2002-11-19 22:04:49 +00:00
Chris Lattner
27bf5916fb Rework inline pass to use cloning infrastructure to do the dirty work
llvm-svn: 4766
2002-11-19 21:54:07 +00:00
Chris Lattner
ccb8790bc4 Start using the new function cloning header
llvm-svn: 4764
2002-11-19 20:59:41 +00:00
Chris Lattner
1ec9725ef8 BreakCriticalEdges should update dominance frontier information as well as
other dominance stuff.  Patch contributed by Casey Carter

llvm-svn: 4457
2002-10-31 02:44:36 +00:00
Misha Brukman
c9c721edf0 Fix spelling of `propagate'.
llvm-svn: 4423
2002-10-29 23:06:16 +00:00
Chris Lattner
b565d3ac5b - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to
setPreservesCFG to be less confusing.

llvm-svn: 4255
2002-10-21 20:00:28 +00:00
Chris Lattner
82f54dca49 - Change Function's so that their argument list is populated when they are
constructed.  Before, external functions would have an empty argument list,
    now a Function ALWAYS has a populated argument list.

llvm-svn: 4149
2002-10-13 20:57:00 +00:00
Chris Lattner
d68e6d1718 - Fix bug: cee/2002-10-07-NoImmediateDominator.ll
llvm-svn: 4081
2002-10-08 21:53:51 +00:00
Chris Lattner
9c236351fd Changes to support PHINode::removeIncoming changes
llvm-svn: 4079
2002-10-08 21:36:33 +00:00
Chris Lattner
3cf20c3f14 Expose isCriticalEdge & SplitCriticalEdge methods from crit-edges pass
llvm-svn: 4075
2002-10-08 21:06:27 +00:00
Chris Lattner
7cf9f6f4b1 Updates to work with recent Statistic's changes:
* Renamed StatisticReporter.h/cpp to Statistic.h/cpp
    * Broke constructor to take two const char * arguments instead of one, so
      that indendation can be taken care of automatically.
    * Sort the list by pass name when printing
    * Make sure to print all statistics as a group, instead of randomly when
      the statistics dtors are called.
    * Updated ProgrammersManual with new semantics.

llvm-svn: 4002
2002-10-01 22:38:41 +00:00
Chris Lattner
f9676d651d - Cleanup break-crit-edges pass by making SplitCriticalEdge a member method.
- break-crit-edges pass does not invalidate loop-preheader pass.

llvm-svn: 3944
2002-09-26 16:18:51 +00:00
Chris Lattner
2cf19d980a - Fix bug: Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
llvm-svn: 3917
2002-09-24 21:19:41 +00:00
Chris Lattner
54cf78c786 Fix bug: SimplifyCFG/2002-09-24-PHIAssertion.ll
llvm-svn: 3913
2002-09-24 16:09:17 +00:00
Chris Lattner
a4f47fb77e - Do not expose Critical Edge breaking mechanics outside the BCE pass, thus
removing it from Transforms/Local.h and from Transforms/Utils/*

llvm-svn: 3911
2002-09-24 15:52:01 +00:00
Chris Lattner
25ba5ac7ce - Do not expose Critical Edge breaking mechanics outside the BCE pass, thus
removing it from Transforms/Local.h and from Transforms/Utils/*

llvm-svn: 3910
2002-09-24 15:51:56 +00:00
Chris Lattner
49588769e0 - Expose passinfo from BreakCriticalEdges pass so that it may be "Required"
by other passes.  Make BCE pass be in anonymous namespace now.

llvm-svn: 3907
2002-09-24 15:43:12 +00:00
Chris Lattner
4e11d9e5de Minor cleanups
llvm-svn: 3904
2002-09-24 00:09:26 +00:00
Chris Lattner
e62cdff96c Add new BreakCriticalEdges pass
llvm-svn: 3903
2002-09-24 00:08:39 +00:00
Chris Lattner
aecb825629 Insert resolved constants into the global map so they are reused correctly.
This bug was exposed linking the SPEC benchmark suite.

llvm-svn: 3888
2002-09-23 18:14:15 +00:00
Chris Lattner
d6fed79df6 Fix bug I introduced with one of my previous changes.
Thanks fly out to Nick for noticing it!  :)

llvm-svn: 3691
2002-09-12 19:00:43 +00:00
Chris Lattner
62bd3a248c Fix bugs in previous checkins
llvm-svn: 3673
2002-09-10 23:31:28 +00:00
Chris Lattner
3b3e26bb63 Fix minor problems in previous checkin
llvm-svn: 3668
2002-09-10 22:52:49 +00:00
Chris Lattner
f2e4e61769 Clean up code due to auto-insert constructors
llvm-svn: 3666
2002-09-10 22:38:49 +00:00
Chris Lattner
37c3a1d80c Clean up code due to auto-insert constructors
llvm-svn: 3665
2002-09-10 22:38:47 +00:00
Chris Lattner
bf38fcf5ee Fix file header to be accurate, instead of something I just copied and pasted.
llvm-svn: 3591
2002-09-06 03:59:56 +00:00
Chris Lattner
78a3ebaa18 Fix bug with critical edge splitting code where it wouldn't update PHI nodes
in the old destination block to indicate that the value flows from the new
edge splitting block, not from the original multi-successor block.

llvm-svn: 3590
2002-09-06 03:51:45 +00:00
Chris Lattner
c3c754062f Check in the implementation of critical edge detection and splitting
llvm-svn: 3588
2002-09-06 02:35:34 +00:00
Chris Lattner
20b85d96e4 Eliminated the MemAccessInst class, folding contents into GEP class.
llvm-svn: 3487
2002-08-22 23:37:20 +00:00
Chris Lattner
6c83ee57c1 - Do not expose ::ID from any of the analyses anymore.
llvm-svn: 3417
2002-08-21 17:09:49 +00:00
Chris Lattner
af538ea2c9 fixed bug: test/Regression/Linker/2002-08-20-ConstantExpr.ll
llvm-svn: 3412
2002-08-20 19:35:11 +00:00
Chris Lattner
6a9d88347a Remove support for Not ConstantExpr. This simplifies the unary case to only
have to support the cast instruction, so the function is renamed to getCast.

llvm-svn: 3328
2002-08-14 18:24:09 +00:00
Chris Lattner
a21e315db4 - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument

llvm-svn: 3265
2002-08-08 19:01:30 +00:00
Chris Lattner
12b9a2a7e6 Cleanup ConstantExpr handling:
* Correctly delete TypeHandles in AsmParser.  In addition to not leaking
   memory, this prevents a bug that could have occurred when a type got
   resolved that the constexpr was using
 * Check for errors in the AsmParser instead of hitting assertion failures
   deep in the code
 * Simplify the interface to the ConstantExpr class, removing unneccesary
   parameters to the ::get* methods.
 * Rename the 'getelementptr' version of ConstantExpr::get to
   ConstantExpr::getGetElementPtr

llvm-svn: 3160
2002-07-30 18:54:22 +00:00
Chris Lattner
902619d2f1 Remove FIXME's that aren't really needed after all.
llvm-svn: 3158
2002-07-30 16:38:54 +00:00
Chris Lattner
078c1024c0 Implement a new RemoveSuccessor function
llvm-svn: 3131
2002-07-29 22:32:08 +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
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
0702eb18e6 *** empty log message ***
llvm-svn: 3072
2002-07-24 22:40:39 +00:00
Chris Lattner
c482880f9e *** empty log message ***
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner
24bcbdd155 *** empty log message ***
llvm-svn: 3002
2002-07-23 17:52:38 +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
b121676038 Implement linking of ConstExprs
llvm-svn: 2946
2002-07-18 00:13:08 +00:00
Chris Lattner
a590093513 *** empty log message ***
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Anand Shukla
3ab9ffd5b1 changes to make it compatible with 64bit gcc
llvm-svn: 2795
2002-06-25 21:18:19 +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
cee706572b *** empty log message ***
llvm-svn: 2777
2002-06-25 16:12:52 +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
e7ce749d63 Add implementation of SimplifyCFG
llvm-svn: 2701
2002-05-21 20:50:24 +00:00
Chris Lattner
4b29ff417d Simplify interface to ConstantFoldTerminator
llvm-svn: 2697
2002-05-21 20:04:50 +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