Chris Lattner
6e1d5a8b28
Finally, add the required constraint checks to fix Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll
...
the right way
llvm-svn: 22615
2005-08-03 00:59:12 +00:00
Chris Lattner
cbf4b650ba
Simplify some code, add the correct pred checks
...
llvm-svn: 22613
2005-08-03 00:38:27 +00:00
Chris Lattner
c59014baef
Refactor code out of PropagatePredecessorsForPHIs, turning it into a pure function with no side-effects
...
llvm-svn: 22612
2005-08-03 00:29:26 +00:00
Chris Lattner
0f4e0d19cc
use splice instead of remove/insert to avoid some symtab operations
...
llvm-svn: 22611
2005-08-03 00:23:42 +00:00
Chris Lattner
adbd086f50
move two functions up in the file, use SafeToMergeTerminators to eliminate
...
some duplicated code
llvm-svn: 22610
2005-08-03 00:19:45 +00:00
Chris Lattner
b9efb90e1a
Rip some code out of the main SimplifyCFG function into a subfunction and
...
call it from the only place it is live. No functionality changes.
llvm-svn: 22609
2005-08-03 00:11:16 +00:00
Chris Lattner
df31d75597
Disable this patch:
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050801/027345.html
This breaks real programs and only fixes an obscure regression testcase. A
real fix is in development.
llvm-svn: 22606
2005-08-02 23:31:38 +00:00
Chris Lattner
b5906d5783
Change a place to use an arbitrary value instead of null, when possible
...
llvm-svn: 22605
2005-08-02 23:29:23 +00:00
Chris Lattner
b8fd6a098e
This code was very close, but not quite right. It did not take into
...
consideration the case where a reference in an unreachable block could
occur. This fixes Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll,
something I ran into while bugpoint'ing another pass.
llvm-svn: 22584
2005-08-02 03:24:05 +00:00
Jeff Cohen
bd51ec7461
Eliminate all remaining tabs and trailing spaces.
...
llvm-svn: 22523
2005-07-27 06:12:32 +00:00
Chris Lattner
02fe175f3d
Fix PR590 and Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll.
...
The optimization for locally used allocas was not safe for allocas that
were read before they were written. This change disables that optimization
in that case.
llvm-svn: 22318
2005-06-30 07:29:44 +00:00
Andrew Lenharth
cdaaa66e7d
prevent DCE of vaarg intrinsics. This should take care of most regressions
...
llvm-svn: 22263
2005-06-19 14:41:20 +00:00
Chris Lattner
8c76d5c957
Don't crash on: X = phi (X, X).
...
This fixes PR584 and Transforms/SimplifyCFG/2005-06-16-PHICrash.ll
llvm-svn: 22232
2005-06-17 01:45:53 +00:00
Chris Lattner
b13335fff2
Fix Transforms/SimplifyCFG/switch-simplify-crash.ll
...
llvm-svn: 22158
2005-05-20 22:19:54 +00:00
Chris Lattner
214f1a8cf9
Make sure to preserve the calling convention when changing an invoke into
...
a call. This fixes Prolangs-C++/deriv2, kimwitu++, and Misc-C++/bigfib
on X86 with -enable-x86-fastcc.
llvm-svn: 22023
2005-05-14 12:21:56 +00:00
Chris Lattner
eff214d7de
wrap long lines, preserve calling conventions when cloning functions and
...
turning calls into invokes
llvm-svn: 21797
2005-05-09 01:04:34 +00:00
Chris Lattner
c9be572154
BAD typeo which caused many testsuite failures last night. Note to self, do
...
not change code after testing it without retesting!
llvm-svn: 21741
2005-05-06 17:13:16 +00:00
Chris Lattner
0187977904
Implement Transforms/Inline/inline-tail.ll
...
llvm-svn: 21736
2005-05-06 06:47:52 +00:00
Chris Lattner
b953e27f85
DCE intrinsic instructions without side effects.
...
llvm-svn: 21719
2005-05-06 05:27:34 +00:00
Reid Spencer
ff5cc3cb16
Remove optimizations that don't require both operands to be constant. These
...
are moved to simplify-libcalls pass.
llvm-svn: 21614
2005-04-29 05:55:35 +00:00
Reid Spencer
fb6e0590a8
* Add constant folding for additional floating point library calls such as
...
sinh, cosh, etc.
* Make the name comparisons for the fp libcalls a little more efficient by
switching on the first character of the name before doing comparisons.
llvm-svn: 21611
2005-04-28 23:01:59 +00:00
Jeff Cohen
6c42217055
Eliminate tabs and trailing spaces
...
llvm-svn: 21480
2005-04-23 21:38:35 +00:00
Misha Brukman
53e199440e
Remove trailing whitespace
...
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Chris Lattner
472c891d23
Improve doxygen documentation, patch contributed by Evan Jones!
...
llvm-svn: 21393
2005-04-21 16:04:49 +00:00
Chris Lattner
6ce1b109aa
Teach simplifycfg that setcc is cheap and non-trapping, so that it can
...
convert this:
%tmp.1 = seteq int %i, 0 ; <bool> [#uses=1]
br bool %tmp.1, label %shortcirc_done, label %shortcirc_next
shortcirc_next: ; preds = %entry
%tmp.4 = seteq int %j, 0 ; <bool> [#uses=1]
br label %shortcirc_done
shortcirc_done: ; preds = %shortcirc_next, %entry
%shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ] ; <bool> [#uses=1]
to this:
%tmp.1 = seteq int %i, 0 ; <bool> [#uses=1]
%tmp.4 = seteq int %j, 0 ; <bool> [#uses=1]
%shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4 ; <bool> [#uses=1]
... which is later simplified by instcombine into an or.
llvm-svn: 21388
2005-04-21 05:31:13 +00:00
Chris Lattner
ee06161a63
Get rid of this for_each loop
...
llvm-svn: 21253
2005-04-12 18:51:33 +00:00
Chris Lattner
c9a3ea81bf
Fix the missing symbols problem Bill was hitting. Patch contributed by
...
Bill Wendling!!
llvm-svn: 20649
2005-03-17 15:38:16 +00:00
Chris Lattner
4b688a1c70
This mega patch converts us from using Function::a{iterator|begin|end} to
...
using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*.
This patch is contributed by Gabor Greif, thanks!
llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner
1ccff5c8c7
second argument to Value::setName is now gone.
...
llvm-svn: 20463
2005-03-05 19:05:20 +00:00
Chris Lattner
a024984017
Fix spelling, patch contributed by Gabor Greif!
...
llvm-svn: 20343
2005-02-27 06:18:25 +00:00
Chris Lattner
14f720d625
remove extraneous cast
...
llvm-svn: 20334
2005-02-26 18:33:28 +00:00
Chris Lattner
7a434679c3
Implement Transforms/SimplifyCFG/switch_thread.ll
...
This does a simple form of "jump threading", which eliminates CFG edges that
are provably dead. This triggers 90 times in the external tests, and
eliminating CFG edges is always always a good thing! :)
llvm-svn: 20300
2005-02-24 06:17:52 +00:00
Chris Lattner
ccc0c99fae
switchinst ctor now takes a hint for the number of cases that it will have.
...
llvm-svn: 19898
2005-01-29 00:38:26 +00:00
Chris Lattner
5fff877f74
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
8378361f0c
The split bb is really the exit of the old function
...
llvm-svn: 18799
2004-12-11 16:59:54 +00:00
Chris Lattner
40e97884f6
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
c58bc8d96e
Squelch warning
...
llvm-svn: 18381
2004-11-30 07:47:34 +00:00
Chris Lattner
537e5a6b50
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
25b93fea2a
Alkis noticed that this variable is dead. Thanks!
...
llvm-svn: 18369
2004-11-30 04:01:44 +00:00
Chris Lattner
b237a19a78
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
9dd523842a
Allow constructor parameter to override aggregating args; fix spacing
...
llvm-svn: 18028
2004-11-20 02:20:27 +00:00
Chris Lattner
ab917141d0
Fix: CodeExtractor/2004-11-12-InvokeExtract.ll
...
llvm-svn: 17699
2004-11-13 00:06:45 +00:00
Chris Lattner
c6b1d7a081
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
3083f2a424
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
d3f7233495
Change Library Names Not To Conflict With Others When Installed
...
llvm-svn: 17286
2004-10-27 23:18:45 +00:00
Reid Spencer
9f6f128630
Eliminate compilation warning on uninitialized variable.
...
llvm-svn: 17163
2004-10-22 16:10:39 +00:00
Reid Spencer
e48ba34fd4
We won't use automake
...
llvm-svn: 17155
2004-10-22 03:35:04 +00:00
Reid Spencer
ce514b1c2c
Initial automake generated Makefile template
...
llvm-svn: 17136
2004-10-18 23:55:41 +00:00
Reid Spencer
2b5cfe8be8
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
b1827a765a
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