Dale Johannesen
bed9dc423c
Next round of APFloat changes.
...
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)
llvm-svn: 41747
2007-09-06 18:13:44 +00:00
Nick Lewycky
0c5c47944a
Use isTrueWhenEqual. Thanks Chris!
...
llvm-svn: 41741
2007-09-06 02:40:25 +00:00
Nick Lewycky
b0b066eaaa
When the two operands of an icmp are equal, there are five possible predicates
...
that would make the icmp true. Fixes PR1637.
llvm-svn: 41740
2007-09-06 01:10:22 +00:00
Chuck Rose III
2320323647
Forgot to obey 80 column rule. Fixing that.
...
llvm-svn: 41725
2007-09-05 20:36:41 +00:00
Chuck Rose III
e58572233d
Added default parameters to GetElementPtrInstr constructor call. Visual Studio 2k5 was getting confused and was unable to compile it. Suspected compiler error.
...
llvm-svn: 41721
2007-09-05 16:54:38 +00:00
Devang Patel
f6ef552f3d
Insert cloned loop basic blocks before original loop header.
...
llvm-svn: 41713
2007-09-04 20:46:35 +00:00
David Greene
c656cbb8c2
Update GEP constructors to use an iterator interface to fix
...
GLIBCXX_DEBUG issues.
llvm-svn: 41697
2007-09-04 15:46:09 +00:00
Anton Korobeynikov
35322d745c
Silence warning while compiling with gcc 4.2
...
llvm-svn: 41676
2007-09-02 22:11:14 +00:00
Evan Cheng
ffac17a223
Fix a gcroot lowering bug.
...
llvm-svn: 41668
2007-09-01 02:00:51 +00:00
Chris Lattner
0e258b8518
Cut off crazy computation. This helps PR1622 slightly.
...
llvm-svn: 41522
2007-08-28 04:23:55 +00:00
Devang Patel
d2456a171d
Use simpler test to filter loops.
...
llvm-svn: 41516
2007-08-27 21:34:31 +00:00
David Greene
703623d571
Update InvokeInst to work like CallInst
...
llvm-svn: 41506
2007-08-27 19:04:21 +00:00
Dan Gohman
71eaf62e5f
Change comments to refer to @malloc and @free instead of %malloc and %free.
...
llvm-svn: 41488
2007-08-27 16:11:48 +00:00
Anton Korobeynikov
24fb6b2f8c
Don't promote volatile loads/stores. This is needed (for example) to handle setjmp/longjmp properly.
...
This fixes PR1520.
llvm-svn: 41461
2007-08-26 21:43:30 +00:00
Owen Anderson
2b9ec7ff33
Don't DSe volatile stores.
...
llvm-svn: 41456
2007-08-26 21:14:47 +00:00
Devang Patel
6114751544
Move exit condition and exit branch from exiting block into loop header and dominator info. This avoid execution of dead iteration. Loop is already filter in the beginning such that this change is safe.
...
llvm-svn: 41394
2007-08-25 02:39:24 +00:00
Devang Patel
c1ef32ef3d
Constant split values needs upper bound and lower bound check, just like any other split value.
...
llvm-svn: 41389
2007-08-25 01:09:14 +00:00
Devang Patel
4e63e1f5b5
While calculating upper loop bound for first loop and lower loop bound for second loop, take care of edge cases.
...
llvm-svn: 41387
2007-08-25 00:56:38 +00:00
Devang Patel
f5a01bf025
Fix regression that I caused yesterday night while adding logic to select appropriate split condition branch.
...
llvm-svn: 41365
2007-08-24 19:32:26 +00:00
Devang Patel
4bc9298f2a
It is not safe to execute split condition's true branch first all the time. If split
...
condition predicate is GT or GE then execute false branch first.
llvm-svn: 41358
2007-08-24 06:17:19 +00:00
Devang Patel
4be56a5d12
Reject ICMP_NE as index split condition.
...
llvm-svn: 41357
2007-08-24 06:02:25 +00:00
Devang Patel
5e46fac6de
Tightenup loop filter.
...
llvm-svn: 41356
2007-08-24 05:36:56 +00:00
Devang Patel
504dc0aaed
Remove incomplete cost analysis.
...
llvm-svn: 41354
2007-08-24 05:21:13 +00:00
Chris Lattner
b0f158cfdf
rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
...
Add an APSInt::toString() method.
llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Devang Patel
887db2d832
Remove dead code.
...
llvm-svn: 41295
2007-08-22 21:07:41 +00:00
Devang Patel
6f4f23320d
Fix typo.
...
llvm-svn: 41292
2007-08-22 20:55:18 +00:00
Devang Patel
31206b56d5
Cosmetic change
...
"True Loop" and "False Loop" naming terminology to refer two loops
after loop cloning is confusing. Instead just use A_Loop and B_Loop.
llvm-svn: 41287
2007-08-22 19:33:29 +00:00
Devang Patel
90da534987
Refactor loop condition check in a separate function.
...
llvm-svn: 41282
2007-08-22 18:27:01 +00:00
Devang Patel
cd8beb7645
Fix thinko.
...
Starting value of second loop's induction variable can not be lower
then starting value of original loop's induction variable.
llvm-svn: 41280
2007-08-22 18:07:47 +00:00
Devang Patel
a12000d572
Rename bunch of variables.
...
llvm-svn: 41250
2007-08-21 21:12:02 +00:00
Devang Patel
f98db5e62a
Preserve LCSSA.
...
llvm-svn: 41246
2007-08-21 19:47:46 +00:00
Devang Patel
b5933bbbd5
Use SmallVector instead of std::vector.
...
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Devang Patel
8f4228d619
s/ExitBlock/ExitingBlock/g
...
llvm-svn: 41204
2007-08-20 23:51:18 +00:00
Devang Patel
49c4f9a889
Replace indunction variable with split value in loop body.
...
This fixes art miscompile.
llvm-svn: 41195
2007-08-20 20:49:01 +00:00
Devang Patel
c2e2d15f45
Do not split loops rejected by processOneIterationLoop().
...
llvm-svn: 41194
2007-08-20 20:24:15 +00:00
Nick Lewycky
bfa9499a88
Oops, remove assert that wasn't meant to be committed.
...
llvm-svn: 41170
2007-08-18 23:21:28 +00:00
Nick Lewycky
5b5b1ab9e0
Never insert duplicate edges.
...
llvm-svn: 41169
2007-08-18 23:18:03 +00:00
Nick Lewycky
a0d49dac26
Typo.
...
llvm-svn: 41168
2007-08-18 15:08:56 +00:00
Devang Patel
1282b6e181
Avoid spliting loops where two split condition branches are not independent.
...
llvm-svn: 41148
2007-08-18 00:00:32 +00:00
Devang Patel
d1fcfcc76c
When one branch of condition is eliminated then head of the other
...
branch is not necessary immediate dominators of merge blcok in all cases.
llvm-svn: 41144
2007-08-17 21:59:16 +00:00
Owen Anderson
f5023a7a84
Factor out some code into a helper function.
...
llvm-svn: 41131
2007-08-16 22:51:56 +00:00
Owen Anderson
221a43604e
Add some more comments to GVN.
...
llvm-svn: 41129
2007-08-16 22:02:55 +00:00
Devang Patel
3640e78057
Dominance frontier is now required.
...
llvm-svn: 41096
2007-08-15 03:34:53 +00:00
Devang Patel
b81bcbde09
Cleanup removeBlocks.
...
Use dominance frontier to fixup incoming edges of successor blocks not domianted by DeadBB.
Use df_iterator to walk and delete basic blocks dominated by DeadBB.
llvm-svn: 41095
2007-08-15 03:31:47 +00:00
Reid Spencer
0db035567c
Remove unneeded header file.
...
llvm-svn: 41094
2007-08-15 03:01:04 +00:00
Devang Patel
f55b79fa71
Avoid triangle loops.
...
llvm-svn: 41093
2007-08-15 02:14:55 +00:00
Devang Patel
22c7993ecf
Break infinite loop.
...
llvm-svn: 41091
2007-08-14 23:59:17 +00:00
Devang Patel
7cad917160
Avoid nested loops at the moment.
...
llvm-svn: 41090
2007-08-14 23:53:57 +00:00
Devang Patel
33ba97d747
Fix dominance frontier update while removing blocks.
...
llvm-svn: 41082
2007-08-14 18:35:57 +00:00
Owen Anderson
bc271a02fd
Eliminate PHI nodes with constant values during normal GVN processing, even when
...
they're not related to eliminating a load.
llvm-svn: 41081
2007-08-14 18:33:27 +00:00
Owen Anderson
398602a6eb
Be more aggressive in pruning unnecessary PHI nodes when doing PHI construction.
...
llvm-svn: 41080
2007-08-14 18:16:29 +00:00
Owen Anderson
676070d503
Make GVN iterative.
...
llvm-svn: 41078
2007-08-14 18:04:11 +00:00
Owen Anderson
a7b220f23a
Fix a case where GVN was failing to return true when it had, in fact, modified
...
the function.
llvm-svn: 41077
2007-08-14 17:59:48 +00:00
Devang Patel
dbe8497d45
Handle last value assignments.
...
llvm-svn: 41063
2007-08-14 01:30:57 +00:00
Devang Patel
f74ccbb4e8
StartValue is already calculated.
...
llvm-svn: 41062
2007-08-14 00:15:45 +00:00
Devang Patel
948653915f
Preserve simple analysis.
...
llvm-svn: 41054
2007-08-13 22:22:13 +00:00
Devang Patel
b8a41bb4f1
Preserve dominator info.
...
llvm-svn: 41053
2007-08-13 22:13:24 +00:00
Devang Patel
da48cf40db
If NewBB dominates DestBB then DestBB is not part of NewBB's dominance frontier.
...
llvm-svn: 41051
2007-08-13 21:59:17 +00:00
Devang Patel
f258578206
Split loops and do CFG cleanup.
...
llvm-svn: 41029
2007-08-12 07:02:51 +00:00
Reid Spencer
9f90f965de
Remove unused variables.
...
llvm-svn: 41028
2007-08-12 04:45:36 +00:00
Chris Lattner
99c8ee2977
Transform a load from an undef/zero global into an undef/global even if we
...
have complex pointer manipulation going on. This allows us to compile
stuff like this:
__m128i foo(__m128i x){
static const unsigned int c_0[4] = { 0, 0, 0, 0 };
__m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
x = _mm_unpacklo_epi8(x, v_Zero);
return x;
}
into:
_foo:
xorps %xmm1, %xmm1
punpcklbw %xmm1, %xmm0
ret
llvm-svn: 41022
2007-08-11 18:48:48 +00:00
Devang Patel
f417c2cc34
Clone loop.
...
llvm-svn: 40998
2007-08-10 18:07:13 +00:00
Devang Patel
aa36a43908
Add utility to clone loops.
...
llvm-svn: 40997
2007-08-10 17:59:47 +00:00
Devang Patel
9a4761464f
Remove unncessary duplication.
...
llvm-svn: 40979
2007-08-10 00:59:03 +00:00
Devang Patel
7bdf4531bb
Calculate exit and start value of true loop and false loop respectively.
...
llvm-svn: 40978
2007-08-10 00:53:35 +00:00
Devang Patel
67af6cd7ea
ExitCondition and Induction variable are loop constraints
...
not split condition constraints.
llvm-svn: 40977
2007-08-10 00:33:50 +00:00
Chris Lattner
a8e4b4bc7b
when we see a unaligned load from an insufficiently aligned global or
...
alloca, increase the alignment of the load, turning it into an aligned load.
This allows us to compile:
#include <xmmintrin.h>
__m128i foo(__m128i x){
static const unsigned int c_0[4] = { 0, 0, 0, 0 };
__m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
x = _mm_unpacklo_epi8(x, v_Zero);
return x;
}
into:
_foo:
punpcklbw _c_0.5944, %xmm0
ret
.data
.lcomm _c_0.5944,16,4 # c_0.5944
instead of:
_foo:
movdqu _c_0.5944, %xmm1
punpcklbw %xmm1, %xmm0
ret
.data
.lcomm _c_0.5944,16,2 # c_0.5944
llvm-svn: 40971
2007-08-09 19:05:49 +00:00
Owen Anderson
9b1cc8cac0
Make NonLocal and None const in the right way. :-)
...
llvm-svn: 40961
2007-08-09 04:42:44 +00:00
Devang Patel
42e3e5bec1
Traverse loop blocks' terminators to find split candidates.
...
llvm-svn: 40960
2007-08-09 01:39:01 +00:00
Devang Patel
0183c797c4
Add cost analysis.
...
llvm-svn: 40952
2007-08-08 22:25:28 +00:00
Devang Patel
0e34ee25ab
Preserve dom info while processing one iteration loop.
...
llvm-svn: 40947
2007-08-08 21:39:47 +00:00
Owen Anderson
b84d3b1c92
Change the None and NonLocal markers in memdep to be const.
...
llvm-svn: 40946
2007-08-08 21:39:39 +00:00
Devang Patel
8abc5c82b7
Clear split info.
...
llvm-svn: 40944
2007-08-08 21:18:27 +00:00
Devang Patel
593bf9ceb3
Handle multiple split conditions.
...
llvm-svn: 40941
2007-08-08 21:02:17 +00:00
Owen Anderson
680862880d
Global values also don't undead-ify pointers in our dead alloca's set.
...
llvm-svn: 40936
2007-08-08 19:12:31 +00:00
Owen Anderson
ddf4aee543
Make handleEndBlock significantly faster with one trivial improvement,
...
and one hack to avoid hitting a bad case when the alias analysis is imprecise.
llvm-svn: 40935
2007-08-08 18:38:28 +00:00
Owen Anderson
50df9685b0
Small improvement: if a function doesn't access memory, we don't need to scan
...
it for potentially undeading pointers.
llvm-svn: 40933
2007-08-08 17:58:56 +00:00
Owen Anderson
52aaabf74d
Add some comments, remove a dead argument, and simplify some control flow.
...
No functionality change.
llvm-svn: 40932
2007-08-08 17:50:09 +00:00
Owen Anderson
b17ab03081
A few more small cleanups.
...
llvm-svn: 40922
2007-08-08 06:06:02 +00:00
Owen Anderson
0aecf0ebef
First round of cleanups from Chris' feedback.
...
llvm-svn: 40919
2007-08-08 04:52:29 +00:00
Devang Patel
68de1ae816
Embrace patch review feedback.
...
llvm-svn: 40915
2007-08-08 01:51:27 +00:00
Devang Patel
c7e53bdcfd
Fix new compare instruction's signness. Caught by Chris during review.
...
llvm-svn: 40912
2007-08-07 23:17:52 +00:00
Owen Anderson
0cc1a76283
Don't insert nearly as many redundant phi nodes.
...
llvm-svn: 40909
2007-08-07 23:12:31 +00:00
Devang Patel
19211b6528
Use eraseFromParent().
...
llvm-svn: 40903
2007-08-07 17:45:35 +00:00
David Greene
bacdbaa0da
Fix comment typo
...
llvm-svn: 40898
2007-08-07 16:52:03 +00:00
David Greene
816a190cdf
Fix GLIBCXX_DEBUG error triggered by incrementing erased iterator.
...
llvm-svn: 40897
2007-08-07 16:44:38 +00:00
Devang Patel
c70106cb30
Begin loop index split pass.
...
llvm-svn: 40883
2007-08-07 00:25:56 +00:00
Nick Lewycky
8052019a20
It's safe to fold not of fcmp.
...
llvm-svn: 40870
2007-08-06 20:04:16 +00:00
David Greene
77b2accbca
Make this code more efficient.
...
llvm-svn: 40861
2007-08-06 15:09:17 +00:00
Chris Lattner
c7ba225705
remove some dead lines
...
llvm-svn: 40859
2007-08-06 06:21:06 +00:00
Reid Spencer
d959cfc882
Silence some warnings from doxygen about @param argument name not matching the
...
actual argument name of the documented function.
llvm-svn: 40851
2007-08-05 19:35:22 +00:00
Chris Lattner
f0da7975ea
at the end of instcombine, explicitly clear WorklistMap.
...
This shrinks it down to something small. On the testcase
from PR1432, this speeds up instcombine from 0.7959s to 0.5000s,
(59%)
llvm-svn: 40840
2007-08-05 08:47:58 +00:00
Chris Lattner
edce70d2fe
rewrite the code used to construct pruned SSA form with the IDF method.
...
In the old way, we computed and inserted phi nodes for the whole IDF of
the definitions of the alloca, then computed which ones were dead and
removed them.
In the new method, we first compute the region where the value is live,
and use that information to only insert phi nodes that are live. This
eliminates the need to compute liveness later, and stops the algorithm
from inserting a bunch of phis which it then later removes.
This speeds up the testcase in PR1432 from 2.00s to 0.15s (14x) in a
release build and 6.84s->0.50s (14x) in a debug build.
llvm-svn: 40825
2007-08-04 22:50:14 +00:00
Chris Lattner
d91576b01e
Factor out a whole bunch of code into it's own method.
...
llvm-svn: 40824
2007-08-04 21:14:29 +00:00
Chris Lattner
4e1b4140eb
Use getNumPreds(BB) instead of computing them manually. This is a very small but
...
measurable speedup.
llvm-svn: 40823
2007-08-04 21:06:15 +00:00
Chris Lattner
b6a4ba808b
Change the rename pass to be "tail recursive", only adding N-1 successors
...
to the worklist, and handling the last one with a 'tail call'. This speeds
up PR1432 from 2.0578s to 2.0012s (2.8%)
llvm-svn: 40822
2007-08-04 20:40:27 +00:00
Chris Lattner
840259c8d3
cache computation of #preds for a BB. This speeds up
...
mem2reg from 2.0742->2.0522s on PR1432.
llvm-svn: 40821
2007-08-04 20:24:50 +00:00
Chris Lattner
050bac4bed
reserve operand space for phi nodes when we insert them.
...
llvm-svn: 40820
2007-08-04 20:14:34 +00:00
Chris Lattner
9318785df5
use continue to avoid nesting, no functionality change.
...
llvm-svn: 40819
2007-08-04 20:07:06 +00:00
Chris Lattner
6b04ecbaf9
Promoting allocas with the 'single store' fastpath is
...
faster than with the 'local to a block' fastpath. This speeds
up PR1432 from 2.1232 to 2.0686s (2.6%)
llvm-svn: 40818
2007-08-04 20:03:23 +00:00
Chris Lattner
4a930f9444
When PromoteLocallyUsedAllocas promoted allocas, it didn't remember
...
to increment NumLocalPromoted, and didn't actually delete the
dead alloca, leading to an extra iteration of mem2reg.
llvm-svn: 40817
2007-08-04 20:01:43 +00:00
Chris Lattner
63c039780c
std::map -> DenseMap
...
llvm-svn: 40816
2007-08-04 19:52:20 +00:00
Nick Lewycky
20f0811fc0
Clean up comments, fix up some confusing code logic.
...
Predsimplify fails llvm-gcc bootstrap.
llvm-svn: 40815
2007-08-04 18:45:32 +00:00
Chris Lattner
7d382f7680
fix a logic bug where we wouldn't promote single store allocas if the
...
stored value was a non-instruction value. Doh.
This increase the # single store allocas from 8982 to 9026, and
speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s.
llvm-svn: 40813
2007-08-04 02:45:02 +00:00
Chris Lattner
1b215f0661
When we do the single-store optimization, delete both the store
...
and the alloca so they don't get reprocessed.
This speeds up PR1432 from 2.20s to 2.17s.
llvm-svn: 40812
2007-08-04 02:38:38 +00:00
Chris Lattner
862f125457
Three improvements:
...
1. Check for revisiting a block before checking domination, which is faster.
2. If the stored value isn't an instruction, we don't have to check for domination.
3. If we have a value used in the same block more than once, make sure to remove the
block from the UsingBlocks vector. Not doing so forces us to go through the slow
path for the alloca.
The combination of these improvements increases the number of allocas on the fastpath
from 8935 to 8982 on PR1432. This speeds it up from 2.90s to 2.20s (31%)
llvm-svn: 40811
2007-08-04 02:32:22 +00:00
Chris Lattner
ae1e00eb36
switch from using a std::set to using a SmallPtrSet. This speeds up the
...
testcase in PR1432 from 6.33s to 2.90s (2.22x)
llvm-svn: 40810
2007-08-04 02:21:22 +00:00
Chris Lattner
9181801bb7
In mem2reg, when handling the single-store case, make sure to remove
...
a using block from the list if we handle it. Not doing this caused us
to not be able to promote (with the fast path) allocas which have uses (whoops).
This increases the # allocas hitting this fastpath from 4042 to 8935 on the
testcase in PR1432, speeding up mem2reg by 2.6x
llvm-svn: 40809
2007-08-04 02:15:24 +00:00
Chandler Carruth
7132e00de7
This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.
...
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.
llvm-svn: 40807
2007-08-04 01:51:18 +00:00
Chris Lattner
886a41a007
split rewriting of single-store allocas into its own
...
method.
llvm-svn: 40806
2007-08-04 01:47:41 +00:00
Chris Lattner
3cede09c67
refactor some code to shrink PromoteMem2Reg::run a bit
...
llvm-svn: 40805
2007-08-04 01:41:18 +00:00
Chris Lattner
d524537fe9
add a typedef, no other change.
...
llvm-svn: 40804
2007-08-04 01:19:38 +00:00
Chris Lattner
df138be527
avoid an unneeded vector copy. This speeds up mem2reg on the testcase
...
in PR1432 by 6%
llvm-svn: 40803
2007-08-04 01:07:49 +00:00
Chris Lattner
fd838f0770
make RenamePassWorkList a local var instead of an ivar.
...
llvm-svn: 40802
2007-08-04 01:04:40 +00:00
Owen Anderson
2d19aae4ca
Fix a subtle miscompilation. This allows 197.parser to be compiled correctly.
...
llvm-svn: 40791
2007-08-03 19:59:35 +00:00
Owen Anderson
774761c503
Fix a subtle iterator invalidation bug in a recursive algorithm.
...
llvm-svn: 40776
2007-08-03 11:03:26 +00:00
Chris Lattner
1f70816c73
Fix an accidental commit.
...
llvm-svn: 40758
2007-08-02 21:33:36 +00:00
Owen Anderson
a8ba659976
Fix 80 col. violations.
...
llvm-svn: 40751
2007-08-02 18:20:52 +00:00
Owen Anderson
9699a6ea03
Fix 80 col. violations.
...
llvm-svn: 40750
2007-08-02 18:16:06 +00:00
Owen Anderson
e3590584b9
Fix 80 col. violations.
...
llvm-svn: 40749
2007-08-02 18:11:11 +00:00
Owen Anderson
0ac1fc8ac1
Fix a bug that was causing several miscompilations on SPEC.
...
llvm-svn: 40746
2007-08-02 17:56:05 +00:00
Chris Lattner
dc2cf228ce
Replacing a cast with another one does not reduce the number of
...
casts in the input.
llvm-svn: 40741
2007-08-02 17:23:38 +00:00
Chris Lattner
222b214be7
Disable an xform that causes an infinite loop. This fixes PR1594
...
llvm-svn: 40739
2007-08-02 16:56:32 +00:00
Chris Lattner
2740694450
wrap some long lines. Major offenders that are left include
...
gvn, gvnpre, dse, and predsimplify. To see these, use:
make check-line-length
llvm-svn: 40738
2007-08-02 16:53:43 +00:00
Devang Patel
a882328e61
Update dominator info for the middle blocks created while spliting
...
exit edge to preserve LCSSA.
Fix dominance frontier update during loop unswitch. This fixes PR 1589, again
llvm-svn: 40737
2007-08-02 15:25:57 +00:00
Chris Lattner
b0418fc607
Enhance instcombine to be more aggressive about folding casts of
...
operations of casts. This implements InstCombine/zext-fold.ll
llvm-svn: 40726
2007-08-02 06:11:14 +00:00
Chris Lattner
d7cb625a9e
Fix PR1575 and test/Transforms/CondProp/2007-08-01-InvalidRead.ll
...
llvm-svn: 40720
2007-08-02 04:47:05 +00:00
Devang Patel
34890b2f27
Undo previous check-in.
...
llvm-svn: 40698
2007-08-01 23:24:50 +00:00
Devang Patel
561b0c29a3
Update dominator info for the middle blocks created while spliting
...
exit edge to preserve LCSSA.
Fix dominance frontier update during loop unswitch. This fixes PR 1589.
llvm-svn: 40695
2007-08-01 22:23:50 +00:00
Owen Anderson
c321e5e272
Make non-local memdep not be recursive, and fix a bug on 403.gcc that this exposed.
...
llvm-svn: 40692
2007-08-01 22:01:54 +00:00
Dan Gohman
34d442f274
More explicit keywords.
...
llvm-svn: 40673
2007-08-01 15:32:29 +00:00
Owen Anderson
10e52eddb3
Rename FastDSE to just DSE.
...
llvm-svn: 40668
2007-08-01 06:36:51 +00:00
Owen Anderson
e4a374812b
Move FastDSE in to DeadStoreElimination.
...
llvm-svn: 40667
2007-08-01 06:30:51 +00:00
Owen Anderson
4894e6d8bc
Remove old DSE.
...
llvm-svn: 40666
2007-08-01 06:30:10 +00:00
David Greene
17a5dfe6f7
New CallInst interface to address GLIBCXX_DEBUG errors caused by
...
indexing an empty std::vector.
Updates to all clients.
llvm-svn: 40660
2007-08-01 03:43:44 +00:00
Owen Anderson
10ffa860d8
Don't let the memory allocator outsmart GVN. ;-)
...
llvm-svn: 40655
2007-07-31 23:27:13 +00:00
Owen Anderson
2464f4f048
Fix a failure I accidentally caused in my last commit by mishandling the
...
removal of redundant phis.
llvm-svn: 40650
2007-07-31 20:18:28 +00:00
Lauro Ramos Venancio
549e775e67
Fix a bug in GetKnownAlignment of packed structs.
...
llvm-svn: 40649
2007-07-31 20:13:21 +00:00
Owen Anderson
d58fa6b09f
Fix a misoptimization in aha.
...
llvm-svn: 40642
2007-07-31 17:43:14 +00:00
Dan Gohman
8c4da37b1f
Use SCEVExpander::InsertCastOfTo instead of calling new IntToPtrInst
...
directly, because the insert point used by the SCEVExpander may vary
from what LSR originally computes.
llvm-svn: 40641
2007-07-31 17:22:27 +00:00
Devang Patel
d8b1ceb5b4
Add note.
...
llvm-svn: 40638
2007-07-31 16:52:25 +00:00
Devang Patel
d491198000
Loop unswitch preserves dom info.
...
Use simple analysis interface to preserve analysis info maintained by other loop passes.
llvm-svn: 40627
2007-07-31 08:03:26 +00:00
Devang Patel
b98a097ae9
Implement Simple Analysis interfaces - cloneBasicBlockAnalysis and deleteAnalysisValue.
...
llvm-svn: 40626
2007-07-31 08:01:41 +00:00
Devang Patel
7d165e1d84
If loop can be unswitched again, then do it yourself.
...
llvm-svn: 40609
2007-07-30 23:07:10 +00:00
Owen Anderson
850138157e
Avoid potential iterator invalidation problems.
...
llvm-svn: 40607
2007-07-30 21:26:39 +00:00
Devang Patel
14fae50666
Remove dead code.
...
llvm-svn: 40606
2007-07-30 21:10:44 +00:00
Devang Patel
c5e340eded
LCSSA preserves dom info.
...
llvm-svn: 40604
2007-07-30 20:23:45 +00:00
Devang Patel
698852561c
Loop Rotation pass preserves dominator tree and frontier.
...
llvm-svn: 40603
2007-07-30 20:22:53 +00:00
Devang Patel
bb97ac4dce
LICM preserves scalar evolution and dom frontier.
...
llvm-svn: 40602
2007-07-30 20:19:59 +00:00
Reid Spencer
dff9d69cfb
Fix a typo/thinko.
...
llvm-svn: 40599
2007-07-30 19:53:57 +00:00
Owen Anderson
212d5c27f6
Use more caching when computing non-local dependence. This makes bzip2 not
...
use up the entire 32-bit address space.
llvm-svn: 40596
2007-07-30 17:29:24 +00:00
Owen Anderson
d66e285b2e
Fix a bug caused by indiscriminantly asking for the dominators of a predecessor.
...
llvm-svn: 40595
2007-07-30 16:57:08 +00:00
Devang Patel
e3206cb425
Use SmallPtrSet.
...
llvm-svn: 40560
2007-07-27 18:34:27 +00:00
Chuck Rose III
1a39a2d13d
VStudio compiler errors and placing Function*->ExFunc map under ManagedStatic control.
...
This commit fixes two things. One is a pair of VStudio compiler errors stemming from variables
which defined within the for loop statement and also within the body of the for loop. I fixed these
by renaming one of the two variables. Additionally, I've made the Function*->ExFunc map in
ExternalFunctions.cpp a ManagedStatic object, so that cleanup will be done on llvm_shutdown. In repeated
uses of the interpreter, where the same Function* address may get used for completely differnet functions,
this was causing a crash.
llvm-svn: 40558
2007-07-27 18:26:35 +00:00
Devang Patel
a51e0a3d8d
Fix thinko. Update return status appropriately.
...
llvm-svn: 40546
2007-07-26 20:21:42 +00:00
Owen Anderson
dbf23ccaa0
Fix a couple more bugs in the phi construction by pulling in code that does
...
almost the same things from LCSSA.
llvm-svn: 40540
2007-07-26 18:26:51 +00:00
Dan Gohman
6e853bc73f
Move the GET_SIDE_EFFECT_INFO logic from isInstructionTriviallyDead
...
to Instruction::mayWriteToMemory, fixing a FIXME, and helping
various places that call mayWriteToMemory directly.
llvm-svn: 40533
2007-07-26 16:06:08 +00:00
Dan Gohman
eb47d9213c
Remove a bogus return statement, what appears to have been a pasto
...
from Relation::contradicts in Relation::incorporate.
llvm-svn: 40531
2007-07-26 15:29:35 +00:00
Owen Anderson
3b8cc30a61
Fix what is _hopefully_ the last corner case for loops.
...
llvm-svn: 40503
2007-07-25 23:54:42 +00:00
Owen Anderson
8707412593
My last commit was not correct for nested loops. Fix it, and add a testcase for it.
...
llvm-svn: 40498
2007-07-25 22:19:40 +00:00
Owen Anderson
3c67004d47
Fix an infinite loop on 300.twolf.
...
llvm-svn: 40497
2007-07-25 22:03:06 +00:00
Owen Anderson
7bf26ee444
Fix a bug that was causing GVN to crash on 252.eon.
...
llvm-svn: 40494
2007-07-25 21:13:41 +00:00
Owen Anderson
5e5599b7ce
Add basic support for performing whole-function RLE.
...
Note: This has not yet been thoroughly tested. Use at your own risk.
llvm-svn: 40489
2007-07-25 19:57:03 +00:00
Devang Patel
33227115b9
Add BasicInliner interface.
...
This interface allows clients to inline bunch of functions with module
level call graph information.:wq
llvm-svn: 40486
2007-07-25 18:00:25 +00:00
Owen Anderson
ab6ec2eac2
Add a GVN pass, using the value numbering code I developed for GVNPRE and the
...
load elimination code from RedundantLoadElimination.
llvm-svn: 40469
2007-07-24 17:55:58 +00:00
Owen Anderson
9baaaa52e6
Rename a lot of things to change FastDLE to RedundantLoadElimination.
...
llvm-svn: 40457
2007-07-24 00:17:04 +00:00
Owen Anderson
7292a4a93f
Rename FastDLE as RedundantLoadElimination.
...
llvm-svn: 40456
2007-07-24 00:08:38 +00:00
Owen Anderson
5e68f0c93d
Don't delete volatile loads. Doing so is not safe.
...
llvm-svn: 40448
2007-07-23 22:05:54 +00:00
Owen Anderson
6aba721425
Add FastDLE, the load-elimination counterpart of FastDSE.
...
llvm-svn: 40445
2007-07-23 21:48:08 +00:00
Owen Anderson
5a201baba9
Fix file header.
...
llvm-svn: 40440
2007-07-23 18:30:37 +00:00
Chris Lattner
4512cd2cab
completely remove a transformation that is unsafe in the face of
...
undefs.
llvm-svn: 40439
2007-07-23 17:10:17 +00:00
Devang Patel
5e39293e62
Apply temporary work around to fix llvm mis-compilation
...
reported in PR 1556.
llvm-svn: 40133
2007-07-21 00:34:29 +00:00
Chris Lattner
d82e4a19cc
this xform is already done by the constant folder.
...
llvm-svn: 40124
2007-07-20 22:06:41 +00:00
Dan Gohman
e31a61eeca
Optimize alignment of loads and stores.
...
llvm-svn: 40102
2007-07-20 16:34:21 +00:00
Duncan Sands
2be91fcdd8
Place SCCPSolver also in the anonymous namespace. This
...
pacifies g++-4.2.
llvm-svn: 40089
2007-07-20 08:56:21 +00:00
Owen Anderson
5bd6c3f2c4
Fix a bug where we were marking GEP expressions with the wrong opcode.
...
llvm-svn: 40085
2007-07-20 08:19:20 +00:00
Owen Anderson
f9e6542969
Make val_replace fail early, which reduces the time to optimize 403.gcc to 14.8s.
...
llvm-svn: 40064
2007-07-19 19:57:13 +00:00
Devang Patel
a273d1cd3a
Verify loop info.
...
llvm-svn: 40062
2007-07-19 18:02:32 +00:00
Owen Anderson
6aa17f1def
Use SmallVector and DenseMap in even more places.
...
With this, the time to optimize 403.gcc is down to 15.1s.
llvm-svn: 40042
2007-07-19 06:37:56 +00:00
Owen Anderson
75a244d6eb
Change ValueTable to use a DenseMap for mapping expressions to value numbers.
...
This results in a slight speedup for 403.gcc.
llvm-svn: 40040
2007-07-19 06:13:15 +00:00
Owen Anderson
6a4ff8549b
Move some sets and maps to SmallPtrSet and DenseMap respectively. This
...
reduces the time to optimize 403.gcc from 17.6s to 16.4s.
llvm-svn: 40036
2007-07-19 03:32:44 +00:00
Devang Patel
186e0d8b0a
After a basic block is split into two parts,
...
second part dominates all the blocks dominated
by original basic block. And first part dominates
second part.
llvm-svn: 40035
2007-07-19 02:29:24 +00:00
Devang Patel
de5901523c
Now this temp. fix is not required.
...
llvm-svn: 40034
2007-07-19 02:22:21 +00:00
Devang Patel
8a1d1ac925
Fix typo.
...
llvm-svn: 40025
2007-07-18 23:50:19 +00:00
Devang Patel
bb8ea8cefc
Fix dominator info update to accommodate CFG changes.
...
This fixes PR1559.
llvm-svn: 40024
2007-07-18 23:48:20 +00:00
Owen Anderson
09f86993bd
Take advantage of undefined behavior if the source program tries to GEP
...
beyond the end of an alloca to make FastDSE faster and more aggressive.
llvm-svn: 39945
2007-07-16 23:34:39 +00:00
Owen Anderson
7fcaaadf1c
Add support for walking up memory def chains, which enables finding many more
...
dead stores on 400.perlbench.
llvm-svn: 39929
2007-07-16 21:52:50 +00:00
Reid Spencer
3363f4ad96
Return Undef if the block has no dominator. This was required to allow
...
llvm-gcc build to succeed. Without this change it fails in libstdc++
compilation. This causes no regressions in dejagnu tests. However,
someone who knows this code better might want to review it.
llvm-svn: 39924
2007-07-16 21:03:44 +00:00
Dan Gohman
06c60b6032
Fix comments about vectors to use the current wording.
...
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Chris Lattner
640fd5124d
Repair a regression in Transforms/InstCombine/mul.ll that Reid noticed.
...
llvm-svn: 39896
2007-07-16 04:15:34 +00:00
Nick Lewycky
b7c0c8a350
Start adding and cleaning up comments.
...
llvm-svn: 39894
2007-07-16 02:58:37 +00:00
Chris Lattner
d4fef8dbca
Implement shift-simplify.ll:test[45].
...
First teach instcombine that sign bit checks only demand the
sign bit, this allows simplify demanded bits to hack on
expressions better.
Second, teach instcombine that ashr is useless if only the
sign bit is demanded.
llvm-svn: 39880
2007-07-15 20:54:51 +00:00
Chris Lattner
06205d5567
Implement shift-simplify.ll:test3, turning:
...
(X << 31) <s 0 --> (X&1) != 0
This happens dozens of times in the CFE.
llvm-svn: 39879
2007-07-15 20:42:37 +00:00
Nick Lewycky
39519f5c41
Use maximal intersection algorithm exclusively. Fixes miscompile bug.
...
llvm-svn: 39852
2007-07-14 04:28:04 +00:00
Devang Patel
4cd1413f15
Make LCSSA a loop pass.
...
llvm-svn: 39844
2007-07-13 23:57:11 +00:00
Owen Anderson
d975efab16
Handle GEPs with all-zero indices in the same way we handle pointer-pointer bitcasts. Also, fix a potentia infinite loop.
...
This brings FastDSE to parity with old DSE on 175.vpr.
llvm-svn: 39839
2007-07-13 22:50:48 +00:00
Devang Patel
29ccf8ba52
Disable claims to preserve analysis until open issues are resolved.
...
llvm-svn: 39834
2007-07-13 21:53:42 +00:00
Owen Anderson
9c9ef21432
Be more aggressive in removing dead stores, and in removing instructions trivially dead after DSE.
...
This drastically improves the effect of FastDSE on kimwitu++.
llvm-svn: 39819
2007-07-13 18:26:26 +00:00
Owen Anderson
32c4a05dd4
Reimplement removing stores to allocas at the end of a function. This should be safe now.
...
llvm-svn: 39790
2007-07-12 21:41:30 +00:00
Owen Anderson
d4451dee1e
Make the condition-checking for free with non-trivial dependencies more correct.
...
llvm-svn: 39789
2007-07-12 18:08:51 +00:00
Owen Anderson
5e06995b3d
Remove the end-block handling code. It was unsafe, and making it safe would have resulted in falling back to the slow DSE case. I need to think some more about the right way to handle this.
...
llvm-svn: 39788
2007-07-12 17:52:20 +00:00
Gabor Greif
b8bca52c7d
checked in as obvious,
...
thanks Benoit Boissinot!
llvm-svn: 39774
2007-07-12 13:31:38 +00:00
Owen Anderson
1e1bace52b
Let MemoryDependenceAnalysis take care of updating AliasAnalysis.
...
llvm-svn: 39769
2007-07-12 00:06:21 +00:00
Devang Patel
fac4d1f014
Preserve analysis info.
...
llvm-svn: 39767
2007-07-11 23:47:28 +00:00
Owen Anderson
aa07172340
Handle the case where an entire structure is freed, and its dependency is a store to a field within
...
that structure.
Also, refactor the runOnBasicBlock() function, splitting some of the special cases into separate functions.
llvm-svn: 39762
2007-07-11 23:19:17 +00:00
Owen Anderson
1441470be8
Add support for eliminate stores to stack-allocated memory locations at the end
...
of a function.
llvm-svn: 39754
2007-07-11 21:06:56 +00:00
Owen Anderson
e720144837
Handle eliminating stores that occur right before a free.
...
llvm-svn: 39753
2007-07-11 20:38:34 +00:00
Owen Anderson
bf971aafb6
Clean up a few things based on Chris' feedback.
...
llvm-svn: 39747
2007-07-11 19:03:09 +00:00
Tanya Lattner
ccecbcd779
Adding ability to demote phi to stack.
...
llvm-svn: 39744
2007-07-11 18:41:34 +00:00
Owen Anderson
5e72db3f7f
Add FastDSE, a new algorithm for doing dead store elimination. This algorithm is not as accurate
...
as the current DSE, but it only a linear scan over each block, rather than quadratic. Eventually
(once it has been improved somewhat), this will replace the current DSE.
NOTE: This has not yet been extensively tested.
llvm-svn: 38517
2007-07-11 00:46:18 +00:00
Owen Anderson
084d3c2e2f
Make the pass registration static.
...
llvm-svn: 38508
2007-07-10 20:20:19 +00:00
Anton Korobeynikov
76547349c1
During module cloning copy aliases too. This fixes PR1544
...
llvm-svn: 38505
2007-07-10 19:07:35 +00:00
Nick Lewycky
e635cc43c6
Update the ValueRanges interface to use value numbers instead of Value*s.
...
llvm-svn: 38483
2007-07-10 03:28:21 +00:00
Owen Anderson
4c4b238448
Move some key maps from std::map to DenseMap. This improves the time to optimize Anton's testcase from 17.5s
...
to 15.7s.
llvm-svn: 38480
2007-07-10 00:27:22 +00:00
Owen Anderson
41c2cab873
Use a cheaper test, delaying calling find_leader() until we know that it's necessary. This improves
...
the time to optimize Anton's testcase from 21.1s to 17.6s.
llvm-svn: 38479
2007-07-10 00:09:25 +00:00
Owen Anderson
7ee197ecf2
Add an assertion if find_leader fails.
...
llvm-svn: 38477
2007-07-09 23:57:18 +00:00
Owen Anderson
effc7a7d16
Take advantage of the new fast SmallPtrSet assignment operator when propagating AVAIL_OUT sets.
...
This reduces the time to optimize Anton's testcase from 31.2s to 21.s!
llvm-svn: 38475
2007-07-09 22:29:50 +00:00
Devang Patel
e8ec7661ea
Expose struct size threhold to allow users to tweak their own setting.
...
llvm-svn: 38472
2007-07-09 21:19:23 +00:00
Owen Anderson
56b01eb3d9
Fix a comment.
...
llvm-svn: 38459
2007-07-09 16:43:55 +00:00
Owen Anderson
267ba45249
Improve a hotspot that was making build_sets() slower by calling lookup() too
...
often. This improves Anton's testcase from 36s to 32s.
llvm-svn: 38441
2007-07-09 07:56:55 +00:00
Owen Anderson
1c83b5d999
Start using a set representation that remembers the set of value numbers represented
...
in the set. For the moment, this results in a slight performance decrease, but
it lays the groundwork for future improvements.
llvm-svn: 38439
2007-07-09 06:50:06 +00:00
Owen Anderson
8b99e0ab20
Fix an error where ANTIC_OUT was ending up with more than one expression of
...
the same value number. This fixes an infinite loop on 444.namd.
llvm-svn: 37967
2007-07-07 20:13:57 +00:00
Nick Lewycky
9b2252c6f0
Back out Devang's fix for PR1320 because it causes PR1542.
...
llvm-svn: 37966
2007-07-07 16:23:34 +00:00
Devang Patel
12358b4827
These rountines are now available as part of basic block utilities.
...
llvm-svn: 37955
2007-07-06 22:03:47 +00:00
Devang Patel
86d0ea973d
Request DominanceFrontiner in advance.
...
llvm-svn: 37954
2007-07-06 21:43:22 +00:00
Devang Patel
3ee408264b
Preserve various analysis info.
...
llvm-svn: 37953
2007-07-06 21:40:13 +00:00
Devang Patel
d7767cc2a7
Add SplitEdge and SplitBlock utility routines.
...
llvm-svn: 37952
2007-07-06 21:39:20 +00:00
Owen Anderson
7d4bbc1c0c
Be more aggressive in the heuristic. This mostly exposes more opportunities
...
for the GVN part of GVNPRE to apply.
llvm-svn: 37951
2007-07-06 20:29:43 +00:00
Owen Anderson
3c3dd902ec
Achieve what the incorrect test was trying to do by simply requiring that all
...
critical edges be split before we begin.
llvm-svn: 37949
2007-07-06 18:12:36 +00:00
Owen Anderson
bcdd7ec4c9
Remove an incorrect check.
...
llvm-svn: 37948
2007-07-06 16:52:47 +00:00
Zhou Sheng
1ee941dac4
Correct a typo.
...
llvm-svn: 37936
2007-07-06 06:01:16 +00:00
Owen Anderson
02e9698293
Fix a bunch of issues found in a testcase from 400.perlbench.
...
llvm-svn: 37929
2007-07-05 23:11:26 +00:00
Nick Lewycky
73dd692173
Break "variable canonicalization" out of InequalityGraph and into its own class
...
"ValueNumbering".
llvm-svn: 37881
2007-07-05 03:15:00 +00:00
Owen Anderson
ca1a184fd8
Fix another bug, this time in PREing select instructions.
...
llvm-svn: 37878
2007-07-04 22:33:23 +00:00
Owen Anderson
cd94fc982a
Fix a typo that was killing GVNPRE of select instructions.
...
llvm-svn: 37871
2007-07-04 18:26:18 +00:00
Owen Anderson
664e260a9c
Fix an error in phi translation of GEPs that was causing failures.
...
llvm-svn: 37868
2007-07-04 04:51:16 +00:00
Owen Anderson
2e4b6feac2
Add support for performing GVNPRE on GEP instructions.
...
llvm-svn: 37862
2007-07-03 23:51:19 +00:00
Owen Anderson
b9a494aea3
Add functionality to value number GEP instructions. This also provides the infrastructure that will
...
be used for function calls. NOTE: This does not yet do any transformation of GEPs or function calls.
llvm-svn: 37860
2007-07-03 22:50:56 +00:00
Owen Anderson
6b958c72bd
Make the unary operator case a bit faster, since casts are the only kind of unary operation.
...
llvm-svn: 37857
2007-07-03 19:01:42 +00:00
Owen Anderson
59bd053fc5
Add support for performing GVNPRE on cast instructions, and add a testcase for this.
...
llvm-svn: 37856
2007-07-03 18:37:08 +00:00
Devang Patel
0975c6d7f9
Preserve DominanceFrontier.
...
llvm-svn: 37820
2007-06-29 23:11:49 +00:00
David Greene
1e2a12019f
Fix reference to iterator invalidated by an erase operation. Uncovered
...
by _GLIBCXX_DEBUG.
llvm-svn: 37796
2007-06-29 02:53:16 +00:00
Devang Patel
9feb7f5846
Do not filter loop if candidate branch is in loop header.
...
llvm-svn: 37792
2007-06-29 01:39:53 +00:00
Owen Anderson
67799d4ffb
Add support for value numbering (but not actually optimizing) cast instructions.
...
llvm-svn: 37789
2007-06-29 00:51:03 +00:00
Owen Anderson
c738f7ca42
Add a type field to expressions in preparation for performing GVNPRE on casts.
...
llvm-svn: 37788
2007-06-29 00:40:05 +00:00
Owen Anderson
8a9fa5d081
Add support for performing GVNPRE on select instructions. This fixes test/Transforms/GVNPRE/select.ll.
...
llvm-svn: 37783
2007-06-28 23:51:21 +00:00
Devang Patel
6ba5ad482f
- Undo previous check and allow loop switch for condtion that is not inside
...
loop.
- Avoid loop unswich for loop header branch.
- While cloning dominators fix typo and handle self dominating blocks.
llvm-svn: 37772
2007-06-28 02:05:46 +00:00
Devang Patel
3304e469f7
Update LoopUnswitch pass to preserve DomiantorTree.
...
llvm-svn: 37771
2007-06-28 00:49:00 +00:00
Devang Patel
3c723c8db7
If a condition is not inside a loop then the condition is suitable
...
to loop unswitch candidate for the loop.
llvm-svn: 37770
2007-06-28 00:44:10 +00:00
Owen Anderson
e02da55cc8
Make many sets a much more reasonable size. This decreases the time to optimize
...
Anton's testcase from 35.5s to 34.7s.
llvm-svn: 37769
2007-06-28 00:34:34 +00:00