Commit Graph

2965 Commits

Author SHA1 Message Date
Nick Lewycky
394ce41b7f Arrays and vectors with different numbers of elements are not equivalent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108517 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 06:31:12 +00:00
Tobias Grosser
74c740052a LoopSimplify does not update domfrontier correctly.
This fixes PR7649.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 05:59:45 +00:00
Eric Christopher
de309a8b52 Also revert 108422, it's causing some test failures.
Working on testcases for Owen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108494 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 01:36:12 +00:00
Dan Gohman
2969016070 Fix this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 01:28:45 +00:00
Dan Gohman
bb5d92741b Fix the order that SCEVExpander considers add operands in so that
it doesn't miss an opportunity to form a GEP, regardless of the
relative loop depths of the operands. This fixes rdar://8197217.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108475 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 23:38:13 +00:00
Owen Anderson
96fe621e07 Reapply r108378, with bugfixes, testcase, and improved comment formatting.
This now passes LIT, nighty test, and llvm-gcc bootstrap on my machine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 15:00:23 +00:00
Chris Lattner
d2bfe54b0a Fix PR7647, handling the case when 'To' ends up being
mutated by recursive simplification.  This also enhances
ReplaceAndSimplifyAllUses to actually do a real RAUW
at the end of it, which updates any value handles
pointing to "From" to start pointing to "To".  This
seems useful for debug info and random other VH users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108415 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 06:36:08 +00:00
Chris Lattner
07c9b64719 revert r108320, I see the failures now...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108322 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 06:16:35 +00:00
Chris Lattner
7e185af930 reapply benjamin's instcombine patch, I don't see anything wrong with it and can't repro any problems with a manual self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-14 05:59:13 +00:00
Duncan Sands
d0d3ccc827 Handle the case of a tail recursion in which the tail call is followed
by a return that returns a constant, while elsewhere in the function
another return instruction returns a different constant.  This is a
special case of accumulator recursion, so just generalize the existing
logic a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 15:41:41 +00:00
Benjamin Kramer
c9fe6374b7 Nope, still breaks the release selfhost bots :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108153 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 16:38:48 +00:00
Benjamin Kramer
8fd437c43f Reapply the "or" half of r108136, which seems to be less problematic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108152 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 16:15:48 +00:00
Benjamin Kramer
e2d07b5208 Revert r108141 again, sigh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:42:04 +00:00
Benjamin Kramer
98a8206e58 Reapply 108136 with an ugly pasto fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 13:44:00 +00:00
Benjamin Kramer
0cc4ed1ca5 Revert r108136 until I figure out why it broke selfhost.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 12:35:49 +00:00
Benjamin Kramer
4fc719e607 instcombine: fold (x & y) | (~x & z) and (x & y) ^ (~x & z) into ((y ^ z) & x) ^ z which is one instruction shorter. (PR6773)
before:
  %and = and i32 %y, %x
  %neg = xor i32 %x, -1
  %and4 = and i32 %z, %neg
  %xor = xor i32 %and4, %and

after:
  %xor1 = xor i32 %z, %y
  %and2 = and i32 %xor1, %x
  %xor = xor i32 %and2, %z


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108136 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 11:54:45 +00:00
Chris Lattner
dfd3626b47 fix PR7311 by avoiding breaking casts when a bitcast from scalar->vector
is involved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108117 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 01:19:22 +00:00
Chris Lattner
0a96144aac if jump threading is able to infer interesting values on both
the LHS and RHS of an and/or instruction, don't multiply add
known predecessor values.  This fixes the crash on testcase
from PR7498


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 00:47:34 +00:00
Chris Lattner
eae2895120 fix PR7429, a crash turning a load from a string into a float.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 00:22:51 +00:00
Chris Lattner
ddef83536c convert to filechecconvert to filecheckk
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108112 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 00:21:10 +00:00
Chris Lattner
243a73d0e6 merge two tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108111 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 00:19:47 +00:00
Benjamin Kramer
1db071f0da Teach instcombine to transform
(X >s -1) ? C1 : C2 and (X <s  0) ? C2 : C1
into ((X >>s 31) & (C2 - C1)) + C1, avoiding the conditional.

This optimization could be extended to take non-const C1 and C2 but we better
stay conservative to avoid code size bloat for now.

for
int sel(int n) {
     return n >= 0 ? 60 : 100;
}

we now generate
  sarl  $31, %edi
  andl  $40, %edi
  leal  60(%rdi), %eax

instead of
  testl %edi, %edi
  movl  $60, %ecx
  movl  $100, %eax
  cmovnsl %ecx, %eax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 11:39:10 +00:00
Chris Lattner
0238f8c430 Fix the second half of PR7437: scalarrepl wasn't preserving
address spaces when SRoA'ing memcpy's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 00:27:05 +00:00
Dale Johannesen
cf22493496 Prevent test from hanging waiting for input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 22:57:11 +00:00
Devang Patel
26d14294de Debugging infomration is encoded in llvm IR using metadata. This is designed
such a way that debug info for symbols preserved even if symbols are
optimized away by the optimizer. 

Add new special pass to remove debug info for such symbols.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 19:49:20 +00:00
Devang Patel
444a08cd6f Remove all debug info related named mdnodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107323 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 21:29:00 +00:00
Dan Gohman
1104645eef Fix ScalarEvolution's tripcount computation for chains of loops
where each loop's induction variable's start value is the exit
value of a preceding loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 23:43:06 +00:00
Dan Gohman
0dd3549edc Constant fold x == undef to undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 21:30:07 +00:00
Chris Lattner
08189d625d this test is failing nondeterministically and blaming me, just disable
it for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 22:08:30 +00:00
Benjamin Kramer
2b3b32361f Fix test weirdness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106959 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 22:06:50 +00:00
Benjamin Kramer
a2938e7e5f Fix some tests that didn't test anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106954 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 20:05:06 +00:00
Kenneth Uildriks
caa54d0c6f Partial specialization test should not depend on the order of specialization operations or the names assigned to the specialized functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106953 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 18:47:40 +00:00
Duncan Sands
d50e9e2566 Fix PR7328: when turning a tail recursion into a loop, need to preserve
the returned value after the tail call if it differs from other return
values.  The optimal thing to do would be to introduce a phi node for
the return value, but for the moment just fix the miscompile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 12:53:31 +00:00
Dan Gohman
a52838285b Disable indvars on loops when LoopSimplify form is not available.
This fixes PR7333.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18 01:35:11 +00:00
Rafael Espindola
1e81966626 Remove arm_apcscc from the test files. It is the default and doing this
matches what llvm-gcc and clang now produce.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106221 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17 15:18:27 +00:00
Rafael Espindola
e96af56a5b Make sure that simplify libcalls does not replace a call with one calling
convention with a new call with a different calling convention.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 19:34:01 +00:00
Benjamin Kramer
ea9ca0236d simplify-libcalls: fold strncmp(x, y, 1) -> memcmp(x, y, 1)
The memcmp will be optimized further and even the pathological case
'strstr(x, "x") == x' generates optimal code now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 10:30:29 +00:00
Benjamin Kramer
386e918438 simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 21:34:25 +00:00
Rafael Espindola
2ebb4f81f7 Remove the arm_aapcscc marker from the tests. It is the default
for the linux targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106029 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-15 19:04:29 +00:00
Chris Lattner
e58867e55e jump threading can't split a critical edge from an indirectbr. This
fixes PR7356.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105950 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-14 19:45:43 +00:00
Benjamin Kramer
c125fedcc7 Test case for r105914.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-13 16:16:54 +00:00
Kenneth Uildriks
3a4340d4cb Partial specialization was not checking the callsite to make sure it was using the same constants as the specialization, leading to calls to the wrong specialization. Patch by Takumi Nakamura\!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105528 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-05 14:50:21 +00:00
Devang Patel
93031ac032 Copy location info for current function argument from dbg.declare if respective store instruction does not have any location info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-04 22:27:30 +00:00
Duncan Sands
2914ba6ec7 Fix PR7272: when inlining through a callsite with byval arguments,
the newly created allocas may be used by inlined calls, so these
need to have their tail call flags cleared.  Fixes PR7272.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105255 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-31 21:00:26 +00:00
Nick Lewycky
a9d6680cb1 The memcpy intrinsic only takes i8* for %src and %dst, so cast them to that
first. Fixes PR7265.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105206 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-31 06:16:35 +00:00
Dale Johannesen
7722b082c4 Add missing space; works for me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 18:45:59 +00:00
Dan Gohman
05d6253727 Teach instcombine to promote alloca array sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 15:09:00 +00:00
Dan Gohman
8496d50412 Add a testcase for getelementptr index promotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-28 15:07:59 +00:00
Devang Patel
d8720f4ba3 Do not drop location info for inlined function args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 20:25:04 +00:00
Duncan Sands
1d9b973fd7 Teach instCombine to remove malloc+free if malloc's only uses are comparisons
to null.  Patch by Matti Niemenmaa.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104871 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 19:09:06 +00:00