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
Chris Lattner
04da9d4b33
I misread the parens, not so redundant after all.
...
llvm-svn: 86648
2009-11-10 02:04:54 +00:00
Chris Lattner
fb540241c8
remove some redundant parens.
...
llvm-svn: 86645
2009-11-10 01:56:04 +00:00
Chris Lattner
a279728372
add a new SimplifyInstruction API, which is like ConstantFoldInstruction,
...
except that the result may not be a constant. Switch jump threading to
use it so that it gets things like (X & 0) -> 0, which occur when phi preds
are deleted and the remaining phi pred was a zero.
llvm-svn: 86637
2009-11-10 01:08:51 +00:00
Jeffrey Yasskin
23ac706aab
Fix DenseMap iterator constness.
...
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.
The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.
Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.
Patch by Victor Zverovich!
llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Chris Lattner
3730cf6fef
factor simplification logic for AND and OR out to InstSimplify from instcombine.
...
llvm-svn: 86635
2009-11-10 00:55:12 +00:00
Chris Lattner
9941f27797
pull a bunch of logic out of instcombine into instsimplify for compare
...
simplification, this handles the foldable fcmp x,x cases among many others.
llvm-svn: 86627
2009-11-09 23:55:12 +00:00
Dan Gohman
22719d2a1a
Pass the (optional) TargetData object to ConstantFoldInstOperands
...
and ConstantFoldCompareInstOperands.
llvm-svn: 86626
2009-11-09 23:34:17 +00:00
Chris Lattner
25700676d4
rename SimplifyCompare -> SimplifyCmpInst and split it into
...
Simplify[IF]Cmp pieces. Add some predicates to CmpInst to
determine whether a predicate is fp or int.
llvm-svn: 86624
2009-11-09 23:28:39 +00:00
Chris Lattner
131172dc76
fix ConstantFoldCompareInstOperands to take the LHS/RHS as
...
individual operands instead of taking a temporary array
llvm-svn: 86619
2009-11-09 23:06:58 +00:00
Chris Lattner
126d78f1c7
stub out a new libanalysis "instruction simplify" interface that
...
takes decimated instructions and applies identities to them. This
is pretty minimal at this point, but I plan to pull some instcombine
logic out into these and similar routines.
llvm-svn: 86613
2009-11-09 22:57:59 +00:00
Dan Gohman
6780148e20
Default-addressspace null pointers don't alias anything. This allows
...
GVN to be more aggressive. Patch by Hans Wennborg! (with a comment added by me)
llvm-svn: 86582
2009-11-09 19:29:11 +00:00
Dan Gohman
68d528963c
Minor tidiness fixes.
...
llvm-svn: 86565
2009-11-09 18:19:43 +00:00
Victor Hernandez
8736a8fca4
Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
...
Here is the original commit message:
This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.
Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.
Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.
Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.
Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.
Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.
Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.
llvm-svn: 86311
2009-11-07 00:16:28 +00:00
Devang Patel
1a557eacb8
Tolerate invalid derived type.
...
llvm-svn: 86269
2009-11-06 18:24:05 +00:00
Devang Patel
0d1f6a9d0e
Do not bother to emit debug info for nameless global variable.
...
llvm-svn: 86259
2009-11-06 17:58:12 +00:00
Chris Lattner
903ae55e1c
remove a bunch of extraneous LLVMContext arguments
...
from various APIs, addressing PR5325.
llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Victor Hernandez
a5a12cd62e
Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
...
llvm-svn: 86213
2009-11-06 01:33:24 +00:00
Dan Gohman
770613e3be
Fix IVUsers to avoid assuming that the loop has a unique backedge.
...
llvm-svn: 86161
2009-11-05 19:41:37 +00:00
Dan Gohman
6f6862e558
Factor out the predicate code for loopsimplify form exit blocks into
...
a separate helper function.
llvm-svn: 86159
2009-11-05 19:21:41 +00:00
Victor Hernandez
21ec158c23
Update CreateMalloc so that its callers specify the size to allocate:
...
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.
Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.
Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.
Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.
Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.
Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.
llvm-svn: 86077
2009-11-05 00:03:03 +00:00
Devang Patel
c69c29bc4b
While calculating original type size for a derived type, handle type variants encoded as DIDerivedType appropriately.
...
This improves bitfield support.
llvm-svn: 86073
2009-11-04 23:48:00 +00:00
Victor Hernandez
628b65ea6e
Changes requested (avoid getFunction(), avoid Type creation via isVoidTy(), and avoid redundant isFreeCall cases) in feedback to r85176
...
llvm-svn: 85936
2009-11-03 20:39:35 +00:00
Victor Hernandez
046375ac3f
Changes (* location in pointer variables, avoiding include, and using APInt::getLimitedValue) based on feedback to r85814
...
llvm-svn: 85933
2009-11-03 20:02:35 +00:00
Chris Lattner
7585c1f162
remove unneeded checks of isFreeCall
...
llvm-svn: 85866
2009-11-03 05:35:19 +00:00
Chris Lattner
cbd903cd12
remove a check of isFreeCall: the argument to free is already nocapture so the generic call code works fine.
...
llvm-svn: 85865
2009-11-03 05:34:51 +00:00
Victor Hernandez
1d2fd19df6
Set bit instead of calling pow() to compute 2 << n
...
llvm-svn: 85814
2009-11-02 18:51:28 +00:00
Edward O'Callaghan
e91c6a1a44
Fix for warning seen on DF-BSD, Victor, please fix this to use a shift instead of pow()
...
llvm-svn: 85781
2009-11-02 03:14:31 +00:00
Edward O'Callaghan
64a2e8f6a5
Apply fix for PR5135, Credit to Andreas Neustifter.
...
llvm-svn: 85779
2009-11-02 02:55:39 +00:00
Duncan Sands
fd3669403c
Add a missing closing parenthesis, and tweak to fit in 80
...
columns.
llvm-svn: 85732
2009-11-01 19:12:43 +00:00
Chris Lattner
11944e39d4
add a comment about why we don't allow inlining indbr.
...
llvm-svn: 85724
2009-11-01 18:16:30 +00:00
Douglas Gregor
16c6819959
Reverting 85714, 85715, 85716, which are breaking the build
...
llvm-svn: 85717
2009-11-01 16:42:53 +00:00
Dan Gohman
58714b62b6
Add a function to Passes.h to allow clients to create instances
...
of the ScalarEvolution pass without needing to #include ScalarEvolution.h.
llvm-svn: 85716
2009-11-01 15:28:36 +00:00
Dan Gohman
9cdf5185a3
Don't #include Pass.h from CallGraph.h.
...
llvm-svn: 85715
2009-11-01 15:23:35 +00:00
Chris Lattner
7a60ef5e23
pull check for return inst out of loop, never inline a callee that contains
...
an indirectbr.
llvm-svn: 85702
2009-11-01 03:07:53 +00:00
Dan Gohman
0079f87732
Rename forgetLoopBackedgeTakenCount to forgetLoop, because it
...
clears out more information than just the stored backedge taken count.
llvm-svn: 85664
2009-10-31 15:04:55 +00:00
Dan Gohman
7d09ca3e5b
Make ScalarEvolutionAliasAnalysis slightly more aggressive, by making an
...
underlying alias call even for non-identified-object values.
llvm-svn: 85656
2009-10-31 14:32:25 +00:00
Devang Patel
b16ace1014
If string field is empty then return NULL.
...
llvm-svn: 85630
2009-10-30 22:52:47 +00:00
Devang Patel
2b9d1ade65
If a type is derived from a derived type then calculate size appropriately.
...
llvm-svn: 85619
2009-10-30 22:09:30 +00:00
Devang Patel
093d35bd8a
First bitcase use may not lead to a dbg.declare intrinsic. Iterate uses until one find's dbg.declare intrinsic.
...
Patch by Sunae Seo.
llvm-svn: 85518
2009-10-29 18:20:34 +00:00
Zhongxing Xu
93af2d027f
fix 80-col.
...
llvm-svn: 85480
2009-10-29 04:41:24 +00:00
Zhongxing Xu
45d8013f73
Explicitly convert to double to suppress Visual C++ 2008 build error C2668 pow is ambiguous call to overloaded function
...
llvm-svn: 85478
2009-10-29 03:43:06 +00:00
Victor Hernandez
917cf94b22
Extend getMallocArraySize() to determine the array size if the malloc argument is:
...
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)
Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.
llvm-svn: 85421
2009-10-28 20:18:55 +00:00
Owen Anderson
cfb2c9edeb
Treat lifetime begin/end markers as allocations/frees respectively for the
...
purposes for GVN/DSE.
llvm-svn: 85383
2009-10-28 07:05:35 +00:00
Owen Anderson
a2584a4c64
Be more careful about invariance reasoning on "store" queries. Stores still need
...
to depend on Ref and ModRef calls within the invariant region.
llvm-svn: 85380
2009-10-28 06:30:52 +00:00
Owen Anderson
6cf32f04df
Add trivial support for the invariance intrinsics to memdep. This logic is
...
purely local for now.
llvm-svn: 85378
2009-10-28 06:18:42 +00:00
Chris Lattner
2bc8002f4c
rename indbr -> indirectbr to appease the residents of #llvm.
...
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Chris Lattner
5bd76ffebb
make the build build.
...
llvm-svn: 85319
2009-10-27 21:43:39 +00:00
Chris Lattner
665b9e2a3c
Random updates to passes for indbr, I need blockaddress before I can do much more.
...
llvm-svn: 85316
2009-10-27 21:27:42 +00:00
Victor Hernandez
0f662a7acf
Rename MallocFreeHelper as MemoryBuiltins
...
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez
6c86b93663
Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
...
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez
673c036bc7
Remove FreeInst.
...
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.
llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Dan Gohman
c8468855a7
Teach BasicAA how to analyze Select instructions, and make it more
...
aggressive on PHI instructions.
llvm-svn: 85158
2009-10-26 21:55:43 +00:00
Devang Patel
9eb437047b
Add support to encode type info using llvm::Constant.
...
Patch by Talin!
llvm-svn: 85126
2009-10-26 16:54:35 +00:00
Nick Lewycky
2b8400628d
Remove includes of Support/Compiler.h that are no longer needed after the
...
VISIBILITY_HIDDEN removal.
llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky
711c726c97
Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
...
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.
llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Chris Lattner
d8db8b6952
Teach FoldBitCast to be able to handle bitcasts from (e.g.) i128 -> <4 x float>.
...
This allows us to simplify this:
union vec2d {
double e[2];
double v __attribute__((vector_size(16)));
};
typedef union vec2d vec2d;
static vec2d a={{1,2}}, b={{3,4}};
vec2d foo () {
return (vec2d){ .v = a.v + b.v * (vec2d){{5,5}}.v };
}
down to:
define %0 @foo() nounwind ssp {
entry:
%mrv5 = insertvalue %0 undef, double 1.600000e+01, 0 ; <%0> [#uses=1]
%mrv6 = insertvalue %0 %mrv5, double 2.200000e+01, 1 ; <%0> [#uses=1]
ret %0 %mrv6
}
instead of:
define %0 @foo() nounwind ssp {
entry:
%mrv5 = insertvalue %0 undef, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 0), 0 ; <%0> [#uses=1]
%mrv6 = insertvalue %0 %mrv5, double extractelement (<2 x double> fadd (<2 x double> fmul (<2 x double> bitcast (<1 x i128> <i128 85174437667405312423031577302488055808> to <2 x double>), <2 x double> <double 3.000000e+00, double 4.000000e+00>), <2 x double> <double 1.000000e+00, double 2.000000e+00>), i32 1), 1 ; <%0> [#uses=1]
ret %0 %mrv6
}
llvm-svn: 85040
2009-10-25 06:15:37 +00:00
Chris Lattner
d80c1f61d2
move FoldBitCast earlier in the file, and use it instead of
...
ConstantExpr::getBitCast in various places.
llvm-svn: 85039
2009-10-25 06:08:26 +00:00
Chris Lattner
f6cb8d6b90
refactor FoldBitCast to reduce nesting and to always return a constantexpr
...
instead of returning null on failure. No functionality change.
llvm-svn: 85038
2009-10-25 06:02:57 +00:00
Chris Lattner
5f456758c6
various cleanups suggested by Duncan
...
llvm-svn: 84993
2009-10-24 05:27:19 +00:00
Chris Lattner
9a1f5c9f90
fix PR5287, a serious regression from my previous patches. Thanks to
...
Duncan for the nice tiny testcase.
llvm-svn: 84992
2009-10-24 05:22:15 +00:00
Victor Hernandez
e8998896f5
Auto-upgrade free instructions to calls to the builtin free function.
...
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.
llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Victor Hernandez
8428eb5720
Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
...
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Chris Lattner
4874f5bce5
teach libanalysis to simplify vector loads with bitcast sources. This
...
implements something out of Target/README.txt producing:
_foo: ## @foo
movl 4(%esp), %eax
movapd LCPI1_0, %xmm0
movapd %xmm0, (%eax)
ret $4
instead of:
_foo: ## @foo
movl 4(%esp), %eax
movapd _b, %xmm0
mulpd LCPI1_0, %xmm0
addpd _a, %xmm0
movapd %xmm0, (%eax)
ret $4
llvm-svn: 84942
2009-10-23 06:57:37 +00:00
Chris Lattner
2ee1f0f0b5
enhance FoldReinterpretLoadFromConstPtr to handle loads of up to 32
...
bytes (i256).
llvm-svn: 84941
2009-10-23 06:50:36 +00:00
Chris Lattner
b1d2706a4c
teach libanalysis to fold int and fp loads from almost arbitrary
...
non-type-safe constant initializers. This sort of thing happens
quite a bit for 4-byte loads out of string constants, unions,
bitfields, and an interesting endianness check from sqlite, which
is something like this:
const int sqlite3one = 1;
# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
all of these macros now constant fold away.
This implements PR3152 and is based on a patch started by Eli, but heavily
modified and extended.
llvm-svn: 84936
2009-10-23 06:23:49 +00:00
Chris Lattner
cd80b1711b
move another load optimization from instcombine -> libanalysis.
...
llvm-svn: 84841
2009-10-22 06:44:07 +00:00
Chris Lattner
3fb4c19b7d
move 'loading i32 from string' optimization from instcombine
...
to libanalysis. Instcombine shrinking... does this even
make sense???
llvm-svn: 84840
2009-10-22 06:38:35 +00:00
Chris Lattner
2c8c8533b1
Move some constant folding logic for loads out of instcombine into
...
Analysis/ConstantFolding.cpp. This doesn't change the behavior of
instcombine but makes other clients of ConstantFoldInstruction
able to handle loads. This was partially extracted from Eli's patch
in PR3152.
llvm-svn: 84836
2009-10-22 06:25:11 +00:00
Dan Gohman
bc58eb97fe
Fix another place that calls Loop::contains a lot to construct a sorted
...
container of the blocks and do efficient lookups. This makes
isLoopSimplifyForm much faster on large loops, fixing a significant
compile-time issue in builds with assertions enabled.
llvm-svn: 84673
2009-10-20 20:41:13 +00:00
Chris Lattner
5b8e288c5f
fix the other issue with ID's, hopefully really fixing the linux build.
...
llvm-svn: 84403
2009-10-18 04:58:34 +00:00
Chris Lattner
a1aaf47423
fix some problems with ID definitions, which will hopefully fix the build bots.
...
llvm-svn: 84399
2009-10-18 04:27:14 +00:00
Chris Lattner
8851d6cf9c
add function passes for printing various dominator datastructures
...
accessible through opt. Patch by Tobias Grosser!
llvm-svn: 84397
2009-10-18 04:10:40 +00:00
Chris Lattner
f202995415
make DOTGraphTraits public, patch by Tobias Grosser!
...
llvm-svn: 84396
2009-10-18 04:09:11 +00:00
Chris Lattner
a72ccc6fee
inline isGEP away.
...
llvm-svn: 84373
2009-10-17 23:48:54 +00:00
Victor Hernandez
a25a2890fa
Remove MallocInst from LLVM Instructions.
...
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Victor Hernandez
6d11519b1f
Invert isSafeToGetMallocArraySize check because we return NULL when we don't know the size.
...
Thanks to Duncan Sands for noticing this bug.
llvm-svn: 84261
2009-10-16 18:08:17 +00:00
Evan Cheng
54b34ff68d
When checking aliases between phi sources and V2, we know the sources are not themselves phi nodes. However, V2 may be. Call aliasCheck with V2 first to potentially eliminate a std::swap call.
...
llvm-svn: 84226
2009-10-16 00:33:09 +00:00
Victor Hernandez
603a11de4e
Fix bug where array malloc with unexpected computation of the size argument resulted in MallocHelper
...
identifying the malloc as a non-array malloc. This broke GlobalOpt's optimization of stores of mallocs
to global variables.
The fix is to classify malloc's into 3 categories:
1. non-array mallocs
2. array mallocs whose array size can be determined
3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized
getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their
malloc optimization if this function returns NULL.
Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in
isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples.
llvm-svn: 84199
2009-10-15 20:14:52 +00:00
Nick Lewycky
7ec7f1ce0f
Add missing break statements! Thanks to Duncan Sands for pointing this out!
...
llvm-svn: 84191
2009-10-15 18:48:58 +00:00
Nick Lewycky
4ba7b77812
Teach basicaa about memcpy/memmove/memset. The length argument can be used to
...
improve alias results if constant, and the source pointer can't be modified.
llvm-svn: 84175
2009-10-15 07:11:24 +00:00
Nick Lewycky
14a06f7051
Teach BasicAA to use the size parameter of the memory use marker intrinsics.
...
llvm-svn: 84174
2009-10-15 06:12:11 +00:00
Nick Lewycky
a12f6e8f78
Take advantage of TargetData when available; we know that the atomic intrinsics
...
only dereference the element they point to directly with no pointer arithmetic.
llvm-svn: 84159
2009-10-15 00:36:35 +00:00
Evan Cheng
37a7a18748
Clear VisitedPHIs after use.
...
llvm-svn: 84080
2009-10-14 06:46:26 +00:00
Evan Cheng
907fd9c3fb
Another BasicAA fix. If a value does not alias a GEP's base pointer, then it
...
cannot alias the GEP. GEP pointer alias rule states this clearly:
A pointer value formed from a getelementptr instruction is associated with the
addresses associated with the first operand of the getelementptr.
llvm-svn: 84079
2009-10-14 06:41:49 +00:00
Evan Cheng
c1056d9269
More code clean up based on patch feedback.
...
llvm-svn: 84074
2009-10-14 05:22:03 +00:00
Evan Cheng
efc0f806a4
Change VisitedPHIs into an instance variable that's freed by each alias() call.
...
llvm-svn: 84072
2009-10-14 05:05:02 +00:00
Evan Cheng
3130aba687
Teach basic AA about PHI nodes. If all operands of a phi NoAlias another value than it's safe to declare the PHI NoAlias the value. Ditto for MustAlias.
...
llvm-svn: 84038
2009-10-13 22:02:20 +00:00
Dan Gohman
c1e210fa10
Compute a full cost value even when a setjmp call is found.
...
llvm-svn: 84015
2009-10-13 20:10:10 +00:00
Dan Gohman
665e336185
Split code not specific to Function inlining out into a separate class,
...
named CodeMetrics. Move it to be a non-nested class. Rename RegionInfo
back to FunctionInfo.
llvm-svn: 84013
2009-10-13 19:58:07 +00:00
Benjamin Kramer
679377c816
Update the other CMake file.
...
llvm-svn: 84003
2009-10-13 18:50:54 +00:00
Evan Cheng
84c5224fa2
Refactor some code. No functionality changes.
...
llvm-svn: 84000
2009-10-13 18:42:04 +00:00
Dan Gohman
18cdd7ef1b
Move the InlineCost code from Transforms/Utils to Analysis.
...
llvm-svn: 83998
2009-10-13 18:30:07 +00:00
Devang Patel
ee9d2f0cc0
"there is not any instruction with attached debug info in this module" does not mean "there is no debug info in this module". :)
...
llvm-svn: 83984
2009-10-13 17:35:35 +00:00
Nick Lewycky
72f185f281
Teach BasicAA a little something about the atomic intrinsics: they can only
...
modify through the pointer they're given.
llvm-svn: 83959
2009-10-13 07:48:38 +00:00
Victor Hernandez
21280bc3af
Memory dependence analysis was incorrectly stopping to scan for stores to a pointer at bitcast uses of a malloc call.
...
It should continue scanning until the malloc call, and this patch fixes that.
llvm-svn: 83931
2009-10-13 01:42:53 +00:00
Dan Gohman
731afb3b6e
Revert r83606 and add comments explaining why it isn't safe.
...
llvm-svn: 83649
2009-10-09 16:35:06 +00:00
Dan Gohman
e81a040ce7
Preserve HasNSW and HasNUW when constructing SCEVs for Add and Mul
...
instructions.
llvm-svn: 83606
2009-10-09 00:41:22 +00:00
Dan Gohman
4cdd530887
Add the ability to track HasNSW and HasNUW on more kinds of SCEV expressions.
...
llvm-svn: 83601
2009-10-09 00:10:36 +00:00
Douglas Gregor
57f2c22857
Update CMake build yet again after a source file was removed
...
llvm-svn: 83575
2009-10-08 21:24:34 +00:00
Bill Wendling
d47d348cdf
It's possible for a global variable to be optimized out of a metadata object. So
...
we should allow a "null" with this dyn_cast.
llvm-svn: 83573
2009-10-08 20:52:51 +00:00
Chris Lattner
41b5fd5218
remove LoopVR pass. According to Nick:
...
"LoopVR's logic was copied into ScalarEvolution::getUnsignedRange and
::getSignedRange. Please delete LoopVR."
llvm-svn: 83531
2009-10-08 06:42:44 +00:00
Devang Patel
a7456a1335
Extract subprogram and compile unit information from the debug info attached to an instruction.
...
llvm-svn: 83491
2009-10-07 22:04:08 +00:00
Torok Edwin
6a66b4edd1
Add PR to this FIXME, looks like I didn't commit this change after all.
...
llvm-svn: 83457
2009-10-07 09:22:55 +00:00
Duncan Sands
2400ad7236
Introduce and use convenience methods for getting pointer types
...
where the element is of a basic builtin type. For example, to get
an i8* use getInt8PtrTy.
llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Evan Phoenix
1b803795c7
Extend ConstantFolding to understand signed overflow variants
...
llvm-svn: 83338
2009-10-05 22:53:52 +00:00
Torok Edwin
1a53fd9356
Don't treat malloc calls with non-matching prototype as malloc.
...
Fixes second part of PR5130, miscompilation in FreeBSD kernel, where malloc takes 3 params,
and *does* initialize memory.
llvm-svn: 83324
2009-10-05 21:15:43 +00:00
Dan Gohman
176e47a413
Remove an unnnecessary LLVMContext argument in
...
ConstantFoldLoadThroughGEPConstantExpr.
llvm-svn: 83311
2009-10-05 16:36:26 +00:00
Chris Lattner
7d19c8841c
teach the optimizer how to constant fold uadd/usub intrinsics.
...
llvm-svn: 83295
2009-10-05 05:26:04 +00:00
Chris Lattner
8b72a24a35
simplify this code a bunch.
...
llvm-svn: 83294
2009-10-05 05:06:24 +00:00
Chris Lattner
24a77e2ade
code simplifications.
...
llvm-svn: 83292
2009-10-05 05:00:35 +00:00
Mike Stump
532ed49e39
Expand api out in the usual inserter way, though, I do have a
...
question, can we get rid of the BasicBlock versions of all inserters
and use Head == 0 to indicate the old case when GetInsertBlock == 0?
llvm-svn: 83216
2009-10-01 22:08:58 +00:00
Devang Patel
4f1147e386
Add another MDNode into DebugLocTuple. This will be used to keep track of inlined functions.
...
llvm-svn: 83190
2009-10-01 01:15:28 +00:00
Devang Patel
cb516787d0
Add isFOO() helpers. Fix getDirectory() and getFilename() for DIScope.
...
llvm-svn: 83180
2009-09-30 22:34:41 +00:00
Mike Stump
a3bce35a07
Add a way for a frontend to generate more complex dwarf location
...
information. This allows arbitrary code involving DW_OP_plus_uconst
and DW_OP_deref. The scheme allows for easy extention to include,
any, or all of the DW_OP_ opcodes. I thought about just exposing all
of them, but, wasn't sure if people wanted the dwarf opcodes exposed
in the api. Is that a layering violation?
With this scheme, the entire existing block scheme used by llvm-gcc
can be switched over to the new scheme. I think that would be
cleaner, as then the compiler specific bits are not present in llvm
proper. Before the old code can be yanked however, similar code in
clang would have to be removed.
Next up, more testing.
llvm-svn: 83120
2009-09-30 00:08:22 +00:00
Devang Patel
e5be8e79df
Remove std::string uses from DebugInfo interface.
...
llvm-svn: 83083
2009-09-29 18:40:58 +00:00
Dan Gohman
c3081dd9eb
When extending the operands of an addrec, iterate through all
...
the operands, rather than trying to partition them into a start
and a step. This handles non-affine add recurrences correctly.
llvm-svn: 83011
2009-09-28 21:01:47 +00:00
Dan Gohman
bfa2d75c49
Create a README.txt for lib/Analysis, and add an entry.
...
llvm-svn: 83001
2009-09-28 18:38:53 +00:00
Dan Gohman
7a5cb984e6
Fix this debug output to handle the case where the loop has been deleted.
...
llvm-svn: 82994
2009-09-28 15:40:01 +00:00
Dan Gohman
aade5fefdb
Include the name of the loop header in debug messages.
...
llvm-svn: 82993
2009-09-28 15:07:18 +00:00
Dan Gohman
bd50ec69e4
Move the dominator verification code out of special code embedded within
...
the PassManager code into a regular verifyAnalysis method.
Also, reorganize loop verification. Make the LoopPass infrastructure
call verifyLoop as needed instead of having LoopInfo::verifyAnalysis
check every loop in the function after each looop pass. Add a new
command-line argument, -verify-loop-info, to enable the expensive
full checking.
llvm-svn: 82952
2009-09-28 00:27:48 +00:00
Dan Gohman
195c5bdf41
Move this assert to check the condition as soon as it is known.
...
llvm-svn: 82951
2009-09-28 00:10:28 +00:00
Dan Gohman
09f5f7f190
Extend the StartPassTimer and StopPassTimer functions so that the
...
code that stops the timer doesn't have to search to find the timer
object before it stops the timer. This avoids a lock acquisition
and a few other things done with the timer running.
llvm-svn: 82949
2009-09-28 00:07:05 +00:00
Dan Gohman
000a17774e
Fix an old copy+pasto.
...
llvm-svn: 82947
2009-09-27 23:52:07 +00:00
Dan Gohman
db89691ec4
Extract the code for inserting a loop into the loop queue into
...
a separate function.
llvm-svn: 82946
2009-09-27 23:49:43 +00:00
Dan Gohman
0ea6efde4e
When a loop is deleted, immediately release all of the active
...
LoopPasses for that loop. This avoids trouble with the PassManager
trying to call verifyAnalysis on them, and frees up some memory
sooner rather than later.
llvm-svn: 82945
2009-09-27 23:43:07 +00:00
Dan Gohman
2d607af763
Delete a bogus comment.
...
llvm-svn: 82908
2009-09-27 17:50:44 +00:00
Dan Gohman
8b4c141d97
Fix SCEVExpander's canonical addrec expansion code to work on loops that
...
aren't in canonical loop-simplify form, since it doesn't itself depend
on LoopSimplify. This means handling loops without preheaders and loops
with multiple backedges.
llvm-svn: 82905
2009-09-27 17:46:40 +00:00
Dan Gohman
16398e3bc0
Instead of testing whether an instruction dominates the loop preheader,
...
test whether it properly dominates the loop header. This is equivalent
when the loop has a preheader, and has the advantage of working when
the loop doesn't have a preheader. Since IVUsers doesn't Require
LoopSimplify, the loop isn't guaranteed to have a preheader.
llvm-svn: 82899
2009-09-27 15:30:00 +00:00
Dan Gohman
b84f5a3421
Add a properlyDominates member function to ScalarEvolution.
...
llvm-svn: 82898
2009-09-27 15:26:03 +00:00
Dan Gohman
9cc0852f45
Remove a redundant #include.
...
llvm-svn: 82897
2009-09-27 15:21:52 +00:00
Dan Gohman
60964df13d
Fix a case where ScalarEvolution was expanding pointer arithmetic
...
to inttoptr/ptrtoint unnecessarily.
llvm-svn: 82864
2009-09-26 16:11:57 +00:00
Dale Johannesen
53c365d807
Handle sqrt in CannotBeNegativeZero. absf and absl
...
appear to be misspellings, removed in favor of fabs*.
llvm-svn: 82796
2009-09-25 20:54:50 +00:00
Victor Hernandez
d2cc74eb2d
No need to verify that malloc's return type is i8*.
...
llvm-svn: 82561
2009-09-22 18:50:03 +00:00
Daniel Dunbar
14c9a4d355
Switch DIDescriptor to use a TrackingVH. - This makes it much safer to work with debug info, since it was extraordinarily easy to have dangling pointers thanks to MDNode uniquing.
...
llvm-svn: 82507
2009-09-22 02:03:18 +00:00
Chris Lattner
de39a12610
Revert r82404, it is causing a bootstrap miscompile. This is very very
...
scary, as it indicates a lurking bug. yay.
llvm-svn: 82411
2009-09-20 22:44:26 +00:00
Chris Lattner
a9a2b9a4cc
improve memdep to eliminate bitcasts (and aliases, and noop geps)
...
early for the stated reasons: this allows it to find more
equivalences and depend less on code layout.
llvm-svn: 82404
2009-09-20 21:00:18 +00:00
Daniel Dunbar
378331a13d
Tabs -> spaces, and remove trailing whitespace.
...
llvm-svn: 82355
2009-09-20 02:20:51 +00:00
Daniel Dunbar
39c0d90339
Strip trailing whitespace.
...
llvm-svn: 82332
2009-09-19 20:40:05 +00:00
Nick Lewycky
e539e55f2a
Add a comment explaining why you would ever want to do this.
...
llvm-svn: 82319
2009-09-19 19:00:06 +00:00
Nick Lewycky
441d1e8dd5
Lett users of sparse propagation do their own thing with phi nodes if they want
...
to. This can be combined with LCSSA or SSI form to store more information on a
PHINode than can be computed by looking at its incoming values.
llvm-svn: 82317
2009-09-19 18:33:36 +00:00
Duncan Sands
6f1a8215c0
The flag "--dot-cfg-only" is at the moment equivalent to the flag "--dot-cfg".
...
It prints the content of all bbs, instead of printing empty bbs to make the
CFG more readable. Fix this. Patch by Tobias Grosser.
llvm-svn: 82315
2009-09-19 11:25:44 +00:00
Victor Hernandez
66d4042178
Enhance analysis passes so that they apply the same analysis to malloc calls as to MallocInst.
...
Reviewed by Eli Friedman.
llvm-svn: 82281
2009-09-18 21:34:51 +00:00
Victor Hernandez
065bc44d01
Update malloc call creation code (AllocType is now the element type of the malloc, not the resulting type).
...
In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants.
Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array.
Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type.
Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls.
Add verification for malloc calls.
Reviewed by Dan Gohman.
llvm-svn: 82257
2009-09-18 19:20:02 +00:00
Nick Lewycky
9143d2c7a2
Add newlines.
...
llvm-svn: 82206
2009-09-18 07:36:47 +00:00
Dan Gohman
723717853b
Teach ScalarEvolution how to reason about no-wrap flags on loops
...
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.
llvm-svn: 82151
2009-09-17 18:05:20 +00:00
Devang Patel
371df479d4
Provide a way to extract location info from DILocation.
...
llvm-svn: 82064
2009-09-16 18:20:05 +00:00
Andreas Neustifter
15e9f61d26
Reapplied r81355 with the problems fixed.
...
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086737.html and
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086746.html )
llvm-svn: 82039
2009-09-16 11:35:50 +00:00
Chris Lattner
6302039748
simplify some code
...
llvm-svn: 81961
2009-09-16 00:08:07 +00:00
Dan Gohman
78b99e3761
Teach ValueTracking how to look through GlobalAliases. GlobalAliases are
...
not folded in the constant folder because the constant folder doesn't
simplify ConstantExpr operands.
llvm-svn: 81864
2009-09-15 16:14:44 +00:00
Chris Lattner
d219c7b6ee
add a new CallGraphNode::replaceCallEdge method and use it from
...
argpromote to avoid invalidating an iterator. This fixes PR4977.
All clang tests now pass with expensive checking (on my system
at least).
llvm-svn: 81843
2009-09-15 05:40:35 +00:00
Chris Lattner
50438771c0
make -debug-pass=Executions show information about what call graph nodes
...
are in the SCC for each execution of a CGSCC pass.
llvm-svn: 81838
2009-09-15 05:03:04 +00:00
Andreas Neustifter
13935bc5be
Bugfix. Sorry.
...
llvm-svn: 81517
2009-09-11 08:43:15 +00:00
Andreas Neustifter
9d49ec27fa
Make ProfileEstimator even more robust on general CFGs.
...
llvm-svn: 81516
2009-09-11 08:39:33 +00:00
Dan Gohman
aa66e3d968
Teach lib/VMCore/ConstantFold.cpp how to set the inbounds keyword and
...
how to fold notionally-out-of-bounds array getelementptr indices instead
of just doing these in lib/Analysis/ConstantFolding.cpp, because it can
be done in a fairly general way without TargetData, and because not all
constants are visited by lib/Analysis/ConstantFolding.cpp. This enables
more constant folding.
Also, set the "inbounds" flag when the getelementptr indices are
one-past-the-end.
llvm-svn: 81483
2009-09-11 00:04:14 +00:00