- Nov 21, 2010
-
-
Chris Lattner authored
allowing the memcpy to be eliminated. Unfortunately, the requirements on byval's without explicit alignment are really weak and impossible to predict in the mid-level optimizer, so this doesn't kick in much with current frontends. The fix is to change clang to set alignment on all byval arguments. llvm-svn: 119916
-
- Nov 20, 2010
-
-
Benjamin Kramer authored
llvm-svn: 119908
-
- Nov 19, 2010
-
-
Owen Anderson authored
llvm-svn: 119865
-
Owen Anderson authored
if all the operands of the PHI are equivalent. This allows CodeGenPrepare to undo unprofitable PRE transforms. llvm-svn: 119853
-
- Nov 18, 2010
-
-
Duncan Sands authored
preserves LCSSA form out of ScalarEvolution and into the LoopInfo class. Use it to check that SimplifyInstruction simplifications are not breaking LCSSA form. Fixes PR8622. llvm-svn: 119727
-
Owen Anderson authored
Completely rework the datastructure GVN uses to represent the value number to leader mapping. Previously, this was a tree of hashtables, and a query recursed into the table for the immediate dominator ad infinitum if the initial lookup failed. This led to really bad performance on tall, narrow CFGs. We can instead replace it with what is conceptually a multimap of value numbers to leaders (actually represented by a hashtable with a list of Value*'s as the value type), and then determine which leader from that set to use very cheaply thanks to the DFS numberings maintained by DominatorTree. Because there are typically few duplicates of a given value, this scan tends to be quite fast. Additionally, we use a custom linked list and BumpPtr allocation to avoid any unnecessary allocation in representing the value-side of the multimap. This change brings with it a 15% (!) improvement in the total running time of GVN on 403.gcc, which I think is pretty good considering that includes all the "real work" being done by MemDep as well. The one downside to this approach is that we can no longer use GVN to perform simple conditional progation, but that seems like an acceptable loss since we now have LVI and CorrelatedValuePropagation to pick up the slack. If you see conditional propagation that's not happening, please file bugs against LVI or CVP. llvm-svn: 119714
-
Chris Lattner authored
saying "it would be bad", give an example of what is going on. llvm-svn: 119695
-
Chris Lattner authored
refusing to optimize two memcpy's like this: copy A <- B copy C <- A if it couldn't prove that noalias(B,C). We can eliminate the copy by producing a memmove instead of memcpy. llvm-svn: 119694
-
Chris Lattner authored
source and dest are known to not overlap. llvm-svn: 119692
-
Chris Lattner authored
there is no need to check to see if the source and dest of a memcpy are noalias, behavior is undefined if not. llvm-svn: 119691
-
Chris Lattner authored
llvm-svn: 119690
-
Chris Lattner authored
out of processMemCpy into its own function. llvm-svn: 119687
-
Chris Lattner authored
if it is passed as a byval argument. The byval argument will just be a read, so it is safe to read from the original global instead. This allows us to promote away the %agg.tmp alloca in PR8582 llvm-svn: 119686
-
Chris Lattner authored
to ignore calls that obviously can't modify the alloca because they are readonly/readnone. llvm-svn: 119683
-
Chris Lattner authored
optimization. If the alloca that is "memcpy'd from constant" also has a memcpy from *it*, ignore it: it is a load. We now optimize the testcase to: define void @test2() { %B = alloca %T %a = bitcast %T* @G to i8* %b = bitcast %T* %B to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 124, i32 4, i1 false) call void @bar(i8* %b) ret void } previously we would generate: define void @test() { %B = alloca %T %b = bitcast %T* %B to i8* %G.0 = getelementptr inbounds %T* @G, i32 0, i32 0 %tmp3 = load i8* %G.0, align 4 %G.1 = getelementptr inbounds %T* @G, i32 0, i32 1 %G.15 = bitcast [123 x i8]* %G.1 to i8* %1 = bitcast [123 x i8]* %G.1 to i984* %srcval = load i984* %1, align 1 %B.0 = getelementptr inbounds %T* %B, i32 0, i32 0 store i8 %tmp3, i8* %B.0, align 4 %B.1 = getelementptr inbounds %T* %B, i32 0, i32 1 %B.12 = bitcast [123 x i8]* %B.1 to i8* %2 = bitcast [123 x i8]* %B.1 to i984* store i984 %srcval, i984* %2, align 1 call void @bar(i8* %b) ret void } llvm-svn: 119682
-
- Nov 17, 2010
-
-
Dan Gohman authored
llvm-svn: 119570
-
Dan Gohman authored
functions of ScalarEvolution, in preparation for memoization and other optimizations. llvm-svn: 119562
-
Dan Gohman authored
to avoid an unneeded dependence. llvm-svn: 119557
-
Benjamin Kramer authored
llvm-svn: 119538
-
Duncan Sands authored
instructions out of InstCombine and into InstructionSimplify. While there, introduce an m_AllOnes pattern to simplify matching with integers and vectors with all bits equal to one. llvm-svn: 119536
-
Duncan Sands authored
hasConstantValue. I was leery of using SimplifyInstruction while the IR was still in a half-baked state, which is the reason for delaying the simplification until the IR is fully cooked. llvm-svn: 119494
-
Duncan Sands authored
rather than hasConstantValue. llvm-svn: 119457
-
Duncan Sands authored
systematically, CollapsePhi will always return null here. Note that CollapsePhi did an extra check, isSafeReplacement, which the SimplifyInstruction logic does not do. I think that check was bogus - I guess we will soon find out! (It was originally added in commit 41998 without a testcase). llvm-svn: 119456
-
- Nov 16, 2010
-
-
Duncan Sands authored
rather than calling hasConstantValue. No intended functionality change. llvm-svn: 119352
-
- Nov 14, 2010
-
-
Duncan Sands authored
it to get better phi node simplification. llvm-svn: 119055
-
Duncan Sands authored
offload the work to hasConstantValue rather than do something more complicated (such handling mutually recursive phis) because (1) it is not clear it is worth it; and (2) if it is worth it, maybe such logic would be better placed in hasConstantValue. Adjust some GVN tests which are now cleaned up much further (eg: all phi nodes are removed). llvm-svn: 119043
-
- Nov 13, 2010
-
-
Duncan Sands authored
SimplifyAssociativeOrCommutative) "(A op C1) op C2" -> "A op (C1 op C2)", which previously was only done if C1 and C2 were constants, to occur whenever "C1 op C2" simplifies (a la InstructionSimplify). Since the simplifying operand combination can no longer be assumed to be the right-hand terms, consider all of the possible permutations. When compiling "gcc as one big file", transform 2 (i.e. using right-hand operands) fires about 4000 times but it has to be said that most of the time the simplifying operands are both constants. Transforms 3, 4 and 5 each fired once. Transform 6, which is an existing transform that I didn't change, never fired. With this change, the testcase is now optimized perfectly with one run of instcombine (previously it required instcombine + reassociate + instcombine, and it may just have been luck that this worked). llvm-svn: 119002
-
- Nov 12, 2010
-
-
Duncan Sands authored
"%z = %x and %y". If GVN can prove that %y equals %x, then it turns this into "%z = %x and %x". With the new code, %z will be replaced with %x everywhere (and then deleted). Previously %z would be value numbered too, which is a waste of time. Also, while a clever value numbering algorithm would give %z the same value number as %x, our current one doesn't do so (at least I don't think it does). The new logic has an essentially equivalent effect to what you would get if %z was given the same value number as %x, i.e. it should make value numbering smarter. While there, get hold of target data once at the start rather than a gazillion times all over the place. llvm-svn: 118923
-
Dan Gohman authored
one store dead. This is especially noticeable in SingleSource/Benchmarks/Shootout/objinst. llvm-svn: 118875
-
- Nov 11, 2010
-
-
Dan Gohman authored
and vaarg instructions. llvm-svn: 118845
-
Dan Gohman authored
testing for dereferenceable pointers into a helper function, isDereferenceablePointer. Teach it how to reason about GEPs with simple non-zero indices. Also eliminate ArgumentPromtion's IsAlwaysValidPointer, which didn't check for weak externals or out of range gep indices. llvm-svn: 118840
-
Dan Gohman authored
llvm-svn: 118804
-
Dan Gohman authored
llvm-svn: 118788
-
Dan Gohman authored
execute. Make Sink's predicate more precise. llvm-svn: 118787
-
- Nov 10, 2010
-
-
Dan Gohman authored
references. For example, this allows gvn to eliminate the load in this example: void foo(int n, int* p, int *q) { p[0] = 0; p[1] = 1; if (n) { *q = p[0]; } } llvm-svn: 118714
-
Dan Gohman authored
instructions instead of hard-coding operand numbers. llvm-svn: 118698
-
Dan Gohman authored
it, and to be consistent. llvm-svn: 118692
-
Dan Gohman authored
arbitrary memory into a helper function, and adjust some comments. llvm-svn: 118687
-
Dale Johannesen authored
order to reduce ((x<<30)>>24) to x<<6, check the correct bits. PR 8547. llvm-svn: 118665
-
Dan Gohman authored
chaining and simplify FunctionAttrs' GetModRefBehavior logic. llvm-svn: 118660
-