1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

2902 Commits

Author SHA1 Message Date
Dan Gohman
0f8f7f179d Add Loop contains utility methods for testing whether a loop
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.

llvm-svn: 91654
2009-12-18 01:24:09 +00:00
Dan Gohman
7c0f6a6c1b Whitespace cleanups.
llvm-svn: 91651
2009-12-18 01:14:11 +00:00
Dan Gohman
c483bed5e8 Reapply LoopStrengthReduce and IVUsers cleanups, excluding the part
of 91296 that caused trouble -- the Processed list needs to be
preserved for the livetime of the pass, as AddUsersIfInteresting
is called from other passes.

llvm-svn: 91641
2009-12-18 00:06:20 +00:00
Evan Cheng
18e334195d Revert 91280-91283, 91286-91289, 91291, 91293, 91295-91296. It apparently introduced a non-deterministic behavior in the optimizer somewhere.
llvm-svn: 91598
2009-12-17 09:39:49 +00:00
Chris Lattner
ea6ba0d59b Fix GetConstantStringInfo to not look into MDString (it works on
real data, not metadata) and fix DbgInfoPrinter to not abuse
GetConstantStringInfo.

llvm-svn: 91444
2009-12-15 19:34:20 +00:00
Devang Patel
ffb33d1df8 Add support to emit debug info for C++ namespaces.
llvm-svn: 91440
2009-12-15 19:16:48 +00:00
Chris Lattner
587962c667 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
John McCall
6bf01a2caf You can't use typedefs to declare template member specializations, and
clang enforces it.

llvm-svn: 91397
2009-12-15 02:35:24 +00:00
Dan Gohman
106fce040d Clear the Processed set when it is no longer used, and clear the
IVUses list in releaseMemory().

llvm-svn: 91296
2009-12-14 17:35:17 +00:00
Dan Gohman
abb2ea84d9 Fix a thinko; isNotAlreadyContainedIn had a built-in negative, so the
condition was inverted when the code was converted to contains().

llvm-svn: 91295
2009-12-14 17:31:01 +00:00
Dan Gohman
c6a7652b5e Drop Loop::isNotAlreadyContainedIn in favor of Loop::contains. The
former was just exposing a LoopInfoBase implementation detail.

llvm-svn: 91286
2009-12-14 17:06:50 +00:00
Dan Gohman
c22d542754 Make getUniqueExitBlocks's precondition assert more precise, to
avoid spurious failures. This fixes PR5758.

llvm-svn: 91147
2009-12-11 20:05:23 +00:00
Dan Gohman
663165c16f Reuse the Threshold value to size these containers because it's
currently somewhat convenient for them to have the same value.

llvm-svn: 90980
2009-12-09 18:48:53 +00:00
Chris Lattner
2f9b661ab8 Add a minor optimization: if we haven't changed the operands of an
add, there is no need to scan the world to find the same add again.
This invalidates the previous testcase, which wasn't wonderful anyway,
because it needed a run of instcombine to permute the use-lists in 
just the right way to before GVN was run (so it was really fragile).
Not a big loss.

llvm-svn: 90973
2009-12-09 17:27:45 +00:00
Chris Lattner
e05f9a128c fix PR5733, a case where we'd replace an add with a lexically identical
binary operator that wasn't an add.  In this case, a xor.  Whoops.

llvm-svn: 90971
2009-12-09 17:18:49 +00:00
Chris Lattner
366b8ac755 enhance NonLocalDepEntry to keep the per-block phi translated address
of the query.

llvm-svn: 90958
2009-12-09 07:31:04 +00:00
Chris Lattner
e0207b46d2 change NonLocalDepEntry from being a typedef for an std::pair to be its
own small class.  No functionality change.

llvm-svn: 90956
2009-12-09 07:08:01 +00:00
Chris Lattner
dda5ca59e2 Switch GVN and memdep to use PHITransAddr, which correctly handles
phi translation of complex expressions like &A[i+1].  This has the
following benefits:

1. The phi translation logic is all contained in its own class with
   a strong interface and verification that it is self consistent.

2. The logic is more correct than before.  Previously, if intermediate
   expressions got PHI translated, we'd miss the update and scan for
   the wrong pointers in predecessor blocks.  @phi_trans2 is a testcase
   for this.

3. We have a lot less code in memdep.

We can handle phi translation across blocks of things like @phi_trans3,
which is pretty insane :).

This patch should fix the miscompiles of 255.vortex, and I tested it 
with a bootstrap of llvm-gcc, llvm-test and dejagnu of course.

llvm-svn: 90926
2009-12-09 01:59:31 +00:00
Chris Lattner
9c2474e272 fix a nasty variable that was shadowing the real CurBB but with the wrong value.
llvm-svn: 90920
2009-12-09 01:19:16 +00:00
Chris Lattner
3211af28ba fix many input tracking bugs.
llvm-svn: 90915
2009-12-09 00:56:14 +00:00
Dan Gohman
ed3d370a10 Fix a typo in a comment, and adjust SmallSet and SmallVector sizes,
that Chris noticed.

llvm-svn: 90910
2009-12-09 00:28:42 +00:00
Chris Lattner
c457aaea0d fix PHI translation to take the PHI out of the instinputs set and add
the translated value back to it if an instruction.

llvm-svn: 90909
2009-12-09 00:18:13 +00:00
Chris Lattner
b0d20540ad instructions defined in CurBB may be intermediate nodes of the computation.
llvm-svn: 90908
2009-12-09 00:10:55 +00:00
Chris Lattner
83cb0b1450 add dumping and sanity checking support.
llvm-svn: 90906
2009-12-09 00:01:00 +00:00
Dan Gohman
2d7d4fb9a6 Put a threshold on the number of users PointerMayBeCaptured
examines; fall back to a conservative answer if there are
more. This works around some several compile time problems
resulting from BasicAliasAnalysis calling PointerMayBeCaptured.

The value has been chosen arbitrarily.

This fixes rdar://7438917 and may partially address PR5708.

llvm-svn: 90905
2009-12-08 23:59:12 +00:00
Chris Lattner
604cebbfc1 make sure that PHITransAddr keeps its 'InstInputs' list up to
date when instsimplify kicks in.

llvm-svn: 90901
2009-12-08 23:42:51 +00:00
Devang Patel
11874672da Revert 90858 90875 and 90805 for now.
llvm-svn: 90898
2009-12-08 23:21:45 +00:00
Chris Lattner
8cc673c6a0 fix a typo (and -> add) and fix GetAvailablePHITranslatedSubExpr to not
side-effect the current object.

llvm-svn: 90837
2009-12-08 06:06:26 +00:00
Victor Hernandez
f5143485fa Rename DIFactory::InsertValue() as DIFactory::InsertDbgValueIntrinsic()
llvm-svn: 90807
2009-12-07 21:54:43 +00:00
Devang Patel
e59f4f7204 Add support to emit debug info for c++ style namespaces.
llvm-svn: 90805
2009-12-07 21:41:32 +00:00
Chris Lattner
3d338590d6 fix typo
llvm-svn: 90793
2009-12-07 19:52:57 +00:00
Chris Lattner
9ed7e3ffb9 add accessor, improve comment.
llvm-svn: 90792
2009-12-07 19:45:30 +00:00
Victor Hernandez
2a16652946 Introduce the "@llvm.dbg.value" debug intrinsic.
The semantics of llvm.dbg.value are that starting from where it is executed, an offset into the specified user source variable is specified to get a new value.

An example:
  call void @llvm.dbg.value(metadata !{ i32 7 }, i64 0, metadata !2)
Here the user source variable associated with metadata #2 gets the value "i32 7" at offset 0.
 

llvm-svn: 90788
2009-12-07 19:36:34 +00:00
Chris Lattner
233d9bf82d add support for phi translation and incorpation of new expression.
llvm-svn: 90782
2009-12-07 19:04:49 +00:00
Chris Lattner
0a810a827f checkpoint of the new PHITransAddr code, still not done and not used by
anything.

llvm-svn: 90779
2009-12-07 18:36:53 +00:00
Nick Lewycky
056fe5f97d Fix indentation in switch statement.
llvm-svn: 90650
2009-12-05 06:37:24 +00:00
Chris Lattner
107fc93d48 Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant.

llvm-svn: 90545
2009-12-04 06:29:29 +00:00
Chris Lattner
269f4c1c24 add to cmake
llvm-svn: 90539
2009-12-04 04:15:36 +00:00
Chris Lattner
167f1dc040 add the start of a class used to handle phi translation in memdep and
gvn (this is just a skeleton so far).  This will ultimately be used
to fix a nasty miscompilation with GVN.

llvm-svn: 90518
2009-12-04 02:10:16 +00:00
Bob Wilson
052088272f Fix a comment typo.
llvm-svn: 90511
2009-12-04 01:33:04 +00:00
Devang Patel
fe7cf074f0 Add support to emit debug info for virtual functions and virtual base classes.
llvm-svn: 90474
2009-12-03 19:11:07 +00:00
Benjamin Kramer
ea59929634 Fix MSVC build.
llvm-svn: 90454
2009-12-03 13:23:03 +00:00
Andreas Neustifter
aed28d814f Convert ProfileVerifier to template so it can be used for different types of ProfileInfo.
llvm-svn: 90451
2009-12-03 12:55:57 +00:00
Andreas Neustifter
75c913c200 Do not create negative edge weights in ProfileEstimator.
Use integer values for weights to prevent rounding errors.
Make ProfileEstimator more robust in general CFGs.

llvm-svn: 90449
2009-12-03 12:41:14 +00:00
Andreas Neustifter
39cc7661ad Use ProfileInfo-API in ProfileInfo Loader and do more assertions.
llvm-svn: 90446
2009-12-03 11:00:37 +00:00
Andreas Neustifter
83d47e4f5f Converted ProfileInfo to template, added more API for ProfileInfo-preserving.
llvm-svn: 90445
2009-12-03 09:30:12 +00:00
Chris Lattner
851aea6ce2 fix PR5673 by being more careful about pointers to functions.
llvm-svn: 90369
2009-12-03 01:05:45 +00:00
Chris Lattner
9ce833945e improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +00:00
Benjamin Kramer
65c962b3aa Silence compiler warnings.
llvm-svn: 90319
2009-12-02 15:33:44 +00:00
Owen Anderson
f47cde694f Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
per Chris' comments.  Adjust testcases to match.

llvm-svn: 90304
2009-12-02 07:35:19 +00:00
Mon P Wang
91ac05d480 Fixed an assertion failure for tracking sext of a vector of integers
llvm-svn: 90290
2009-12-02 04:59:58 +00:00
Devang Patel
122acaf238 Add utility routine to create subprogram definition entry from subprogram declaration entry.
llvm-svn: 90282
2009-12-01 23:09:02 +00:00
Chris Lattner
cb2e2bd645 rename some variables.
llvm-svn: 90258
2009-12-01 21:16:01 +00:00
Chris Lattner
9cd2498f45 tidy
llvm-svn: 90257
2009-12-01 21:15:15 +00:00
Chris Lattner
d576951cec fix 255.vortex again, third time's the charm.
llvm-svn: 90217
2009-12-01 07:33:32 +00:00
Tobias Grosser
74c7605daf Remove ShortNames from getNodeLabel in DOTGraphTraits
llvm-svn: 90134
2009-11-30 12:38:47 +00:00
Tobias Grosser
48d8ba7043 Instantiate DefaultDOTGraphTraits
llvm-svn: 90133
2009-11-30 12:38:13 +00:00
Tobias Grosser
38b3077d08 Small PostDominatorTree improvements
* Do not SEGFAULT if tree entryNode() is NULL
 * Print function names in dotty printer

llvm-svn: 90130
2009-11-30 12:06:37 +00:00
Nick Lewycky
81fea1665b Revert r90107, fixing test/Transforms/GVN/2009-11-29-ReverseMap.ll and the
llvm-gcc build.

llvm-svn: 90113
2009-11-30 07:05:51 +00:00
Chris Lattner
dd895d559f reapply r90093 with an addition of keeping the forward
and reverse nonlocal memdep maps in synch, this should
fix 255.vortex.

llvm-svn: 90107
2009-11-30 02:26:29 +00:00
Nick Lewycky
116b145b02 Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.

llvm-svn: 90099
2009-11-29 21:40:55 +00:00
Chris Lattner
de1d55c200 revert this patch for now, it causes failures of:
LLVM::Transforms/GVN/2009-02-17-LoadPRECrash.ll
    LLVM::Transforms/GVN/2009-06-17-InvalidPRE.ll

llvm-svn: 90096
2009-11-29 21:14:59 +00:00
Chris Lattner
6155ce3427 Fix a really nasty caching bug I introduced in memdep. An entry
was being added to the Result vector, but not being put in the
cache.  This means that if the cache was reused wholesale for a
later query that it would be missing this entry and we'd do an
incorrect load elimination.

Unfortunately, it's not really possible to write a useful 
testcase for this, but this unbreaks 255.vortex.

llvm-svn: 90093
2009-11-29 21:09:36 +00:00
Nick Lewycky
2c7105b098 Detabify.
llvm-svn: 90085
2009-11-29 18:10:39 +00:00
Nick Lewycky
ff44d9d88a Teach memdep to look for memory use intrinsics during dependency queries. Fixes
PR5574.

llvm-svn: 90045
2009-11-28 21:27:49 +00:00
Chris Lattner
f8d8142a06 Enhance InsertPHITranslatedPointer to be able to return a list of newly
inserted instructions.  No functionality change until someone starts using it.

llvm-svn: 90039
2009-11-28 15:39:14 +00:00
Chris Lattner
f825d5d176 implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
way that getUnderlyingObject does it. 

This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!' 
assertion on sqlite3.

llvm-svn: 90038
2009-11-28 15:12:41 +00:00
Chris Lattner
2e5340d0dc enable code to handle un-phi-translatable cases more aggressively:
if we don't have an address expression available in a predecessor,
then model this as the value being clobbered at the end of the pred
block instead of being modeled as a complete phi translation failure.
This is important for PRE of loads because we want to see that the
load is available in all but this predecessor, and complete phi
translation failure results in not getting any information about
predecessors.

This doesn't do anything until I renable code insertion since PRE
now sees that it is available in all but one predecessors, but can't
insert the addressing in the predecessor that is missing it to 
eliminate the redundancy.

llvm-svn: 90037
2009-11-28 14:54:10 +00:00
Chris Lattner
73b425ba51 Rework InsertPHITranslatedPointer to handle the recursive case, this
fixes PR5630 and sets the stage for the next phase of goodness (testcase
pending).

llvm-svn: 90019
2009-11-27 22:05:15 +00:00
Chris Lattner
473e8af336 recursively phi translate bitcast operands too, for consistency.
llvm-svn: 90016
2009-11-27 20:25:30 +00:00
Chris Lattner
b1fceb6006 add support for recursive phi translation and phi
translation of add with immediate.  This allows us
to optimize this function:

void test(int N, double* G) {
  long j;
  G[1] = 1;
    for (j = 1; j < N - 1; j++)
        G[j+1] = G[j] + G[j+1];
}

to only do one load every iteration of the loop.

llvm-svn: 90013
2009-11-27 19:11:31 +00:00
Chris Lattner
bdaed088ea factor some logic out of instcombine into a new SimplifyAddInst method.
llvm-svn: 90011
2009-11-27 17:42:22 +00:00
Chris Lattner
c81be8ddba add comment.
llvm-svn: 90002
2009-11-27 08:40:14 +00:00
Chris Lattner
af321b5729 reduce nesting, no functionality change.
llvm-svn: 90001
2009-11-27 08:37:22 +00:00
Chris Lattner
e7056c8cde limit the recursion depth of GetLinearExpression. This
fixes a crash analyzing consumer-lame, which had an "%X = add %X, 1"
in unreachable code.

llvm-svn: 90000
2009-11-27 08:32:52 +00:00
Chris Lattner
a466dbe80a teach GVN's load PRE to insert computations of the address in predecessors
where it is not available.  It's unclear how to get this inserted 
computation into GVN's scalar availability sets, Owen, help? :)

llvm-svn: 89997
2009-11-27 08:25:10 +00:00
Chris Lattner
0971e6da1f Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation 
again.

llvm-svn: 89992
2009-11-27 06:31:14 +00:00
Chris Lattner
16ee3226ce redisable this, my bootstrap worked because it wasn't an optimized build, whoops.
llvm-svn: 89991
2009-11-27 05:53:01 +00:00
Chris Lattner
ea3b1f2186 try again.
llvm-svn: 89990
2009-11-27 05:19:56 +00:00
Chris Lattner
895214c65e this is causing buildbot failures, disable for now.
llvm-svn: 89985
2009-11-27 01:52:22 +00:00
Chris Lattner
02ffb0a608 teach phi translation of GEPs to simplify geps like 'gep x, 0'.
This allows us to compile the example from PR5313 into:

LBB1_2:                                                     ## %bb
	incl	%ecx
	movb	%al, (%rsi)
	movslq	%ecx, %rax
	movb	(%rdi,%rax), %al
	testb	%al, %al
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movslq	%eax, %rcx
	incl	%eax
	movb	(%rdi,%rcx), %cl
	movb	%cl, (%rsi)
	movslq	%eax, %rcx
	cmpb	$0, (%rdi,%rcx)
	jne	LBB1_2

llvm-svn: 89981
2009-11-27 00:34:38 +00:00
Chris Lattner
6611a6f733 factor some instcombine simplifications for getelementptr out to a new
SimplifyGEPInst method in InstructionSimplify.h.  No functionality change.

llvm-svn: 89980
2009-11-27 00:29:05 +00:00
Chris Lattner
4810fa619f teach memdep to do trivial PHI translation of GEPs. More to
come.

llvm-svn: 89979
2009-11-27 00:07:37 +00:00
Chris Lattner
4824ebfded Teach memdep to phi translate bitcasts. This allows us to compile
the example in GCC PR16799 to:

LBB1_2:                                                     ## %bb1
	movl	%eax, %eax
	subq	%rax, %rdi
	movq	%rdi, (%rcx)
	movl	(%rdi), %eax
	testl	%eax, %eax
	je	LBB1_2

instead of:

LBB1_2:                                                     ## %bb1
	movl	(%rdi), %ecx
	subq	%rcx, %rdi
	movq	%rdi, (%rax)
	cmpl	$0, (%rdi)
	je	LBB1_2

llvm-svn: 89978
2009-11-26 23:41:07 +00:00
Chris Lattner
5020bb83d7 factor some code out into some helper functions.
llvm-svn: 89975
2009-11-26 23:18:49 +00:00
Chris Lattner
ce573daf09 Implement PR1143 (at -m64) by making basicaa look through extensions. We
previously already handled it at -m32 because there were no i32->i64 
extensions for addressing.

llvm-svn: 89959
2009-11-26 18:53:33 +00:00
Chris Lattner
a403a7eddc fix two transposed lines duncan caught and add an explanatory comment.
llvm-svn: 89958
2009-11-26 18:35:46 +00:00
Chris Lattner
f7a0da351e this todo is resolved.
llvm-svn: 89957
2009-11-26 17:14:10 +00:00
Chris Lattner
2178a80b90 move DecomposeGEPExpression out into ValueTracking.cpp
llvm-svn: 89956
2009-11-26 17:12:50 +00:00
Chris Lattner
d86a693b70 teach GetLinearExpression to be a bit more aggressive.
llvm-svn: 89955
2009-11-26 17:00:01 +00:00
Chris Lattner
62a36a703c resolve a fixme. I haven't figured out how to write a testcase
to exercise this though.

llvm-svn: 89954
2009-11-26 16:52:32 +00:00
Chris Lattner
9c88c96b3f Teach basicaa that x|c == x+c when the c bits of x are clear. This
allows us to compile the example in readme.txt into:

LBB1_1:                                                     ## %bb
	movl	4(%rdx,%rax), %ecx
	movl	%ecx, %esi
	imull	(%rdx,%rax), %esi
	imull	%esi, %ecx
	movl	%esi, 8(%rdx,%rax)
	imull	%ecx, %esi
	movl	%ecx, 12(%rdx,%rax)
	movl	%esi, 16(%rdx,%rax)
	imull	%ecx, %esi
	movl	%esi, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

instead of:

LBB1_1: 
	movl	(%rdx,%rax), %ecx
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 8(%rdx,%rax)
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 12(%rdx,%rax)
	imull	8(%rdx,%rax), %ecx
	movl	%ecx, 16(%rdx,%rax)
	imull	12(%rdx,%rax), %ecx
	movl	%ecx, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

GCC (4.2) doesn't seem to be able to eliminate the loads in this 
testcase either, it generates:

L2:
	movl	(%rdx), %eax
	imull	4(%rdx), %eax
	movl	%eax, 8(%rdx)
	imull	4(%rdx), %eax
	movl	%eax, 12(%rdx)
	imull	8(%rdx), %eax
	movl	%eax, 16(%rdx)
	imull	12(%rdx), %eax
	movl	%eax, 20(%rdx)
	addl	$4, %ecx
	addq	$16, %rdx
	cmpl	$1002, %ecx
	jne	L2

llvm-svn: 89952
2009-11-26 16:26:43 +00:00
Chris Lattner
677b93d4c8 teach basicaa that A[i] != A[i+1].
llvm-svn: 89951
2009-11-26 16:18:10 +00:00
Chris Lattner
69e59e50f3 Change the other half of aliasGEP (which handles GEP differencing) to use DecomposeGEPExpression. This dramatically simplifies and shrinks the code by eliminating the horrible CheckGEPInstructions method, fixes a miscompilation (@test3) and makes the code more aggressive. In particular, we now handle the @test4 case, which is reduced from the SmallPtrSet constructor. Missing this caused us to emit a variable length memset instead of a fixed size one.
llvm-svn: 89922
2009-11-26 02:17:34 +00:00
Chris Lattner
bd90980add Generalize DecomposeGEPExpression to exactly handle what Value::getUnderlyingObject does (when TD is around). This allows us to avoid calling DecomposeGEPExpression unless the ultimate alias check we care about passes, speedup up BasicAA a bit.
llvm-svn: 89920
2009-11-26 02:14:59 +00:00
Chris Lattner
57bca7101d Implement a new DecomposeGEPExpression method, which decomposes a GEP into a list of scaled offsets. Use this to eliminate some previous ad-hoc code which was subtly broken (it assumed all Constant*'s were non-zero, but strange constant express could be zero).
llvm-svn: 89915
2009-11-26 02:13:03 +00:00
Chris Lattner
260350330e Use GEPOperator more pervasively to simplify code.
llvm-svn: 89914
2009-11-26 02:11:08 +00:00
Chris Lattner
9646ffc9a2 remove some redundant braces
llvm-svn: 89912
2009-11-26 01:50:12 +00:00
Devang Patel
d50fc13c19 Use StringRef (again) in DebugInfo interface.
llvm-svn: 89866
2009-11-25 17:36:49 +00:00
Devang Patel
11c5d09a35 Emit pubtypes.
llvm-svn: 89725
2009-11-24 01:14:22 +00:00
Jim Grosbach
910fa44a53 enable iv-users simplification by default
llvm-svn: 89713
2009-11-23 23:25:54 +00:00
Devang Patel
80eee0d8a4 Add CreateLocation varinat that accepts MDNode (with a default value).
llvm-svn: 89689
2009-11-23 19:11:20 +00:00
Chris Lattner
23bebfe8d5 fix comment, thanks all :)
llvm-svn: 89666
2009-11-23 17:07:35 +00:00
Chris Lattner
1637c0e720 use the new isNoAlias method to simplify some code, only do an escaping check if
we have a non-constant pointer.  Constant pointers can't be local.

llvm-svn: 89665
2009-11-23 16:46:41 +00:00
Chris Lattner
29221ce8d7 whitespace cleanup, tidying
llvm-svn: 89664
2009-11-23 16:45:27 +00:00
Chris Lattner
faf117b46b speed up BasicAA a bit by implementing a long-standing TODO.
llvm-svn: 89663
2009-11-23 16:44:43 +00:00
Dan Gohman
58bb87921b Make ConstantFoldConstantExpression recursively visit the entire
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.

Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.

llvm-svn: 89659
2009-11-23 16:22:21 +00:00
Nick Lewycky
8cbd0c3156 Remove unused LLVMContext.
llvm-svn: 89642
2009-11-23 03:29:18 +00:00
Nick Lewycky
1328a7b47f Remove dead LLVMContext argument.
llvm-svn: 89641
2009-11-23 03:26:09 +00:00
Chris Lattner
73422d2e9b add fixme for dubious code. Duncan, what do you think?
llvm-svn: 89602
2009-11-22 16:16:48 +00:00
Chris Lattner
632f60ccc9 remove a silly condition that doesn't make a lot of sense anymore.
llvm-svn: 89601
2009-11-22 16:15:59 +00:00
Chris Lattner
59be5d3703 reduce indentation, no functionality change.
llvm-svn: 89600
2009-11-22 16:05:05 +00:00
Chris Lattner
b6ecd40652 Remove the AliasAnalysis::getMustAliases method, which is dead.
The hasNoModRefInfoForCalls isn't worth it as a filter because 
basicaa provides m/r info and everything chains to it, so remove
it.

llvm-svn: 89599
2009-11-22 16:01:44 +00:00
Nick Lewycky
e7829c73f2 Remove dead code. While there, also turn a few 'T* ' into 'T *' to match the
rest of the file.

llvm-svn: 89577
2009-11-22 02:38:11 +00:00
Dan Gohman
b9c2249009 Use stripPointerCasts(). Thanks Duncan!
llvm-svn: 89472
2009-11-20 19:33:16 +00:00
Dan Gohman
198fbdadcf Revert the rule that considers comparisons between two pointers in the
same object to be a non-capture; Duncan pointed out a way that such
a comparison could be a capture.

Make the rule that considers a comparison against null more specific,
and only consider noalias return values compared against null. This
still supports test/Transforms/GVN/nonescaping-malloc.ll, and is not
susceptible to the problem Duncan pointed out with noalias arguments.

llvm-svn: 89468
2009-11-20 17:50:21 +00:00
Dan Gohman
be82a074fa Simplify this code; it's not necessary to check isIdentifiedObject here
because if the results from getUnderlyingObject match, the values must
be from the same underlying object, even if we don't know what that
object is.

llvm-svn: 89434
2009-11-20 01:34:03 +00:00
Dan Gohman
9f19d60c14 Teach getSmallConstantTripMultiple about Shl operators.
llvm-svn: 89426
2009-11-20 01:09:34 +00:00
Dan Gohman
2ee7f3780f Refine the capture tracking rules for comparisons to be more
careful about crazy methods of capturing pointers using comparisons.
Comparisons of identified objects with null in the default address
space are not captures. And, comparisons of two pointers within the
same identified object are not captures.

llvm-svn: 89421
2009-11-20 00:50:47 +00:00
Dan Gohman
dfd39e724e Use isVoidTy().
llvm-svn: 89419
2009-11-20 00:43:11 +00:00
Dan Gohman
8154e3118a Refine this to only apply to null in the default address space.
llvm-svn: 89411
2009-11-19 23:53:49 +00:00
Dan Gohman
44ddc50043 Extend CaptureTracking to indicate when a value is never stored, even
if it is not ultimately captured. Teach BasicAliasAnalysis that a 
local object address which does not escape and is never stored does
not alias with a value resulting from a load.

llvm-svn: 89398
2009-11-19 21:57:48 +00:00
Dan Gohman
141e028b96 Comparing a pointer with null is not a capture.
llvm-svn: 89389
2009-11-19 21:34:07 +00:00
Jim Grosbach
3a0e57424e Teach IVUsers to keep things simpler and track loop-invariant strides only
for uses inside the loop. This works better with LSR. Disabled behind
-simplify-iv-users while benchmarking.

llvm-svn: 89299
2009-11-19 02:05:44 +00:00
Dan Gohman
f3ab031fde Simplify ComputeMultiple so that it doesn't depend on TargetData.
llvm-svn: 89175
2009-11-18 00:58:27 +00:00
Devang Patel
34b8b72944 Remove dead code.
llvm-svn: 89156
2009-11-17 22:39:08 +00:00
Chris Lattner
f3d89dee33 typo spotted by duncan.
llvm-svn: 88884
2009-11-16 03:51:42 +00:00
Chris Lattner
34aefed024 teach LVI to infer edge information from switch instructions.
This allows JT to eliminate a ton of infeasible edges when
handling code like the templates in PatternMatch.h

llvm-svn: 88869
2009-11-15 20:02:12 +00:00
Chris Lattner
69a52dd583 fix a logic error that would cause LVI-JT to miscompile
some conditionals

llvm-svn: 88868
2009-11-15 20:01:24 +00:00
Chris Lattner
7ea8b3fbf8 implement the first stab at caching queries. This isn't correct
(because the invalidation logic is missing) but LVI isn't enabled
by default anyway.

llvm-svn: 88867
2009-11-15 20:00:52 +00:00
Chris Lattner
b9a9336376 refactor a bunch of code forming the new LazyValueInfoCache
and LVIQuery classes, no functionality change.

llvm-svn: 88866
2009-11-15 19:59:49 +00:00
Nick Lewycky
fba1efd298 Teach BasicAA that a constant expression can't alias memory provably not
allocated until runtime (such as an alloca). Patch by Hans Wennborg!

llvm-svn: 88760
2009-11-14 06:15:14 +00:00
Devang Patel
3e2aba2402 Revert r87059 for now. It is failing clang tests.
llvm-svn: 87070
2009-11-13 02:27:33 +00:00
Victor Hernandez
0be9d07279 Remove unnecessary llvm.dbg.declare bitcast
llvm-svn: 87059
2009-11-13 01:44:55 +00:00
Devang Patel
c024e96ca3 "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for line number and scopes.
llvm-svn: 87014
2009-11-12 19:02:56 +00:00
Evan Cheng
b0a193db31 - Teach LSR to avoid changing cmp iv stride if it will create an immediate that
cannot be folded into target cmp instruction.
- Avoid a phase ordering issue where early cmp optimization would prevent the
  later count-to-zero optimization.
- Add missing checks which could cause LSR to reuse stride that does not have
  users.
- Fix a bug in count-to-zero optimization code which failed to find the pre-inc
  iv's phi node.
- Remove, tighten, loosen some incorrect checks disable valid transformations.
- Quite a bit of code clean up.

llvm-svn: 86969
2009-11-12 07:35:05 +00:00
Chris Lattner
3e63fb7318 various fixes to the lattice transfer functions.
llvm-svn: 86952
2009-11-12 04:57:13 +00:00
Chris Lattner
6d1ca5d976 Add a new getPredicateOnEdge method which returns more rich information for
constant constraints.  Improve the LVI lattice to include inequality 
constraints.

llvm-svn: 86950
2009-11-12 04:36:58 +00:00
Chris Lattner
b5bb115ece expose edge information and switch j-t to use it.
llvm-svn: 86920
2009-11-12 01:29:10 +00:00
Chris Lattner
46056d81aa move some stuff into DEBUG's and turn on lazy-value-info for
the basic.ll testcase.

llvm-svn: 86918
2009-11-12 01:22:16 +00:00
Devang Patel
c70b8eefb7 Do not use StringRef in DebugInfo interface.
This allows StringRef to skip controversial if(str) check in constructor.
Buildbots, wait for corresponding clang and llvm-gcc FE check-ins!

llvm-svn: 86914
2009-11-12 00:50:58 +00:00
Chris Lattner
4c831006c7 make LazyValueInfo actually to some stuff. This isn't very tested but improves
strswitch.

llvm-svn: 86889
2009-11-11 22:48:44 +00:00
Chris Lattner
b45381c3f0 stub out some LazyValueInfo interfaces, and have JumpThreading
start using them in a trivial way when -enable-jump-threading-lvi
is passed.  enable-jump-threading-lvi will be my playground for 
awhile.

llvm-svn: 86789
2009-11-11 02:08:33 +00:00
Chris Lattner
6c04051d2a Stub out a new lazy value info pass, which will eventually
vend value constraint information to the optimizer.

llvm-svn: 86767
2009-11-11 00:22:30 +00:00
Chris Lattner
c60b41d336 remove redundant foward declaration. This function is already in
Analysis/Passes.h

llvm-svn: 86765
2009-11-11 00:21:21 +00:00
Devang Patel
5c983cb2ab Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Chris Lattner
ec4264fbb0 move some generally useful functions out of jump threading
into libanalysis and transformutils.

llvm-svn: 86735
2009-11-10 22:26:15 +00:00
Devang Patel
e70bec27b0 Process InlinedAt location info.
Update InsertDeclare to return newly inserted llvm.dbg.declare intrinsic.

llvm-svn: 86727
2009-11-10 22:05:35 +00:00
Victor Hernandez
3c98070f2c Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size
llvm-svn: 86676
2009-11-10 08:32:25 +00:00
Victor Hernandez
89c04dbe2f Add ComputeMultiple() analysis function that recursively determines if a Value V is a multiple of unsigned Base
llvm-svn: 86675
2009-11-10 08:28:35 +00:00