Commit Graph

2238 Commits

Author SHA1 Message Date
Devang Patel a28a7f1b2d Split condition does not have to be ICmpInst in all cases.
llvm-svn: 41822
2007-09-11 00:12:56 +00:00
Devang Patel f4202e91f8 Check all terminators inside loop.
llvm-svn: 41821
2007-09-10 23:57:58 +00:00
Chris Lattner e804567cd8 remove some dead code, this is handled by constant folding.
llvm-svn: 41819
2007-09-10 23:46:29 +00:00
Devang Patel 2181b8e86a Swap exit condition operands if it works.
llvm-svn: 41817
2007-09-10 23:34:06 +00:00
Chris Lattner c75cbe6473 Prevent tailcallelim from breaking "recursive" calls to builtins.
llvm-svn: 41804
2007-09-10 20:58:55 +00:00
Devang Patel f8ab0a9acc Filter exit conditions which are not yet handled.
llvm-svn: 41800
2007-09-10 18:33:42 +00:00
Devang Patel d7409fdce5 Require SCEV before LCSSA.
llvm-svn: 41798
2007-09-10 18:08:23 +00:00
Chris Lattner 85a51e0060 Don't zap back to back volatile load/stores
llvm-svn: 41759
2007-09-07 05:33:03 +00:00
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
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
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
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
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 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 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 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
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
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
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
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 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
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 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
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
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 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
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
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
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
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
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