Chris Lattner
abb77c9959
Teach the optimizer to delete zero sized alloca's (but not mallocs!)
...
llvm-svn: 12507
2004-03-19 06:08:10 +00:00
Chris Lattner
232155dc1b
Fix bug: CodeExtractor/2004-03-17-MissedLiveIns.ll
...
With this fix we now successfully extract all 149 loops from 256.bzip2 without
crashing or miscompiling the program!
llvm-svn: 12493
2004-03-18 05:56:32 +00:00
Chris Lattner
e83693560a
Add statistics to the loop extractor. The loop extractor has successfully
...
extracted all 63 loops for Olden/bh without crashing and without
miscompiling the program!!!
llvm-svn: 12491
2004-03-18 05:46:10 +00:00
Chris Lattner
5bce0c807d
Fix problem with PHI nodes having multiple predecessors from different
...
exit nodes
llvm-svn: 12490
2004-03-18 05:43:18 +00:00
Chris Lattner
acd75986ee
Fix CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
...
llvm-svn: 12489
2004-03-18 05:38:31 +00:00
Chris Lattner
320d59f4cd
Seriously simplify and correct the PHI node handling code.
...
llvm-svn: 12487
2004-03-18 05:28:49 +00:00
Chris Lattner
d8017a340d
Fix CodeExtractor/2004-03-17-OutputMismatch.ll
...
llvm-svn: 12486
2004-03-18 04:12:05 +00:00
Chris Lattner
37de257ef0
Fix several bugs in the extractor:
...
1. Names were not put on the new arguments created (ok, this just helps sanity :)
2. Fix outgoing pointer values
3. Do not insert stores for values that had not been computed
4. Fix some wierd problems with the outset calculation
This fixes CodeExtractor/2004-03-14-DominanceProblem.ll, making the extractor
work on at least one simple case!
llvm-svn: 12484
2004-03-18 03:49:40 +00:00
Chris Lattner
e9235d2dde
The code extractor needs dominator info. Provide it
...
llvm-svn: 12483
2004-03-18 03:48:06 +00:00
Chris Lattner
cee3404d0a
Prune #includes, moving the module interface to the front. Note that this
...
exposed the fact that the header was not self-contained. There is a reason
we do things :)
llvm-svn: 12481
2004-03-18 03:15:29 +00:00
Chris Lattner
a078f47b39
Fix compilation of mesa, which I broke earlier today
...
llvm-svn: 12465
2004-03-17 02:02:47 +00:00
Chris Lattner
684fa5ac64
Be more accurate
...
llvm-svn: 12464
2004-03-17 01:59:27 +00:00
Chris Lattner
a3783a577e
Fix bug in previous checkin
...
llvm-svn: 12458
2004-03-16 23:36:49 +00:00
Chris Lattner
95057f6ad1
Okay, so there is no reasonable way for tail duplication to update SSA form,
...
as it is making effectively arbitrary modifications to the CFG and we don't
have a domset/domfrontier implementations that can handle the dynamic updates.
Instead of having a bunch of code that doesn't actually work in practice,
just demote any potentially tricky values to the stack (causing the problem
to go away entirely). Later invocations of mem2reg will rebuild SSA for us.
This fixes all of the major performance regressions with tail duplication
from LLVM 1.1. For example, this loop:
---
int popcount(int x) {
int result = 0;
while (x != 0) {
result = result + (x & 0x1);
x = x >> 1;
}
return result;
}
---
Used to be compiled into:
int %popcount(int %X) {
entry:
br label %loopentry
loopentry: ; preds = %entry, %no_exit
%x.0 = phi int [ %X, %entry ], [ %tmp.9, %no_exit ] ; <int> [#uses=3]
%result.1.0 = phi int [ 0, %entry ], [ %tmp.6, %no_exit ] ; <int> [#uses=2]
%tmp.1 = seteq int %x.0, 0 ; <bool> [#uses=1]
br bool %tmp.1, label %loopexit, label %no_exit
no_exit: ; preds = %loopentry
%tmp.4 = and int %x.0, 1 ; <int> [#uses=1]
%tmp.6 = add int %tmp.4, %result.1.0 ; <int> [#uses=1]
%tmp.9 = shr int %x.0, ubyte 1 ; <int> [#uses=1]
br label %loopentry
loopexit: ; preds = %loopentry
ret int %result.1.0
}
And is now compiled into:
int %popcount(int %X) {
entry:
br label %no_exit
no_exit: ; preds = %entry, %no_exit
%x.0.0 = phi int [ %X, %entry ], [ %tmp.9, %no_exit ] ; <int> [#uses=2]
%result.1.0.0 = phi int [ 0, %entry ], [ %tmp.6, %no_exit ] ; <int> [#uses=1]
%tmp.4 = and int %x.0.0, 1 ; <int> [#uses=1]
%tmp.6 = add int %tmp.4, %result.1.0.0 ; <int> [#uses=2]
%tmp.9 = shr int %x.0.0, ubyte 1 ; <int> [#uses=2]
%tmp.1 = seteq int %tmp.9, 0 ; <bool> [#uses=1]
br bool %tmp.1, label %loopexit, label %no_exit
loopexit: ; preds = %no_exit
ret int %tmp.6
}
llvm-svn: 12457
2004-03-16 23:29:09 +00:00
Chris Lattner
bb1a2cc7ab
This code was both incredibly complex and incredibly broken. Fix it.
...
llvm-svn: 12456
2004-03-16 23:23:11 +00:00
Chris Lattner
fa48edfb7d
Punt if we see gigantic PHI nodes. This improves a huge interpreter loop
...
testcase from 32.5s in -raise to take .3s
llvm-svn: 12443
2004-03-16 19:52:53 +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
a64923ad26
Do not copy gigantic switch instructions
...
llvm-svn: 12441
2004-03-16 19:45:22 +00:00
Chris Lattner
db5b8f4d6b
Fix a regression from this patch:
...
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040308/013095.html
Basically, this patch only updated the immediate dominatees of the header node
to tell them that the preheader also dominated them. In practice, ALL
dominatees of the header node are also dominated by the preheader.
This fixes: LoopSimplify/2004-03-15-IncorrectDomUpdate.
and PR293
llvm-svn: 12434
2004-03-16 06:00:15 +00:00
Chris Lattner
95ce36da0d
Restore old inlining heuristic. As the comment indicates, this is a nasty
...
horrible hack.
llvm-svn: 12423
2004-03-15 06:38:14 +00:00
Chris Lattner
cd83282df1
Add counters for the number of calls elimianted
...
llvm-svn: 12420
2004-03-15 05:46:59 +00:00
Chris Lattner
20cda2645e
Implement LICM of calls in simple cases. This is sufficient to move around
...
sin/cos/strlen calls and stuff. This implements:
LICM/call_sink_pure_function.ll
LICM/call_sink_const_function.ll
llvm-svn: 12415
2004-03-15 04:11:30 +00:00
Chris Lattner
fb87cdecd8
Mostly cosmetic improvements. Do fix the bug where a global value was considered an input.
...
llvm-svn: 12406
2004-03-15 01:26:44 +00:00
Chris Lattner
73ab1fa7c8
Assert that input blocks meet the invariants we expect
...
Simplify the input/output finder. All elements of a basic block are
instructions. Any used arguments are also inputs. An instruction can only
be used by another instruction.
llvm-svn: 12405
2004-03-15 01:18:23 +00:00
Chris Lattner
2f155d8734
Fix several bugs in the loop extractor. In particular, subloops were never
...
extracted, and a function that contained a single top-level loop never had
the loop extracted, regardless of how much non-loop code there was.
llvm-svn: 12403
2004-03-15 00:02:02 +00:00
Chris Lattner
5b2072ecd3
No correctness fixes here, just minor qoi fixes:
...
* Don't insert a branch to the switch instruction after the call, just
make it a single block.
* Insert the new alloca instructions in the entry block of the original
function instead of having them execute dynamically
* Don't make the default edge of the switch instruction go back to the switch.
The loop extractor shouldn't create new loops!
* Give meaningful names to the alloca slots and the reload instructions
* Some minor code simplifications
llvm-svn: 12402
2004-03-14 23:43:24 +00:00
Chris Lattner
b4d8bf365c
Simplify code a bit, and fix bug CodeExtractor/2004-03-14-NoSwitchSupport.ll
...
This also implements a two minor improvements:
* Don't insert live-out stores IN the region, insert them on the code path
that exits the region
* If the region is exited to the same block from multiple paths, share the
switch statement entry, live-out store code, and the basic block.
llvm-svn: 12401
2004-03-14 23:05:49 +00:00
Chris Lattner
9c431f6c44
Simplify the code a bit by making the collection of basic blocks to extract
...
a member of the class. While we're at it, turn the collection into a set
instead of a vector to improve efficiency and make queries simpler.
llvm-svn: 12400
2004-03-14 22:34:55 +00:00
Chris Lattner
a1672c1bd8
Split into two passes. Now there is the general loop extractor, usable on
...
the command line, and the single loop extractor, usable by bugpoint
llvm-svn: 12390
2004-03-14 20:01:36 +00:00
Chris Lattner
0137de5ecb
Passes don't print stuff!
...
llvm-svn: 12385
2004-03-14 04:17:53 +00:00
Chris Lattner
b68659552a
Do not create empty basic blocks when the lowerswitch pass expects blocks to
...
be non-empty! This fixes LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll
llvm-svn: 12384
2004-03-14 04:14:31 +00:00
Chris Lattner
4fca71eb44
Minor random cleanups
...
llvm-svn: 12382
2004-03-14 04:01:47 +00:00
Chris Lattner
6c3e8c78cf
FunctionPass's should not define their own 'run' method.
...
Require 'simplified' loops, not just raw natural loops. This fixes
CodeExtractor/2004-03-13-LoopExtractorCrash.ll
llvm-svn: 12381
2004-03-14 04:01:06 +00:00
Chris Lattner
d078812f96
If a block is dead, dominators will not be calculated for it. Because of this
...
loop information won't see it, and we could have unreachable blocks pointing to
the non-header node of blocks in a natural loop. This isn't tidy, so have the
loopsimplify pass clean it up.
llvm-svn: 12380
2004-03-14 03:59:22 +00:00
Chris Lattner
3684469326
Verify functions as they are produced if -debug is specified. Reduce
...
curly braceage
llvm-svn: 12378
2004-03-14 03:17:22 +00:00
Chris Lattner
78a996aec4
Move prototype to IPO.h instead of Scalar.h
...
Make sure that the file interface header (IPO.h) is included first
remove dead #incldue
llvm-svn: 12375
2004-03-14 02:37:16 +00:00
Chris Lattner
692a47aeb9
Indent anon namespace properly, add copyright block
...
llvm-svn: 12373
2004-03-14 02:34:07 +00:00
Chris Lattner
41ec709e00
Move to the IPO library. Utils shouldn't contain passes.
...
llvm-svn: 12372
2004-03-14 02:32:27 +00:00
Chris Lattner
8eebc49884
DemoteRegToStack got moved from DemoteRegToStack.h to Local.h
...
llvm-svn: 12368
2004-03-14 02:13:38 +00:00
Chris Lattner
7d2a539735
Add some debugging output
...
Fix InstCombine/2004-03-13-InstCombineInfLoop.ll which caused an infinite
loop compiling (I think) povray.
llvm-svn: 12365
2004-03-13 23:54:27 +00:00
Chris Lattner
2dc85b27e4
This change makes two big adjustments.
...
* Be a lot more accurate about what the effects will be when inlining a call
to a function when an argument is an alloca.
* Dramatically reduce the penalty for inlining a call in a large function.
This heuristic made it almost impossible to inline a function into a large
function, no matter how small the callee is.
llvm-svn: 12363
2004-03-13 23:15:45 +00:00
Chris Lattner
797cb2f6c1
This little patch speeds up the loop used to update the dominator set analysis.
...
On the testcase from GCC PR12440, which has a LOT of loops (1392 of which require
preheaders to be inserted), this speeds up the loopsimplify pass from 1.931s to
0.1875s. The loop in question goes from 1.65s -> 0.0097s, which isn't bad. All of
these times are a debug build.
This adds a dependency on DominatorTree analysis that was not there before, but
we always had dominatortree available anyway, because LICM requires both loop
simplify and DT, so this doesn't add any extra analysis in practice.
llvm-svn: 12362
2004-03-13 22:01:26 +00:00
Chris Lattner
022167f13b
Implement sub.ll:test14
...
llvm-svn: 12355
2004-03-13 00:11:49 +00:00
Chris Lattner
92295c5031
Implement InstCombine/sub.ll:test12 & test13
...
llvm-svn: 12353
2004-03-12 23:53:13 +00:00
Chris Lattner
cb015ee6c0
Add constant folding wrapper support for select instructions.
...
llvm-svn: 12319
2004-03-12 05:53:03 +00:00
Chris Lattner
59db22dcd4
Add sccp support for select instructions
...
llvm-svn: 12318
2004-03-12 05:52:44 +00:00
Chris Lattner
b909e8b0d4
Add trivial optimizations for select instructions
...
llvm-svn: 12317
2004-03-12 05:52:32 +00:00
Chris Lattner
721264aecc
Initial support for edge profiling
...
llvm-svn: 12225
2004-03-08 17:54:34 +00:00
Chris Lattner
dae48f93b0
Split utility functions out of BlockProfiling.cpp
...
llvm-svn: 12224
2004-03-08 17:06:13 +00:00
Chris Lattner
d91e676700
finegrainify namespacification
...
llvm-svn: 12221
2004-03-08 16:45:53 +00:00
Chris Lattner
fe6f2e3e80
Implement ArgumentPromotion/aggregate-promote.ll
...
This allows pointers to aggregate objects, whose elements are only read, to
be promoted and passed in by element instead of by reference. This can
enable a LOT of subsequent optimizations in the caller function.
It's worth pointing out that this stuff happens a LOT of C++ programs, because
objects in templates are generally passed around by reference. When these
templates are instantiated on small aggregate or scalar types, however, it is
more efficient to pass them in by value than by reference.
This transformation triggers most on C++ codes (e.g. 334 times on eon), but
does happen on C codes as well. For example, on mesa it triggers 72 times,
and on gcc it triggers 35 times. this is amazingly good considering that
we are using 'basicaa' so far.
llvm-svn: 12202
2004-03-08 01:04:36 +00:00
Chris Lattner
cc544e57f3
Implement: ArgumentPromotion/chained.ll
...
llvm-svn: 12200
2004-03-07 22:52:53 +00:00
Chris Lattner
64b8d697ad
Fix another minor bug, exposed by perlbmk
...
llvm-svn: 12198
2004-03-07 22:43:27 +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
6770842b67
Fix a minor bug and turn debug output into, well, debug output.
...
llvm-svn: 12195
2004-03-07 21:54:50 +00:00
Chris Lattner
483ae01c9c
New LLVM pass: argument promotion. This version only handles simple scalar
...
variables.
llvm-svn: 12193
2004-03-07 21:29:54 +00:00
Chris Lattner
7abcc387de
Don't emit things like malloc(16*1). Allocation instructions are fixed arity now.
...
llvm-svn: 12086
2004-03-03 01:40:53 +00:00
Misha Brukman
f44acae31e
Implement ExtractCodeRegion()
...
llvm-svn: 12070
2004-03-02 00:20:57 +00:00
Misha Brukman
f272f9b3d5
Make a note that this is usually used via bugpoint.
...
llvm-svn: 12068
2004-03-02 00:19:09 +00:00
Misha Brukman
5af2be7d09
* Add implementation of ExtractBasicBlock()
...
* Add comments to ExtractLoop()
llvm-svn: 12053
2004-03-01 18:28:34 +00:00
Chris Lattner
5cf39339d1
Disable tail duplication in a case that breaks on Olden/tsp
...
llvm-svn: 12021
2004-03-01 01:12:13 +00:00
Misha Brukman
c91e1ff50d
* Remove function to find "main" in a Module, there's a method for that
...
* Removing extraneous empty space and empty comment lines
llvm-svn: 12014
2004-02-29 23:09:10 +00:00
Chris Lattner
2de229f31b
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
bf2963ef91
Fix PR255: [tailduplication] Single basic block loops are very rare
...
Note that this is a band-aid put over a band-aid. This just undisables
tail duplication in on very specific case that it seems to work in.
llvm-svn: 11989
2004-02-29 06:41:20 +00:00
Chris Lattner
d3e6ae263c
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
Chris Lattner
772eafa332
if there is already a prototype for malloc/free, use it, even if it's incorrect.
...
Do not just inject a new prototype.
llvm-svn: 11951
2004-02-28 18:51:45 +00:00
Chris Lattner
51ea127bf3
Rename AddUsesToWorkList -> AddUsersToWorkList, as that is what it does.
...
Create a new AddUsesToWorkList method
optimize memmove/set/cpy of zero bytes to a noop.
llvm-svn: 11941
2004-02-28 05:22:00 +00:00
Chris Lattner
f3a366062c
Turn 'free null' into nothing
...
llvm-svn: 11940
2004-02-28 04:57:37 +00:00
Misha Brukman
8a2c28fdda
Right, it's really Extractor, not Extraction.
...
llvm-svn: 11939
2004-02-28 03:37:58 +00:00
Misha Brukman
03a11340ff
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
caa1a5abeb
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
e82c217b2f
setcond instructions don't have aliasing implications.
...
llvm-svn: 11919
2004-02-27 18:09:25 +00:00
Chris Lattner
4f7accab96
Implement test/Regression/Transforms/InstCombine/canonicalize_branch.ll
...
This is a really minor thing, but might help out the 'switch statement induction'
code in simplifycfg.
llvm-svn: 11900
2004-02-27 06:27:46 +00:00
Chris Lattner
79636d7cd5
Since LLVM uses structure type equivalence, it isn't useful to keep around
...
multiple type names for the same structural type. Make DTE eliminate all
but one of the type names
llvm-svn: 11879
2004-02-26 20:02:23 +00:00
Chris Lattner
21e941fbfd
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
8d1da1abee
My faith in programmers has been found to be totally misplaced. One would
...
assume that if they don't intend to write to a global variable, that they
would mark it as constant. However, there are people that don't understand
that the compiler can do nice things for them if they give it the information
it needs.
This pass looks for blatently obvious globals that are only ever read from.
Though it uses a trivially simple "alias analysis" of sorts, it is still able
to do amazing things to important benchmarks. 253.perlbmk, for example,
contains several ***GIANT*** function pointer tables that are not marked
constant and should be. Marking them constant allows the optimizer to turn
a whole bunch of indirect calls into direct calls. Note that only a link-time
optimizer can do this transformation, but perlbmk does have several strings
and other minor globals that can be marked constant by this pass when run
from GCCAS.
176.gcc has a ton of strings and large tables that are marked constant, both
at compile time (38 of them) and at link time (48 more). Other benchmarks
give similar results, though it seems like big ones have disproportionally
more than small ones.
This pass is extremely quick and does good things. I'm going to enable it
in gccas & gccld. Not bad for 50 SLOC.
llvm-svn: 11836
2004-02-25 21:34:36 +00:00
Chris Lattner
9c6833c5ca
Fix incorrect debug code
...
llvm-svn: 11821
2004-02-25 15:15:04 +00:00
Chris Lattner
8ee0593f0d
Fix a faulty optimization on FP values
...
llvm-svn: 11801
2004-02-24 18:10:14 +00:00
Chris Lattner
90ea78edba
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
a2ab489135
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
3cd98f054a
Rearrange code a bit
...
llvm-svn: 11793
2004-02-24 05:54:22 +00:00
Chris Lattner
6f4b45acf5
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
ae739aefd7
Generate much more efficient code in programs like pifft
...
llvm-svn: 11775
2004-02-23 21:46:58 +00:00
Chris Lattner
c40b9d7d51
Fix a small typeo in my checkin last night that broke vortex and other programs :(
...
llvm-svn: 11774
2004-02-23 21:46:42 +00:00
Chris Lattner
f5ce254692
Fix InstCombine/2004-02-23-ShiftShiftOverflow.ll
...
Also, turn 'shr int %X, 1234' into 'shr int %X, 31'
llvm-svn: 11768
2004-02-23 20:30:06 +00:00
Chris Lattner
2b55ea38bc
Implement cast.ll::test14/15
...
llvm-svn: 11742
2004-02-23 07:16:20 +00:00
Chris Lattner
e79e854c5c
Refactor some code. In the mul - setcc folding case, we really care about
...
whether this is the sign bit or not, so check unsigned comparisons as well.
llvm-svn: 11740
2004-02-23 06:38:22 +00:00
Chris Lattner
c8a10c4b6a
Implement mul.ll:test11
...
llvm-svn: 11737
2004-02-23 06:00:11 +00:00
Chris Lattner
59611149ee
Implement "strength reduction" of X <= C and X >= C
...
llvm-svn: 11735
2004-02-23 05:47:48 +00:00
Chris Lattner
2635b52d4e
Implement InstCombine/mul.ll:test10, which is a case that occurs when dealing
...
with "predication"
llvm-svn: 11734
2004-02-23 05:39:21 +00:00
Chris Lattner
8d0bacbb9e
Implement Transforms/InstCombine/cast.ll:test13, a case which occurs in a
...
hot 164.gzip loop.
llvm-svn: 11702
2004-02-22 05:25:17 +00:00
Chris Lattner
693e393fee
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
e42732e75f
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
4db2d22bea
Fold PHI nodes of constants which are only used by a single cast. This implements
...
phi.ll:test4
llvm-svn: 11494
2004-02-16 05:07:08 +00:00
Chris Lattner
b36d908f7b
Teach LLVM to unravel the "swap idiom". This implements:
...
Regression/Transforms/InstCombine/xor.ll:test20
llvm-svn: 11492
2004-02-16 03:54:20 +00:00
Chris Lattner
c207635fd5
Implement Transforms/InstCombine/xor.ll:test19
...
llvm-svn: 11490
2004-02-16 01:20:27 +00:00
Chris Lattner
d85e061575
Instead of producing calls to setjmp/longjmp, produce uses of the
...
llvm.setjmp/llvm.longjmp intrinsics.
llvm-svn: 11482
2004-02-15 22:24:27 +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
37a716fa80
Remove dependence on return type of ConstantStruct::get
...
llvm-svn: 11466
2004-02-15 04:07:32 +00:00
Chris Lattner
c75bf528c1
Remove dependence on the return type of ConstantArray::get
...
llvm-svn: 11463
2004-02-15 04:05:58 +00:00
Chris Lattner
283ffdfac5
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
7db49ce5b4
Intrinsic functions cannot throw
...
llvm-svn: 11383
2004-02-13 16:46:46 +00:00
Chris Lattner
7cbb22abe6
Expose a pass ID that can be 'required'
...
llvm-svn: 11376
2004-02-13 16:16:16 +00:00
Chris Lattner
d4b36cf9bc
Remove obsolete comment. Unreachable blocks will automatically be left at the
...
end of the function.
llvm-svn: 11313
2004-02-11 05:20:50 +00:00
Chris Lattner
5add05129e
Add an _embarassingly simple_ implementation of basic block layout. This is
...
more of a testcase for profiling information than anything that should reasonably
be used, but it's a starting point. When I have more time I will whip this into
better shape.
llvm-svn: 11311
2004-02-11 04:53:20 +00:00
Chris Lattner
18d1f19fba
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
838b845781
The hasConstantReferences predicate always returns false.
...
llvm-svn: 11301
2004-02-11 01:17:07 +00:00
Chris Lattner
3232bbb9d8
initialization calls now return argc. If the program uses the argc value
...
passed into main, make sure they use the return value of the init call
instead of the one passed in.
llvm-svn: 11262
2004-02-10 17:41:01 +00:00
Chris Lattner
37d46f4815
Only add the global variable with the abort message if an unwind actually
...
occurs in the program.
llvm-svn: 11249
2004-02-09 22:48:47 +00:00
Chris Lattner
e3af6f73ce
Don't depend on auto data conversion
...
llvm-svn: 11229
2004-02-09 05:16:30 +00:00
Chris Lattner
ac6db755c3
Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
...
llvm-svn: 11228
2004-02-09 04:37:31 +00:00
Chris Lattner
fa829be4d3
Start using the new and improve interface to FunctionType arguments
...
llvm-svn: 11224
2004-02-09 04:14:01 +00:00
Chris Lattner
57ea2e3294
The ConstantExpr::getCast call can cause a CPR to be generated. If so,
...
strip it off.
llvm-svn: 11213
2004-02-09 00:20:55 +00:00
Misha Brukman
3480e935d0
Fix grammar-o.
...
llvm-svn: 11210
2004-02-08 22:27:33 +00:00
Chris Lattner
3b7f6b2217
Improve compatibility with programs that already have a prototype for 'write',
...
even if it is wierd in some way.
llvm-svn: 11207
2004-02-08 22:14:44 +00:00
Chris Lattner
fae8ab3088
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
56997dd283
Fix PR225: [pruneeh] -pruneeh pass removes invoke instructions it shouldn't
...
llvm-svn: 11200
2004-02-08 21:15:59 +00:00
Chris Lattner
071bc60450
splitBasicBlock "does the right thing" now, no reason to reposition it.
...
llvm-svn: 11199
2004-02-08 20:49:07 +00:00
Chris Lattner
108cadc274
Implement proper invoke/unwind lowering.
...
This fixed PR16 "[lowerinvoke] The -lowerinvoke pass does not insert calls to setjmp/longjmp"
llvm-svn: 11195
2004-02-08 19:53:56 +00:00
Chris Lattner
476488e669
Add a call to 'write' right before the call to abort() in the unwind path.
...
This causes the JIT, or LLC'd program to print out a nice message, explaining
WHY the program aborted.
llvm-svn: 11184
2004-02-08 07:30:29 +00:00
Chris Lattner
2dd1c8d8ce
Fix another dominator update bug. These bugs keep getting exposed because GCSE
...
keeps finding more code motion opportunities now that the dominators are correct!
llvm-svn: 11142
2004-02-05 23:20:59 +00:00
Chris Lattner
c0c953f0bc
Fix bug updating dominators
...
llvm-svn: 11140
2004-02-05 22:33:26 +00:00
Chris Lattner
f978c421e5
Add debug output
...
llvm-svn: 11139
2004-02-05 22:33:19 +00:00
Chris Lattner
14ab84a483
Fix PR223: Loopsimplify incorrectly updates dominator information
...
The problem is that the dominator update code didn't "realize" that it's
possible for the newly inserted basic block to dominate anything. Because
it IS possible, stuff was getting updated wrong.
llvm-svn: 11137
2004-02-05 21:12:24 +00:00
Chris Lattner
39ad6f2772
Minor speedup, don't query ValueMap each time through the loop
...
llvm-svn: 11123
2004-02-04 21:44:26 +00:00
Chris Lattner
6f8865bf9f
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
0fa8c7c321
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
8d414ad035
Adjust to the new BasicBlock ctor, which requires a function parameter
...
llvm-svn: 11114
2004-02-04 03:58:28 +00:00
Chris Lattner
0ff9da5fed
Remove unneeded code now that splitBasicBlock does the "right thing"
...
llvm-svn: 11111
2004-02-04 03:21:51 +00:00
Chris Lattner
18ef3fda57
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
9fc977eac4
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
a6578ef318
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
ae51cae111
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
3784188620
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
c2f0aa58df
Disable (x - (y - z)) => (x + (z - y)) optimization for floating point.
...
llvm-svn: 11083
2004-02-02 20:09:56 +00:00
Chris Lattner
cacd30b957
Update comment
...
llvm-svn: 11082
2004-02-02 20:09:22 +00:00
Brian Gaeke
6204e75c4a
Make deadarghaX0r warning louder.
...
(I just love typing haX0r. haX0r haX0r haX0r.)
llvm-svn: 11079
2004-02-02 19:32:27 +00:00
Chris Lattner
ed9b12c31a
Disable tail duplication in any "hard" cases, where it might break SSA form.
...
llvm-svn: 11052
2004-02-01 06:32:28 +00:00
Chris Lattner
7c91a6176c
Fix the count of the number of instructions removed
...
llvm-svn: 11049
2004-02-01 05:15:07 +00:00
Misha Brukman
bf43787f33
Hyphenate `target-dependent'
...
llvm-svn: 11003
2004-01-28 20:43:01 +00:00
Chris Lattner
1f7942fe7d
Fix InstCombine/2004-01-13-InstCombineInvokePHI.ll, which also fixes lots
...
of C++ programs in Shootout-C++, including lists1 and moments, etc
llvm-svn: 10845
2004-01-14 06:06:08 +00:00
Chris Lattner
6b052f2154
Clean up #includes
...
llvm-svn: 10799
2004-01-12 19:56:36 +00:00
Chris Lattner
fcf21a75b0
Fix bug in previous checkin
...
llvm-svn: 10798
2004-01-12 19:47:05 +00:00
Chris Lattner
c1e7cc0fbe
Eliminate use of ConstantHandling and ConstantExpr::getShift interfaces
...
llvm-svn: 10796
2004-01-12 19:35:11 +00:00
Chris Lattner
d7ccc9e5a5
Add header file I accidentally removed in teh shuffle
...
llvm-svn: 10795
2004-01-12 19:15:20 +00:00
Chris Lattner
c9fb4a3b89
Remove use of the ConstantHandling interfaces
...
llvm-svn: 10793
2004-01-12 19:12:50 +00:00
Chris Lattner
429963742e
Remove use of ConstantExpr::getShift
...
llvm-svn: 10792
2004-01-12 19:10:58 +00:00
Chris Lattner
1b7d4d7b63
Don't use ConstantExpr::getShift anymore
...
llvm-svn: 10791
2004-01-12 19:08:43 +00:00
Chris Lattner
2853a7ed22
Remove use of ConstantHandling
...
llvm-svn: 10789
2004-01-12 18:35:03 +00:00
Chris Lattner
118a76cb2f
Remove unneeded #include
...
llvm-svn: 10788
2004-01-12 18:33:54 +00:00
Chris Lattner
fc6c859a0c
Move llvm::ConstantFoldInstruction from VMCore to here, next to ConstantFoldTerminator
...
llvm-svn: 10785
2004-01-12 18:25:22 +00:00
Chris Lattner
81d8822396
Remove uses of ConstantHandling itf
...
llvm-svn: 10783
2004-01-12 18:12:44 +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
7e8af38637
Do not hack on volatile loads. I'm not sure what the point of a volatile load
...
from constant memory is, but lets not take chances.
llvm-svn: 10765
2004-01-12 04:13:56 +00:00
Chris Lattner
05fe6847a8
Implement SCCP/phitest.ll
...
llvm-svn: 10763
2004-01-12 03:57:30 +00:00
Chris Lattner
fafa2ff2d6
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
3bcecb92f3
Update obsolete comments
...
Fix iterator invalidation problems which was causing -mstrip to miss some
entries, and read free'd memory. This shrinks the symbol table of 254.gap
from 333 to 284 bytes! :)
llvm-svn: 10751
2004-01-10 21:36:49 +00:00
Chris Lattner
df3c342a4c
Finegrainify namespacification
...
llvm-svn: 10727
2004-01-09 06:12:26 +00:00
Chris Lattner
fdf788eebd
Remove dependence on structure index type. s/MT/FT
...
llvm-svn: 10726
2004-01-09 06:02:51 +00:00
Chris Lattner
49525f8cf4
Finegrainify namespacification
...
llvm-svn: 10725
2004-01-09 06:02:20 +00:00
Chris Lattner
ff66958154
Finegrainify namespacification
...
add flags for PR82
llvm-svn: 10724
2004-01-09 05:53:38 +00:00
Chris Lattner
9cc1a0e40d
Inching towards fixing PR82
...
llvm-svn: 10722
2004-01-09 05:44:50 +00:00
Chris Lattner
59d2d7fc33
Improve encapsulation in the Loop and LoopInfo classes by eliminating the
...
getSubLoops/getTopLevelLoops methods, replacing them with iterator-based
accessors.
llvm-svn: 10714
2004-01-08 00:09:44 +00:00
Chris Lattner
56db5e98c8
Merging constants can cause further room for improvement. Iterate until
...
we converge
llvm-svn: 10618
2003-12-28 07:19:08 +00:00
Chris Lattner
30513e0a3a
rename ClassifyExpression -> ClassifyExpr
...
llvm-svn: 10592
2003-12-23 08:04:08 +00:00
Chris Lattner
7e755e443f
More minor non-functional changes. This now computes the exit condition, though
...
it doesn't do anything with it.
llvm-svn: 10590
2003-12-23 07:47:09 +00:00
Chris Lattner
93bfb6c741
Remove extraneous #include
...
finegrainify namespacification
llvm-svn: 10589
2003-12-23 07:43:38 +00:00
Chris Lattner
c2ee05427e
Fix memory corruption bug PR193
...
llvm-svn: 10586
2003-12-22 23:49:36 +00:00
Chris Lattner
a02d5aa6ce
Don't mind me, I'm just refactoring away. This patch makes room for LFTR, but
...
contains no functionality changes.
llvm-svn: 10583
2003-12-22 09:53:29 +00:00
Chris Lattner
6449dcefbc
Implement IndVarsSimplify/pointer-indvars.ll, transforming pointer
...
arithmetic into "array subscripts"
llvm-svn: 10580
2003-12-22 05:02:01 +00:00
Chris Lattner
d3678bc7c5
Fix PR194
...
llvm-svn: 10573
2003-12-22 03:58:44 +00:00
Chris Lattner
fc7bdac1b3
Fix ADCE/2003-12-19-MergeReturn.llx
...
llvm-svn: 10539
2003-12-19 09:08:34 +00:00
Chris Lattner
918460190f
Remove the wierd "Operands" loop, by traversing basicblocks in reverse order
...
llvm-svn: 10536
2003-12-19 08:18:16 +00:00
Chris Lattner
547192d688
Implement LICM/sink_multiple.ll, by sinking all possible instructions in the
...
loop before hoisting any.
llvm-svn: 10534
2003-12-19 07:22:45 +00:00
Chris Lattner
031a3f8cc7
Generalize a special case to fix PR187
...
llvm-svn: 10531
2003-12-19 06:27:08 +00:00
Chris Lattner
91daeb5431
Factor code out into the Utils library
...
llvm-svn: 10530
2003-12-19 05:58:40 +00:00
Chris Lattner
04efa4b155
Add new function
...
llvm-svn: 10529
2003-12-19 05:56:28 +00:00
John Criswell
b22e9b4b35
Reverted back to previous revision - this was previously merged
...
according to the CVS log messages.
llvm-svn: 10517
2003-12-18 17:19:19 +00:00
John Criswell
86a3a48697
Merged in RELEASE_11.
...
llvm-svn: 10516
2003-12-18 16:43:17 +00:00
Chris Lattner
9e2b42a0c8
When we delete instructions from the loop, make sure to remove them from the
...
AliasSetTracker as well.
llvm-svn: 10507
2003-12-18 08:12:32 +00:00
Chris Lattner
6c08bb8b8e
Fix for PR185 & IndVarsSimplify/2003-12-15-Crash.llx
...
llvm-svn: 10473
2003-12-15 17:34:02 +00:00
Chris Lattner
884e824534
Refactor code just a little bit, allowing us to implement TailCallElim/return_constant.ll
...
llvm-svn: 10467
2003-12-14 23:57:39 +00:00
Chris Lattner
d1c371c32c
Do not promote volatile alias sets into registers
...
llvm-svn: 10458
2003-12-14 04:52:31 +00:00
Chris Lattner
34399dda2d
Fix LICM/2003-12-11-SinkingToPHI.ll, and quite possibly all of the other known problems in the universe.
...
llvm-svn: 10409
2003-12-11 22:23:32 +00:00
Chris Lattner
027253b0d5
verifyFunction depends on dominator info, which levelraise does not declare
...
that it needs. This is pretty scary code! This fixes
Regression.Transforms.LevelRaise.2002-07-16-SourceAndDestCrash
Regression.Transforms.LevelRaise.2002-07-31-AssertionFailure
llvm-svn: 10406
2003-12-11 21:47:37 +00:00
Chris Lattner
6281fd3ead
Fix bug: LICM/sink_multiple_exits.ll
...
Thanks for pointing this out John :)
llvm-svn: 10387
2003-12-10 22:35:56 +00:00
Chris Lattner
55c2113b7b
Don't allow dead instructions to stop sinking early.
...
llvm-svn: 10386
2003-12-10 20:43:29 +00:00
Chris Lattner
713907e2b8
Fix bug: IndVarsSimplify/2003-12-10-RemoveInstrCrash.llx
...
llvm-svn: 10385
2003-12-10 20:43:04 +00:00
Chris Lattner
7e5bd59da2
Finegrainify namespacification
...
Fix bug: LowerInvoke/2003-12-10-Crash.llx
llvm-svn: 10382
2003-12-10 20:22:42 +00:00
Chris Lattner
ccd9f3c1f8
Finegrainify namespacification
...
Reorder #includes
Implement: IndVarsSimplify/2003-12-10-IndVarDeadCode.ll
llvm-svn: 10376
2003-12-10 18:06:47 +00:00
Chris Lattner
7710f2f49e
Finegrainify namespacification
...
Fix bug: LoopSimplify/2003-12-10-ExitBlocksProblem.ll
llvm-svn: 10373
2003-12-10 17:20:35 +00:00
Chris Lattner
6364314a6e
Simplify code
...
llvm-svn: 10371
2003-12-10 16:58:24 +00:00
Chris Lattner
48b4b852b4
Avoid performing two identical lookups when one will suffice
...
llvm-svn: 10370
2003-12-10 16:57:24 +00:00
Chris Lattner
edda1af35a
Make LICM itself a bit more efficient, and make the generated code more efficient too: don't insert a store in every exit block, because a particular block may be exited to more than once by a loop
...
llvm-svn: 10369
2003-12-10 15:56:24 +00:00
Chris Lattner
aaaea51090
Implement instruction sinking out of loops. This still can do a little bit
...
better job, but this is the majority of the work. This implements
LICM/sink*.ll
llvm-svn: 10358
2003-12-10 06:41:05 +00:00
Chris Lattner
6c237bcdf2
Do not insert one entry PHI nodes in split exit blocks!
...
llvm-svn: 10348
2003-12-09 23:12:55 +00:00
Chris Lattner
65c1193d55
Refactor code a little bit, eliminating the gratuitous InstVisitor, which
...
should make subsequent changes simpler. This also allows us to hoist vaarg
and vanext instructions
llvm-svn: 10342
2003-12-09 19:32:44 +00:00
Chris Lattner
c05176843e
Fine grainify namespacification
...
Code cleanups
Make LICM::SafeToHoist marginally more efficient
llvm-svn: 10341
2003-12-09 17:18:00 +00:00