Commit Graph

6936 Commits

Author SHA1 Message Date
Nate Begeman
ec8eee2d3a Fix infinite recursion in the C++ code which handles movddup by making it unnecessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70425 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 22:47:44 +00:00
Dan Gohman
ac70ceafbc Generalize the cast-of-addrec folding to handle folding of SCEVs like
(sext i8 {-128,+,1} to i64) to i64 {-128,+,1}, where the iteration
crosses from negative to positive, but is still safe if the trip
count is within range.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 22:28:28 +00:00
Dan Gohman
3e0e31b261 Fix this test to match the new output from scalar-evolution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 21:06:20 +00:00
Dan Gohman
36b8e53fe0 Include the source type in SCEV cast expression debug output, and
print sext, zext, and trunc, instead of signextend, zeroextend,
and truncate, respectively, for consistency with the main IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 20:27:52 +00:00
Dale Johannesen
c9cf35055f Fix recent regression in gcc.dg/pr26719.c (6835035).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 16:38:47 +00:00
Evan Cheng
96f3fd9a7f spillPhysRegAroundRegDefsUses() may have invalidated iterators stored in fixed_ IntervalPtrs. Reset them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70378 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 07:16:34 +00:00
Chris Lattner
3a33f4903a testcase for PR4082
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 06:46:27 +00:00
Chris Lattner
672452d5a0 Disable the load-shrinking optimization from looking at
anything larger than 64-bits, avoiding a crash.  This should
really be fixed to use APInts, though type legalization happens
to help us out and we get good code on the attached testcase at
least.

This fixes rdar://6836460


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 03:45:07 +00:00
Bill Wendling
be8cc2a3de Second attempt:
Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'll change the JIT with a follow-up patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:15:41 +00:00
Dan Gohman
ce66c6114f As with r70333, give the primary induction variable a use so
that it can't be trivially eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 22:05:13 +00:00
Dan Gohman
cab9cf01ce Make this testcase slightly less trivial, so that it doesn't fail
if indvars happens to optimize away the unused primary induction
variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 22:03:26 +00:00
Dan Gohman
87d2fe5143 Fix a grammaro in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 21:54:23 +00:00
Anton Korobeynikov
573c92d8ba Properly print 'P' modifier on inline asm memory operands.
This should fix PR3379 and PR4064.
Patch inspired by Edwin Török!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 21:49:33 +00:00
Dale Johannesen
85f74f817a Test for llvm-gcc bug fixed by 70301.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70302 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 17:16:30 +00:00
Evan Cheng
30590f5023 Fix PR4034. Bug in LiveInterval::join when it's compacting new valno's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70291 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 06:24:09 +00:00
Evan Cheng
e9ccb3a7d4 Fix for PR4051. When 2address pass delete an instruction, update kill info when necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 02:12:36 +00:00
Bill Wendling
c69d56f115 r70270 isn't ready yet. Back this out. Sorry for the noise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 01:04:53 +00:00
Bill Wendling
2e9d5f912a Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'm not 100% sure if it's necessary to change it there...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70270 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 00:21:31 +00:00
Dale Johannesen
617d108a63 Fix PR 4086, a bug in FP IV elimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 21:03:15 +00:00
Evan Cheng
c45288e06b Fix PR4076. Correctly create live interval of physical register with two-address update.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:42:46 +00:00
Dan Gohman
c7749b747e Permit ChangeCompareStride to rewrite a comparison when the factor
between the comparison's iv stride and the candidate stride is
exactly -1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:35:32 +00:00
Dan Gohman
01ecca20bf Teach getZeroExtendExpr and getSignExtendExpr to use trip-count
information to simplify [sz]ext({a,+,b}) to {zext(a),+,[zs]ext(b)},
as appropriate.

These functions and the trip count code each call into the other, so
this requires careful handling to avoid infinite recursion. During
the initial trip count computation, conservative SCEVs are used,
which are subsequently discarded once the trip count is actually
known.

Among other benefits, this change lets LSR automatically eliminate
some unnecessary zext-inreg and sext-inreg operation where the
operand is an induction variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:16:15 +00:00
Dale Johannesen
48c255d7f8 Test for (llvm-gcc) 70231.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 19:15:09 +00:00
Nate Begeman
5f96943e01 Revert accidental testcase reduction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:42:40 +00:00
Nate Begeman
9008ca6b6b 2nd attempt, fixing SSE4.1 issues and implementing feedback from duncan.
PR2957

ISD::VECTOR_SHUFFLE now stores an array of integers representing the shuffle
mask internal to the node, rather than taking a BUILD_VECTOR of ConstantSDNodes
as the shuffle mask.  A value of -1 represents UNDEF.

In addition to eliminating the creation of illegal BUILD_VECTORS just to 
represent shuffle masks, we are better about canonicalizing the shuffle mask,
resulting in substantially better code for some classes of shuffles.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:41:29 +00:00
Evan Cheng
d521bc983b Fix PR4056. It's possible a physical register def is dead if its implicit use is deleted by two-address pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 17:36:47 +00:00
Dan Gohman
f45728dae3 Fix the syntax for a PR number in a test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 15:08:34 +00:00
Dan Gohman
fa6c716842 Make this test slightly more strict.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 03:05:26 +00:00
Dan Gohman
c7b3444095 When transforming sext(trunc(load(x))) into sext(smaller load(x)),
the trunc is directly replaced with the smaller load, so don't
try to create a new sext node. This fixes PR4050.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 02:00:55 +00:00
Dan Gohman
d6c329532b Handle ands with ~0 correctly too. This fixes PR4052.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 01:41:10 +00:00
Sanjiv Gupta
9341c808ae Any size of integral indices are allowed in gep for indexing into sequential types. Also adding a test case to check the indices type allowed into struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 17:14:35 +00:00
Chris Lattner
b5fbb06e32 add testcase for strange types of gep indices
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 22:20:49 +00:00
Chris Lattner
040f758e3a testcase and asmparser fix for PR4066
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70080 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 21:26:00 +00:00
Dan Gohman
1c8491ecc7 Add several more icmp simplifications. Transform signed comparisons
into unsigned ones when the operands are known to have the same
sign bit value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70053 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 17:12:48 +00:00
Dan Gohman
2c73d5fb9e Handle ands with 0 and shifts by 0 correctly. These aren't
common, but indvars shouldn't crash on them. This fixes PR4054.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70051 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 17:05:40 +00:00
Torok Edwin
4cdc44c82c Fix g++-4.4.0 warning, it was causing llvm-nm to fail on wrapped BC files:
Path.cpp:59: warning: case label value exceeds maximum value for type
magic[0] is a (signed) char, but some case values are unsigned (e.g. 0xde).
When magic[0] was 0xde, the switch has taken the default branch instead of case
0xde branch.
Apparently this was the behaviour with older versions of gcc too, but not with g++.
Now g++-4.4 behaves as gcc, and ignores unsigned case values out of range signed
range.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 10:25:12 +00:00
Evan Cheng
0adb527d16 Do not share a single unknown val# for all the live ranges merged into a physical sub-register live interval. When coalescer is merging in clobbered virtaul register live interval into a physical register live interval, give each virtual register val# a separate val# in the physical register live interval. Otherwise, the coalescer would have lost track of the definitions information it needs to make correct coalescing decisions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 09:25:19 +00:00
Dale Johannesen
2f91f30b93 Fix PR 4057, a crash doing float->char const folding.
This particular one is undefined behavior (although this
isn't related to the crash), so it will no longer do it
at compile time, which seems better.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 21:34:13 +00:00
David Greene
d34a73b3b7 Fix multiclass inheritance to limit value resolution to new defs added
by base multiclasses.  Do not attempt to alter defs from previous base
multiclasses.  This fixes multiple multiclass inheritance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 16:55:41 +00:00
Rafael Espindola
15f1b66d64 Fix PR 4004 by including the call to __tls_get_addr in X86tlsaddr. This is not
very elegant, but neither is the tls specification :-(



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69968 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 12:59:40 +00:00
Rafael Espindola
15684b2955 Revert 69952. Causes testsuite failures on linux x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 12:40:33 +00:00
Nate Begeman
b706d29f9c PR2957
ISD::VECTOR_SHUFFLE now stores an array of integers representing the shuffle
mask internal to the node, rather than taking a BUILD_VECTOR of ConstantSDNodes
as the shuffle mask.  A value of -1 represents UNDEF.

In addition to eliminating the creation of illegal BUILD_VECTORS just to 
represent shuffle masks, we are better about canonicalizing the shuffle mask,
resulting in substantially better code for some classes of shuffles.

A clean up of x86 shuffle code, and some canonicalizing in DAGCombiner is next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 03:42:54 +00:00
David Greene
e8cf21e8e3 Make BinOps typed and require a type specifier for !nameconcat. This
allows binops to be used in typed contexts such as when passing
arguments to classes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 21:25:15 +00:00
Dan Gohman
e41bc94bb1 Explicitly pass -tailcallopt=false to these tests so that they
work as intended no matter what the default setting of that
option is.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 19:39:41 +00:00
Dale Johannesen
4aa397c5bf Testcase for 69795.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 18:04:04 +00:00
Dan Gohman
e22d503ee5 Fix an error in this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 15:22:28 +00:00
Dan Gohman
752ec7da50 Change SCEVExpander's expandCodeFor to provide more flexibility
with the persistent insertion point, and change IndVars to make
use of it. This fixes a bug where IndVars was holding on to a
stale insertion point and forcing the SCEVExpander to continue to
use it.

This fixes PR4038.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 15:16:49 +00:00
Nick Lewycky
5cd28fad15 Simplify trunc(extend(x)) in SCEVs, just for completeness. Also fix some odd
whitespace in the same file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69870 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 05:15:08 +00:00
Owen Anderson
03dac74d40 Testcase for PR3909.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 04:33:42 +00:00
Owen Anderson
887fde88ca Testcase for PR2639.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 04:30:52 +00:00
Owen Anderson
d92395fe92 Testcase for PR2537.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 04:26:42 +00:00
Owen Anderson
f2a5c0a04c Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 04:24:19 +00:00
Owen Anderson
176aeb1afa Testcase for PR3085.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 04:21:14 +00:00
Owen Anderson
d49468aa50 Add testcase from PR3086.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 04:14:03 +00:00
Dan Gohman
ab192b71a6 Add more ulimit limits, to catch more kinds of runaway behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 00:28:31 +00:00
Evan Cheng
9c15949967 Make sure both operands have binary instructions have the same type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 23:39:28 +00:00
Evan Cheng
1abe64663e Avoid deferencing use_begin() if value does not have a use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 22:45:37 +00:00
David Greene
5654613a01 Allow defm to inherit from multiple multiclasses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69832 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 22:17:51 +00:00
David Greene
c7cafcd815 Implement !nameconcat to concatenate strings and look up the resulting
name in the symbol table, returning an object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69822 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 20:18:10 +00:00
Duncan Sands
d7b2f7ffce Testcase for PR2958.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 18:55:17 +00:00
David Greene
de444af6bb Implement multiclass inheritance.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 16:42:54 +00:00
Dan Gohman
aabb04f527 SCEVExpander's InsertCastOfTo knows how to move existing cast
instructions in order to avoid inserting new ones. However, if
the cast instruction is the SCEVExpander's InsertPt, this
causes subsequently emitted instructions to be inserted near
the cast, and not at the location of the original insert point.
Fix this by adjusting the insert point in such cases.
This fixes PR4009.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 16:11:16 +00:00
Duncan Sands
4a0adb7686 These tests are x86 specific.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 10:39:51 +00:00
Evan Cheng
5b69ebac85 It has finally happened. Spiller is now using live interval info.
This fixes a very subtle bug. vr defined by an implicit_def is allowed overlap with any register since it doesn't actually modify anything. However, if it's used as a two-address use, its live range can be extended and it can be spilled. The spiller must take care not to emit a reload for the vn number that's defined by the implicit_def. This is both a correctness and performance issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 22:46:52 +00:00
Dan Gohman
578ccf81e5 When turning (ashr(shl(x, n), n)) into sext(trunc(x)), the width of the
type to truncate to should be the number of bits of the value that are
preserved, not the number that are clobbered with sign-extension.
This fixes regressions in ldecod.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 20:18:36 +00:00
Devang Patel
1d85a1f00b Test case for revision 69683.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69684 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 17:21:01 +00:00
Chris Lattner
33e24adc3b fix a crash on a pointless but valid zero-length memset, rdar://6808691
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 16:52:12 +00:00
Evan Cheng
206d1856ad Added a linearscan register allocation optimization. When the register allocator spill an interval with multiple uses in the same basic block, it creates a different virtual register for each of the reloads. e.g.
%reg1498<def> = MOV32rm %reg1024, 1, %reg0, 12, %reg0, Mem:LD(4,4) [sunkaddr39 + 0]
        %reg1506<def> = MOV32rm %reg1024, 1, %reg0, 8, %reg0, Mem:LD(4,4) [sunkaddr42 + 0]
        %reg1486<def> = MOV32rr %reg1506
        %reg1486<def> = XOR32rr %reg1486, %reg1498, %EFLAGS<imp-def,dead>
        %reg1510<def> = MOV32rm %reg1024, 1, %reg0, 4, %reg0, Mem:LD(4,4) [sunkaddr45 + 0]

=>

        %reg1498<def> = MOV32rm %reg2036, 1, %reg0, 12, %reg0, Mem:LD(4,4) [sunkaddr39 + 0]
        %reg1506<def> = MOV32rm %reg2037, 1, %reg0, 8, %reg0, Mem:LD(4,4) [sunkaddr42 + 0]
        %reg1486<def> = MOV32rr %reg1506
        %reg1486<def> = XOR32rr %reg1486, %reg1498, %EFLAGS<imp-def,dead>
        %reg1510<def> = MOV32rm %reg2038, 1, %reg0, 4, %reg0, Mem:LD(4,4) [sunkaddr45 + 0]

From linearscan's point of view, each of reg2036, 2037, and 2038 are separate registers, each is "killed" after a single use. The reloaded register is available and it's often clobbered right away. e.g. In thise case reg1498 is allocated EAX while reg2036 is allocated RAX. This means we end up with multiple reloads from the same stack slot in the same basic block.

Now linearscan recognize there are other reloads from same SS in the same BB. So it'll "downgrade" RAX (and its aliases) after reg2036 is allocated until the next reload (reg2037) is done. This greatly increase the likihood reloads from SS are reused.

This speeds up sha1 from OpenSSL by 5.8%. It is also an across the board win for SPEC2000 and 2006.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 08:01:12 +00:00
Chris Lattner
9dcab2fe8e testcase for PR3898
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 20:49:22 +00:00
Duncan Sands
b10b5ac8d9 Don't try to make BUILD_VECTOR operands have the same
type as the vector element type: allow them to be of
a wider integer type than the element type all the way
through the system, and not just as far as LegalizeDAG.
This should be safe because it used to be this way
(the old type legalizer would produce such nodes), so
backends should be able to handle it.  In fact only
targets which have legal vector types with an illegal
promoted element type will ever see this (eg: <4 x i16>
on ppc).  This fixes a regression with the new type
legalizer (vec_splat.ll).  Also, treat SCALAR_TO_VECTOR
the same as BUILD_VECTOR.  After all, it is just a
special case of BUILD_VECTOR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 20:16:54 +00:00
Dale Johannesen
2cf68d4d23 Adjust XFAIL syntax, maybe that will help. The other
way worked for me...



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 02:01:23 +00:00
Dale Johannesen
f4948450d1 patch 69408 breaks this by removing the opportunity
for the optimization it's testing to kick in (although
it improves the code, getting rid of all spills).
I don't understand the optimization well enough to
rescue the test, so XFAILing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 00:11:50 +00:00
Bob Wilson
7eb793dd09 Rename file to have the correct suffix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69380 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 20:40:20 +00:00
Bob Wilson
1f595bb429 Use CallConvLower.h and TableGen descriptions of the calling conventions
for ARM.  Patch by Sandeep Patel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69371 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 19:07:39 +00:00
Rafael Espindola
2ee3db3003 For general dynamic TLS access we must use
leaq	foo@TLSGD(%rip), %rdi

as part of the instruction sequence. Using a register other than %rdi and then
copying it to %rdi is not valid.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 14:35:58 +00:00
Evan Cheng
276b77e66c Teach spiller to unfold instructions which modref spill slot when a scratch
register is available and when it's profitable.

e.g.
     xorq  %r12<kill>, %r13
     addq  %rax, -184(%rbp)
     addq  %r13, -184(%rbp)
==>
     xorq  %r12<kill>, %r13
     movq  -184(%rbp), %r12
     addq  %rax, %r12
     addq  %r13, %r12
     movq  %r12, -184(%rbp)

Two more instructions, but fewer memory accesses. It can also open up
opportunities for more optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69341 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 01:29:40 +00:00
Rafael Espindola
7c36683fa3 fix PR3995. A scale must be 1, 2, 4 or 8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 12:34:53 +00:00
Dan Gohman
2d1be87ee4 Expand GEPs in ScalarEvolution expressions. SCEV expressions can now
have pointer types, though in contrast to C pointer types, SCEV
addition is never implicitly scaled. This not only eliminates the
need for special code like IndVars' EliminatePointerRecurrence
and LSR's own GEP expansion code, it also does a better job because
it lets the normal optimizations handle pointer expressions just
like integer expressions.

Also, since LLVM IR GEPs can't directly index into multi-dimensional
VLAs, moving the GEP analysis out of client code and into the SCEV
framework makes it easier for clients to handle multi-dimensional
VLAs the same way as other arrays.

Some existing regression tests show improved optimization.
test/CodeGen/ARM/2007-03-13-InstrSched.ll in particular improved to
the point where if-conversion started kicking in; I turned it off
for this test to preserve the intent of the test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 03:18:22 +00:00
Dale Johannesen
764eccf025 Another testcase for IV shortening.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 00:45:21 +00:00
Bill Wendling
dd9f523997 Check for alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 04:51:05 +00:00
Dale Johannesen
dd1f9e4bf6 Enhance induction variable code to remove the
sext around sext(shorter IV + constant), using a
longer IV instead, when it can figure out the
add can't overflow.  This comes up a lot in
subscripting; mainly affects 64 bit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69123 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 01:10:12 +00:00
Devang Patel
517576d6f9 While inlining, clone llvm.dbg.func.start intrinsic and adjust
llvm.dbg.region.end instrinsic. This nested llvm.dbg.func.start/llvm.dbg.region.end pair now enables DW_TAG_inlined_subroutine support in code generator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 00:17:06 +00:00
Bill Wendling
1759f5e3bf Testcase for r69104.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 00:04:11 +00:00
Evan Cheng
df2f1189a3 Optimize conditional branch on i1 phis with non-constant inputs.
This turns:

eq:
        %3 = icmp eq i32 %1, %2
        br label %join

ne:
        %4 = icmp ne i32 %1, %2
        br label %join

join:
        %5 = phi i1 [%3, %eq], [%4, %ne]
        br i1 %5, label %yes, label %no

=>

eq:
        %3 = icmp eq i32 %1, %2
        br i1 %3, label %yes, label %no

ne:
        %4 = icmp ne i32 %1, %2
        br i1 %4, label %yes, label %no


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 23:40:03 +00:00
Dan Gohman
5b9c31841f Fix the RUN lines so that this test actually tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 22:50:17 +00:00
Dan Gohman
62ad138d70 For the h-register addressing-mode trick, use the correct value for
any non-address uses of the address value. This fixes 186.crafty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 22:45:05 +00:00
Dan Gohman
5ec3b427c8 When the result of an EXTRACT_SUBREG, INSERT_SUBREG, or SUBREG_TO_REG
operator is used by a CopyToReg to export the value to a different
block, don't reuse the CopyToReg's register for the subreg operation
result if the register isn't precisely the right class for the
subreg operation.

Also, rename the h-registers.ll test, now that there are more
than one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 22:17:14 +00:00
Evan Cheng
b3f5bfe37f Some of GR8_NOREX registers are only available in 64-bit mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69049 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 16:57:43 +00:00
Dale Johannesen
442b7bfc80 Use the output of the asm so the optimizer won't
delete it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 01:51:40 +00:00
Evan Cheng
87d696a4d2 Fix PR3934 part 2. findOnlyInterestingUse() was not setting IsCopy and IsDstPhys which are returned by value and used by callee. This happened to work on the earlier test cases because of a logic error in the caller side.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 00:32:25 +00:00
Evan Cheng
3005ed6048 PR3934: Fix a bogus two-address pass assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 20:04:24 +00:00
Dan Gohman
21e3dfbc86 Implement x86 h-register extract support.
- Add patterns for h-register extract, which avoids a shift and mask,
   and in some cases a temporary register.
 - Add address-mode matching for turning (X>>(8-n))&(255<<n), where
   n is a valid address-mode scale value, into an h-register extract
   and a scaled-offset address.
 - Replace X86's MOV32to32_ and related instructions with the new
   target-independent COPY_TO_SUBREG instruction.

On x86-64 there are complicated constraints on h registers, and
CodeGen doesn't currently provide a high-level way to express all of them,
so they are handled with a bunch of special code. This code currently only
supports extracts where the result is used by a zero-extend or a store,
though these are fairly common.

These transformations are not always beneficial; since there are only
4 h registers, they sometimes require extra move instructions, and
this sometimes increases register pressure because it can force out
values that would otherwise be in one of those registers. However,
this appears to be relatively uncommon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 16:09:41 +00:00
Rafael Espindola
7ff5bff45e X86-64 TLS support for local exec and initial exec.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 13:02:49 +00:00
Chris Lattner
266c7bbbbc Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 05:44:34 +00:00
Rafael Espindola
b215776fa1 In X86DAGToDAGISel::MatchWrapper, if base or index are set, avoid matching
only if symbolic addresses are RIP relatives.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 23:00:38 +00:00
Rafael Espindola
1cefb74190 Add tests for the parts of X86-64 TLS that are already implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 10:43:41 +00:00
Chris Lattner
8d57b778b5 fix a cross-block fastisel crash handling overflow intrinsics.
See comment for details.  This fixes rdar://6772169


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:51:14 +00:00
Chris Lattner
f5b6bc7f0e add some optimizations for strncpy/strncat and factor some
code.  Patch by Benjamin Kramer!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 05:06:39 +00:00
Chris Lattner
dbf1e2b08b move a target-specific test into its directory so it isn't run if you
don't configure the ARM target in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 23:58:38 +00:00
Chris Lattner
296185c264 fix two problems with machine sinking:
1. Sinking would crash when the first instruction of a block was
   sunk due to iterator problems.
2. Instructions could be sunk to their current block, causing an
   infinite loop.

This fixes PR3968


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 16:38:36 +00:00
Rafael Espindola
dbcfb3080a Don't fold a load if the other operand is a TLS address.
With this we generate

movl    %gs:0, %eax
leal    i@NTPOFF(%eax), %eax

instead of

movl    $i@NTPOFF, %eax
addl    %gs:0, %eax



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68778 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 10:09:34 +00:00
Bob Wilson
d9df501704 Fix pr3954. The register scavenger asserts for inline assembly with
register destinations that are tied to source operands.  The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly.  The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68714 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 17:16:43 +00:00
Chris Lattner
0c8382ce9a reg0 references are not real registers. This fixes a crash on the
attached testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 16:50:43 +00:00
Dan Gohman
57fc82d409 Generalize ExtendUsesToFormExtLoad to be usable for ANY_EXTEND,
in addition to ZERO_EXTEND and SIGN_EXTEND. Fix a bug in the
way it checked for live-out values, and simplify the way it
find users by using SDNode::use_iterator's (relatively) new
features. Also, make it slightly more permissive on targets
with free truncates.

In SelectionDAGBuild, avoid creating ANY_EXTEND nodes that are
larger than necessary. If the target's SwitchAmountTy has
enough bits, use it. This exposes the truncate to optimization
early, enabling more optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 03:51:29 +00:00
Rafael Espindola
094fad37b9 Re-apply 68552.
Tested by bootstrapping llvm-gcc and using that to build llvm.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 21:14:34 +00:00
Bob Wilson
83593a369b Add testcase for PR3795.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68620 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 18:00:55 +00:00
Duncan Sands
3d0355b825 Soft float support for FREM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 16:20:57 +00:00
Duncan Sands
7beb1ec298 Soft float support for undef. Reported by Xerxes Rånby.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 13:33:37 +00:00
Chris Lattner
ddfa57bd7b Instcombine should not promote whole computation trees to "strange"
integer types, unless they are already strange.  This prevents it from
turning the code produced by SROA into crazy libcalls and stuff that 
the code generator can't handle.  In the attached example, the result
was an i96 multiply that caused the x86 backend to assert.

Note that if TargetData had an idea of what the legal types are for
a target that this could be used to stop instcombine from introducing
i64 muls, as Scott wanted.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68598 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 05:41:03 +00:00
Dan Gohman
4da69c77cf Fully escape the grep string for this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 00:54:40 +00:00
Dan Gohman
ac03132018 Update this test for recent codegen improvements. CodeGen is now
using an lea in place of a mov and an add for this test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 00:51:11 +00:00
Dan Gohman
97121ba2af Implement support for using modeling implicit-zero-extension on x86-64
with SUBREG_TO_REG, teach SimpleRegisterCoalescing to coalesce
SUBREG_TO_REG instructions (which are similar to INSERT_SUBREG
instructions), and teach the DAGCombiner to take advantage of this on
targets which support it. This eliminates many redundant
zero-extension operations on x86-64.

This adds a new TargetLowering hook, isZExtFree. It's similar to
isTruncateFree, except it only applies to actual definitions, and not
no-op truncates which may not zero the high bits.

Also, this adds a new optimization to SimplifyDemandedBits: transform
operations like x+y into (zext (add (trunc x), (trunc y))) on targets
where all the casts are no-ops. In contexts where the high part of the
add is explicitly masked off, this allows the mask operation to be
eliminated. Fix the DAGCombiner to avoid undoing these transformations
to eliminate casts on targets where the casts are no-ops.

Also, this adds a new two-address lowering heuristic. Since
two-address lowering runs before coalescing, it helps to be able to
look through copies when deciding whether commuting and/or
three-address conversion are profitable.

Also, fix a bug in LiveInterval::MergeInClobberRanges. It didn't handle
the case that a clobber range extended both before and beyond an
existing live range. In that case, multiple live ranges need to be
added. This was exposed by the new subreg coalescing code.

Remove 2008-05-06-SpillerBug.ll. It was bugpoint-reduced, and the
spiller behavior it was looking for no longer occurrs with the new
instruction selection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 00:15:30 +00:00
Bill Wendling
044b5344c4 Temporarily revert r68552. This was causing a failure in the self-hosting LLVM
builds.

--- Reverse-merging (from foreign repository) r68552 into '.':
U    test/CodeGen/X86/tls8.ll
U    test/CodeGen/X86/tls10.ll
U    test/CodeGen/X86/tls2.ll
U    test/CodeGen/X86/tls6.ll
U    lib/Target/X86/X86Instr64bit.td
U    lib/Target/X86/X86InstrSSE.td
U    lib/Target/X86/X86InstrInfo.td
U    lib/Target/X86/X86RegisterInfo.cpp
U    lib/Target/X86/X86ISelLowering.cpp
U    lib/Target/X86/X86CodeEmitter.cpp
U    lib/Target/X86/X86FastISel.cpp
U    lib/Target/X86/X86InstrInfo.h
U    lib/Target/X86/X86ISelDAGToDAG.cpp
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
U    lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
U    lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h
U    lib/Target/X86/X86ISelLowering.h
U    lib/Target/X86/X86InstrInfo.cpp
U    lib/Target/X86/X86InstrBuilder.h
U    lib/Target/X86/X86RegisterInfo.td



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 22:35:25 +00:00
Rafael Espindola
2a6411bbbd Reduce code duplication on the TLS implementation.
This introduces a small regression on the generated code
quality in the case we are just computing addresses, not
loading values.

Will work on it and on X86-64 support.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68552 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 21:37:46 +00:00
Dan Gohman
4fd552880c Don't attempt to handle aggregate argument values in FastISel; let
SelectionDAG do those. This fixes PR3955.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68546 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 20:40:11 +00:00
Chris Lattner
62ce3b31a7 fix rdar://6762290, a crash compiling cxx filt with clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 05:03:34 +00:00
Bob Wilson
8f3434647d Handle 'a' modifier in ARM inline assembly.
Patch by Richard Pennington.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68464 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 21:46:51 +00:00
Ed Schouten
b5e0a96a8d Let the strcat optimizer return the pointer to the start of the buffer,
instead of the place where it started to perform the string copy.

- PR3661
- Patch by Benjamin Kramer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68443 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 13:06:48 +00:00
Nick Lewycky
cfdd807cfa Try SSE2?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 10:24:24 +00:00
Nick Lewycky
21cc4460ef Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 07:22:01 +00:00
Nick Lewycky
2cd1b777d7 Fix test on non-x86 platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 07:20:43 +00:00
Dan Gohman
f50c7981ae Fix a TargetLowering optimization so that it doesn't duplicate
loads when an input node has multiple uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 20:11:30 +00:00
Mon P Wang
1e95580925 Added a x86 dag combine to increase the chances to use a
movq for v2i64 on x86-32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 02:43:30 +00:00
Owen Anderson
e8a290fefc Reapply r68211, with the miscompilations it caused fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 23:53:49 +00:00
Bob Wilson
bf6396bed0 Fix PR3862: Recognize some ARM-specific constraints for immediates in inline
assembly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 17:58:54 +00:00
Dan Gohman
e63c4a2010 Revert r68172. It caused regressions in
Applications/Burg/burg
  Applications/ClamAV/clamscan
and many other tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 16:37:47 +00:00
Owen Anderson
f41fcbb60d Enhance GVN to propagate simple conditionals. This fixes PR3921.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 01:20:45 +00:00
Evan Cheng
de62192843 Throttle back "fold select into operand" transformation. InstCombine should not generate selects of two constants unless they are selects of 0 and 1.
e.g.
define i32 @t1(i32 %c, i32 %x) nounwind {
       %t1 = icmp eq i32 %c, 0
       %t2 = lshr i32 %x, 18
       %t3 = select i1 %t1, i32 %t2, i32 %x
       ret i32 %t3
}

was turned into

define i32 @t2(i32 %c, i32 %x) nounwind {
       %t1 = icmp eq i32 %c, 0
       %t2 = select i1 %t1, i32 18, i32 0
       %t3 = lshr i32 %x, %t2
       ret i32 %t3
}

For most targets, that means materializing two constants and then a select. e.g. On x86-64

movl    %esi, %eax
shrl    $18, %eax
testl   %edi, %edi
cmovne  %esi, %eax
ret

=>

xorl    %eax, %eax
testl   %edi, %edi
movl    $18, %ecx
cmovne  %eax, %ecx
movl    %esi, %eax
shrl    %cl, %eax
ret

Also, the optimizer and codegen can reason about shl / and / add, etc. by a constant. This optimization will hinder optimizations using ComputeMaskedBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 20:42:45 +00:00
Evan Cheng
6fb2168aae Fully general expansion of integer shift of any size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 19:39:24 +00:00
Dan Gohman
431efa19aa Add an explicit -asm-verbose to these tests, to make it
possible to run the tests with -asm-verbose defaulting
to false.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68124 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 18:20:47 +00:00
Devang Patel
28c531cdbb Update call graph after inlining invoke.
Patch by Jay Foad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 17:36:12 +00:00
Owen Anderson
696a1307ba Remove the "fast" cases for spill and restore point determination, as these were subtlely wrong in obscure cases. Patch the testcase
to account for this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 08:27:09 +00:00
Dan Gohman
07c26ee87e Fix live-out reg logic to not insert over-aggressive AssertZExt
instructions. This fixes lua.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 01:38:29 +00:00
Devang Patel
b23c232fc8 Loop Index Split can eliminate a loop if it can determin if loop body is executed only once. There was a bug in determining IV based value of the iteration for which the loop body is executed. Fix it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 22:24:10 +00:00
Evan Cheng
e6f350d755 Turn a 2-address instruction into a 3-address one when it's profitable even if the two-address operand is killed.
e.g.
%reg1024<def> = MOV r1
%reg1025<def> = ADD %reg1024, %reg1026
r0            = MOV %reg1025

If it's not possible / profitable to commute ADD, then turning ADD into a LEA saves a copy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 21:34:07 +00:00
Anton Korobeynikov
30ffe8150f Tweak test for recent relro stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 15:28:40 +00:00
Evan Cheng
878071e6d0 Forgot this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 06:17:34 +00:00
Anton Korobeynikov
807117dc56 Testcase for recent ro/relocs stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68008 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 17:14:57 +00:00
Duncan Sands
004e27cc1b Fix PR3899: add support for extracting floats from vectors
when using -soft-float.
Based on a patch by Jakob Stoklund Olesen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 13:51:06 +00:00
Arnold Schwaighofer
11ff97801b Make check in CheckTailCallReturnConstraints for ignorable instructions between
a CALL and a RET node more generic. Add a test for tail calls with a void
return.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 12:36:29 +00:00
Arnold Schwaighofer
e75fd69f15 Enable tail call optimization for functions that return a struct (bug 3664) and for functions that return types that need extending (e.g i1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 08:33:27 +00:00
Evan Cheng
0b0cd9113a Optimize some 64-bit multiplication by constants into two lea's or one lea + shl since imulq is slow (latency 5). e.g.
x * 40
=>
shlq    $3, %rdi
leaq    (%rdi,%rdi,4), %rax

This has the added benefit of allowing more multiply to be folded into addressing mode. e.g.
a * 24 + b
=>
leaq    (%rdi,%rdi,2), %rax
leaq    (%rsi,%rax,8), %rax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 05:57:29 +00:00
Dan Gohman
1a36744b07 Fix this test so that it doesn't spuriously fail due to some
unrelated debugging output happening to contain the string "store".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 16:17:22 +00:00
Evan Cheng
cb2480d0a8 Add a __builtin___memset_chk test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 02:45:14 +00:00
Evan Cheng
0802851816 Add -march=x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26 23:03:32 +00:00
Bill Wendling
dccbfea503 Add -f to RUN line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26 06:17:54 +00:00
Chris Lattner
a95dbf23f8 no need for eh info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26 05:51:18 +00:00
Bill Wendling
24c98cebc8 Add testcase for r67728.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26 01:52:47 +00:00
Devang Patel
575ec806e0 Before deleting a basic block, give other loop passes a chance cleanup analysis values, related to the instructions in the basic block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 23:57:48 +00:00
Evan Cheng
e597282fe5 Add a test case for PR3779: when to promote the function return value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 20:30:19 +00:00