Commit Graph

4329 Commits

Author SHA1 Message Date
Devang Patel
d82e9e7d93 Remove LoopIndexSplit pass. It is neither maintained nor used by anyone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116004 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 23:29:37 +00:00
Owen Anderson
ce665bd2e2 Now with fewer extraneous semicolons!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 22:25:06 +00:00
Owen Anderson
1a3d233621 Next step on the getting-rid-of-static-ctors train: begin adding per-library
initialization functions that initialize the set of passes implemented in
that library.  Add C bindings for these functions as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 17:55:47 +00:00
Owen Anderson
7267e14327 Now that the profitable bits of EnableFullLoadPRE have been enabled by default, rip out the remainder.
Anyone interested in more general PRE would be better served by implementing it separately, to get real
anticipation calculation, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115337 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 20:02:55 +00:00
Eric Christopher
04fcbf954f Fix the other half of the alignment changing issue by making sure that the
memcpy alignment is the minimum of the incoming alignments.

Fixes PR 8266.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115305 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 09:02:05 +00:00
Dale Johannesen
0488fb649a Massive rewrite of MMX:
The x86_mmx type is used for MMX intrinsics, parameters and
return values where these use MMX registers, and is also
supported in load, store, and bitcast.

Only the above operations generate MMX instructions, and optimizations
do not operate on or produce MMX intrinsics. 

MMX-sized vectors <2 x i32> etc. are lowered to XMM or split into
smaller pieces.  Optimizations may occur on these forms and the
result casted back to x86_mmx, provided the result feeds into a
previous existing x86_mmx operation.

The point of all this is prevent optimizations from introducing
MMX operations, which is unsafe due to the EMMS problem.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115243 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 23:57:10 +00:00
Owen Anderson
722cc1f414 We do want to allow LoadPRE to perform LICM-like transformations: we already consider PHI nodes to be negligible for
code size (making this transform code size neutral), and it allows us to hoist values out of loops, which is always
a good thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 20:53:04 +00:00
Jakob Stoklund Olesen
7eb589d3f9 Try again to disable critical edge splitting in CodeGenPrepare.
The bug that broke i386 linux has been fixed in r115191.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115204 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 20:51:52 +00:00
Benjamin Kramer
4c75679b1c Tighten up prototype verification of strchr and strrchr to avoid a crash in the very unlikely case that someone passes an integer > i64 to strchr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 11:21:59 +00:00
Benjamin Kramer
9510a2538b Add constant folding for strspn and strcspn to SimplifyLibCalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 00:58:35 +00:00
Benjamin Kramer
05f585e28b Add strpbrk folding to SimplifyLibCalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115111 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 23:52:12 +00:00
Benjamin Kramer
e260990fa1 Simplify the loop in StrChrOptimizer. FileCheckize test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115095 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 22:29:12 +00:00
Benjamin Kramer
06f25cfb33 Teach SimplifyLibCalls how to optimize strrchr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 21:50:51 +00:00
Owen Anderson
36c4debc94 Fix PR8247: JumpThreading can cause a block to become unreachable while still having predecessor, if it is part of a self-loop.
Because of this, we cannot use the Simplify* APIs, as they can assert-fail on unreachable code.  Since it's not easy to determine
if a given threading will cause a block to become unreachable, simply defer simplifying simplification to later InstCombine and/or
DCE passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 20:34:41 +00:00
Owen Anderson
69daca59ff Revert r114919, which caused some serious regressions on ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115053 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 18:05:19 +00:00
Oscar Fuentes
3609eb0de2 Removed a bunch of unnecessary target_link_libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-28 22:39:14 +00:00
Owen Anderson
8d9e92ce2d Weight loop unrolling counts by nesting depth. Unrolling deeply nested loops tends to cause high
register pressure and thus excess spills, which we don't currently recover from well.  This should
be re-evaluated in the future if our ability to generate good spills/splits improves.

Partial fix for <rdar://problem/7635585>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114919 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 22:58:54 +00:00
Jakob Stoklund Olesen
08342f2d11 Revert "Disable codegen prepare critical edge splitting. Machine instruction passes now"
This reverts revision 114633. It was breaking llvm-gcc-i386-linux-selfhost.

It seems there is a downstream bug that is exposed by
-cgp-critical-edge-splitting=0. When that bug is fixed, this patch can go back
in.

Note that the changes to tailcallfp2.ll are not reverted. They were good are
required.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114859 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 18:43:48 +00:00
Dan Gohman
51138b3070 Delete an unused function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114841 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 16:58:21 +00:00
Owen Anderson
b0ba0f4170 LoadPRE was not properly checking that the load it was PRE'ing post-dominated the block it was being hoisted to.
Splitting critical edges at the merge point only addressed part of the issue; it is also possible for non-post-domination
to occur when the path from the load to the merge has branches in it.  Unfortunately, full anticipation analysis is
time-consuming, so for now approximate it.  This is strictly more conservative than real anticipation, so we will miss
some cases that real PRE would allow, but we also no longer insert loads into paths where they didn't exist before. :-)

This is a very slight net positive on SPEC for me (0.5% on average).  Most of the benchmarks are largely unaffected, but
when it pays off it pays off decently: 181.mcf improves by 4.5% on my machine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-25 05:26:18 +00:00
Eric Christopher
c69a000470 If we're changing the source of a memcpy we need to use the alignment
of the source, not the original alignment since it may no longer
be valid.

Fixes rdar://8400094


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-25 00:57:26 +00:00
Evan Cheng
dd3a41a6b3 Disable codegen prepare critical edge splitting. Machine instruction passes now
break critical edges on demand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23 06:55:34 +00:00
Bob Wilson
ec57a1acec When moving zext/sext to be folded with a load, ignore the issue of whether
truncates are free only in the case where the extended type is legal but the
load type is not.  If both types are illegal, such as when they are too big,
the load may not be legalized into an extended load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114568 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-22 18:44:56 +00:00
Bob Wilson
71dc4d96ed Move a sign-extend or a zero-extend of a load to the same basic block as the
load when the type of the load is not legal, even if truncates are not free.
The load is going to be legalized to an extending load anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114488 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 21:54:27 +00:00
Bob Wilson
9120f5c35b Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114487 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 21:44:14 +00:00
Gabor Greif
f097b59e0e do not rely on the implicit-dereference semantics of dyn_cast_or_null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-18 11:55:34 +00:00
Gabor Greif
ea4894a7fc do not rely on the implicit-dereference semantics of dyn_cast_or_null
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114277 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-18 11:53:39 +00:00
Owen Anderson
ceb9a95957 Use a depth-first iteratation in CorrelatedValuePropagation to avoid wasting time trying
to optimize unreachable blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114105 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 18:35:07 +00:00
Dale Johannesen
677c6ecd08 When substituting sunkaddrs into indirect arguments an asm, we were
walking the asm arguments once and stashing their Values.  This is
wrong because the same memory location can be in the list twice, and
if the first one has a sunkaddr substituted, the stashed value for the
second one will be wrong (use-after-free).  PR 8154.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114104 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 18:30:55 +00:00
Owen Anderson
c809d90bca Remove the option to disable LazyValueInfo in JumpThreading, as it is now
on by default and has received significant testing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113852 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 20:57:41 +00:00
Chris Lattner
7abdb22e52 fix PR8102, a case where we'd copyValue from a value that we already
deleted.  Fix this by doing the copyValue's before we delete stuff!

The testcase only repros the problem on my system with valgrind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 00:19:00 +00:00
Michael J. Spencer
3a210e2d30 Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632

Conflicts:

	cmake/modules/AddLLVM.cmake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 23:59:48 +00:00
Eric Christopher
330444e52b Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113769 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 18:27:59 +00:00
John Thompson
eac6e1d0c7 Added skeleton for inline asm multiple alternative constraint support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113766 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 18:15:37 +00:00
Gabor Greif
e2d50046fd typoes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113647 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 22:25:58 +00:00
Michael J. Spencer
4e9c939312 CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113632 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:14:25 +00:00
Owen Anderson
8ea298a4e3 Lower the unrolling theshold to 150. Empirical tests indicate that this is a sweet spot in the performance per
code size increase curve.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113595 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 17:57:00 +00:00
Owen Anderson
f9a26b89f8 What the loop unroller cares about, rather than just not unrolling loops with calls, is
not unrolling loops that contain calls that would be better off getting inlined.  This mostly
comes up when an interleaved devirtualization pass has devirtualized a call which the inliner
will inline on a future pass.  Thus, rather than blocking all loops containing calls, add
a metric for "inline candidate calls" and block loops containing those instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113535 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 20:32:23 +00:00
Owen Anderson
547462b98c Revert r113439, which relaxed the requirement that loops containing calls cannot be unrolled. After some discussion,
there seems to be a better way to achieve the same effect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113528 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 20:02:23 +00:00
Owen Anderson
cc443c37ee r113526 introduced an unintended change to the loop unrolling threshold. Revert it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 19:11:57 +00:00
Owen Anderson
20672e48b3 Fix typo in code to cap the loop code size reduction calculation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113526 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 19:08:59 +00:00
Owen Anderson
6add2fbb69 Use code-size reduction metrics to estimate the amount of savings we'll get when we unroll a loop.
Next step is to recalculate the threshold values given this new heuristic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113525 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 19:07:31 +00:00
Owen Anderson
4975447d94 Relax the "don't unroll loops containing calls" rule. Instead, when a loop contains a call, lower the
unrolling threshold to the optimize-for-size threshold.  Basically, for loops containing calls, unrolling
can still be profitable as long as the loop is REALLY small.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 23:10:07 +00:00
Owen Anderson
e9f1882406 Add a separate unrolling threshold when the current function is being optimized for size.
The threshold value of 50 is arbitrary, and I chose it simply by analogy to the inlining thresholds, where
the baseline unrolling threshold is slightly smaller than the baseline inlining threshold.  This could
undoubtedly use some tuning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113306 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 23:15:30 +00:00
Chris Lattner
0cccd7633e fix PR8067, an over-aggressive assertion in LICM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 05:11:24 +00:00
Chris Lattner
50fb46983c Teach loop rotate to hoist trivially invariant instructions
in the duplicated block instead of duplicating them.  

Duplicating them into the end of the loop and the preheader 
means that we got a phi node in the header of the loop, 
which prevented LICM from hoisting them.  GVN would
usually come around later and merge the duplicated 
instructions so we'd get reasonable output... except that
anything dependent on the shoulda-been-hoisted value can't
be hoisted.  In PR5319 (which this fixes), a memory value
didn't get promoted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 01:10:22 +00:00
Chris Lattner
adc799112d pull a simple method out of LICM into a new
Loop::hasLoopInvariantOperands method. Remove
a useless and confusing Loop::isLoopInvariant(Instruction)
method, which didn't do what you thought it did.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 01:05:37 +00:00
Chris Lattner
3ae0924d6b more cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113115 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 20:13:07 +00:00
Chris Lattner
bdabacdcca Change lower atomic pass to use IntrinsicInst to simplify it a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 20:10:47 +00:00
Chris Lattner
906a675db8 eliminate some non-obvious casts. UndefValue isa Constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 20:03:09 +00:00