Benjamin Kramer
e391789246
Reapply the "or" half of r108136, which seems to be less problematic.
...
llvm-svn: 108152
2010-07-12 16:15:48 +00:00
Benjamin Kramer
98c95e7743
Revert r108141 again, sigh.
...
llvm-svn: 108148
2010-07-12 14:42:04 +00:00
Benjamin Kramer
c4f46375d3
Reapply 108136 with an ugly pasto fixed.
...
llvm-svn: 108141
2010-07-12 13:44:00 +00:00
Benjamin Kramer
d9bf737e62
Revert r108136 until I figure out why it broke selfhost.
...
llvm-svn: 108139
2010-07-12 12:35:49 +00:00
Benjamin Kramer
f00a49ceff
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
llvm-svn: 108136
2010-07-12 11:54:45 +00:00
Chris Lattner
59bffe35a1
fix PR7311 by avoiding breaking casts when a bitcast from scalar->vector
...
is involved.
llvm-svn: 108117
2010-07-12 01:19:22 +00:00
Chris Lattner
baef771d17
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
llvm-svn: 108114
2010-07-12 00:47:34 +00:00
Chris Lattner
d8288040c3
fix PR7429, a crash turning a load from a string into a float.
...
llvm-svn: 108113
2010-07-12 00:22:51 +00:00
Chris Lattner
68f5ec0fa2
convert to filechecconvert to filecheckk
...
llvm-svn: 108112
2010-07-12 00:21:10 +00:00
Chris Lattner
64eeea9044
merge two tests.
...
llvm-svn: 108111
2010-07-12 00:19:47 +00:00
Benjamin Kramer
27eb255a70
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
llvm-svn: 107866
2010-07-08 11:39:10 +00:00
Chris Lattner
bf009b527a
Fix the second half of PR7437: scalarrepl wasn't preserving
...
address spaces when SRoA'ing memcpy's.
llvm-svn: 107846
2010-07-08 00:27:05 +00:00
Dale Johannesen
e7117f93f1
Prevent test from hanging waiting for input.
...
llvm-svn: 107446
2010-07-01 22:57:11 +00:00
Devang Patel
a0fa700f3c
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.
llvm-svn: 107416
2010-07-01 19:49:20 +00:00
Devang Patel
7962349c46
Remove all debug info related named mdnodes.
...
llvm-svn: 107323
2010-06-30 21:29:00 +00:00
Dan Gohman
32534063c7
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.
llvm-svn: 107224
2010-06-29 23:43:06 +00:00
Dan Gohman
50fffcaea3
Constant fold x == undef to undef.
...
llvm-svn: 107074
2010-06-28 21:30:07 +00:00
Chris Lattner
93a4f87f9c
this test is failing nondeterministically and blaming me, just disable
...
it for now.
llvm-svn: 106960
2010-06-26 22:08:30 +00:00
Benjamin Kramer
8101054d77
Fix test weirdness.
...
llvm-svn: 106959
2010-06-26 22:06:50 +00:00
Benjamin Kramer
d02a62bee2
Fix some tests that didn't test anything.
...
llvm-svn: 106954
2010-06-26 20:05:06 +00:00
Kenneth Uildriks
e4adab665c
Partial specialization test should not depend on the order of specialization operations or the names assigned to the specialized functions
...
llvm-svn: 106953
2010-06-26 18:47:40 +00:00
Duncan Sands
68f39e00a4
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.
llvm-svn: 106947
2010-06-26 12:53:31 +00:00
Dan Gohman
e375e96f0d
Disable indvars on loops when LoopSimplify form is not available.
...
This fixes PR7333.
llvm-svn: 106267
2010-06-18 01:35:11 +00:00
Rafael Espindola
d7a63bead9
Remove arm_apcscc from the test files. It is the default and doing this
...
matches what llvm-gcc and clang now produce.
llvm-svn: 106221
2010-06-17 15:18:27 +00:00
Rafael Espindola
6ccafc9391
Make sure that simplify libcalls does not replace a call with one calling
...
convention with a new call with a different calling convention.
llvm-svn: 106134
2010-06-16 19:34:01 +00:00
Benjamin Kramer
f600dc2eed
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.
llvm-svn: 106097
2010-06-16 10:30:29 +00:00
Benjamin Kramer
21a49e9375
simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0
...
llvm-svn: 106047
2010-06-15 21:34:25 +00:00
Rafael Espindola
ab5183047b
Remove the arm_aapcscc marker from the tests. It is the default
...
for the linux targets.
llvm-svn: 106029
2010-06-15 19:04:29 +00:00
Chris Lattner
88d51b0f4c
jump threading can't split a critical edge from an indirectbr. This
...
fixes PR7356.
llvm-svn: 105950
2010-06-14 19:45:43 +00:00
Benjamin Kramer
443f74025b
Test case for r105914.
...
llvm-svn: 105915
2010-06-13 16:16:54 +00:00
Kenneth Uildriks
73367eb575
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\!
...
llvm-svn: 105528
2010-06-05 14:50:21 +00:00
Devang Patel
8bf4434e6e
Copy location info for current function argument from dbg.declare if respective store instruction does not have any location info.
...
llvm-svn: 105490
2010-06-04 22:27:30 +00:00
Duncan Sands
da677f56f2
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.
llvm-svn: 105255
2010-05-31 21:00:26 +00:00
Nick Lewycky
418d80e555
The memcpy intrinsic only takes i8* for %src and %dst, so cast them to that
...
first. Fixes PR7265.
llvm-svn: 105206
2010-05-31 06:16:35 +00:00
Dale Johannesen
6b20aa3751
Add missing space; works for me.
...
llvm-svn: 104992
2010-05-28 18:45:59 +00:00
Dan Gohman
22d22caaed
Teach instcombine to promote alloca array sizes.
...
llvm-svn: 104945
2010-05-28 15:09:00 +00:00
Dan Gohman
bab79afa29
Add a testcase for getelementptr index promotion.
...
llvm-svn: 104944
2010-05-28 15:07:59 +00:00
Devang Patel
8d4eb26f24
Do not drop location info for inlined function args.
...
llvm-svn: 104884
2010-05-27 20:25:04 +00:00
Duncan Sands
32d3986765
Teach instCombine to remove malloc+free if malloc's only uses are comparisons
...
to null. Patch by Matti Niemenmaa.
llvm-svn: 104871
2010-05-27 19:09:06 +00:00
Benjamin Kramer
0acbf37982
Properly promote operands when optimizing a single-character memcmp.
...
llvm-svn: 104648
2010-05-25 22:53:43 +00:00
Nick Lewycky
fc4c30e9e3
Actually run the test. Thanks Daniel Dunbar!
...
llvm-svn: 103720
2010-05-13 17:41:06 +00:00
Nick Lewycky
38e49fbf52
Add testcase for r103653.
...
llvm-svn: 103699
2010-05-13 06:00:14 +00:00
Chris Lattner
e74d980a02
make simplifycfg insert an llvm.trap before the 'unreachable' it introduces
...
when it detects undefined behavior. llvm.trap generally codegens into some
thing really small (e.g. a 2 byte ud2 instruction on x86) and debugging this
sort of thing is "nontrivial". For example, we now compile:
void foo() { *(int*)0 = 42; }
into:
_foo:
pushl %ebp
movl %esp, %ebp
ud2
Some may even claim that this is a security hole, though that seems dubious
to me. This addresses rdar://7958343 - Optimizing away null dereference
potentially allows arbitrary code execution
llvm-svn: 103356
2010-05-08 22:15:59 +00:00
Chris Lattner
0b442d35da
Teach instcombine to transform a bitcast/(zext|trunc)/bitcast sequence
...
with a vector input and output into a shuffle vector. This sort of
sequence happens when the input code stores with one type and reloads
with another type and then SROA promotes to i96 integers, which make
everyone sad.
This fixes rdar://7896024
llvm-svn: 103354
2010-05-08 21:50:26 +00:00
Chris Lattner
1037630863
Fix PR7052, patch by Jakub Staszak!
...
llvm-svn: 103347
2010-05-08 20:01:44 +00:00
Devang Patel
9290f59fb8
Update test to use valid debug info.
...
llvm-svn: 103287
2010-05-07 20:34:00 +00:00
Dan Gohman
1512bd9998
Add an LLVM IR version of code sinking. This uses the same simple algorithm
...
as MachineSink, but it isn't constrained by MachineInstr-level details.
llvm-svn: 103257
2010-05-07 15:40:13 +00:00
Duncan Sands
7db9873b74
Use llvm.foo as the intrinsic, rather than llvm.dbg.value. Since the
...
values passed to llvm.dbg.value were not valid for the intrinsic, it
might have caused trouble one day if the verifier ever started checking
for valid debug info.
llvm-svn: 103038
2010-05-04 20:09:25 +00:00
Duncan Sands
a3857d3d9a
Fix a variant of PR6112 found by thinking about it: when doing
...
RAUW of a global variable with a local variable in function F,
if function local metadata M in function G was using the global
then M would become function-local to both F and G, which is not
allowed. See the testcase for an example. Fixed by detecting
this situation and zapping the metadata operand when it occurs.
llvm-svn: 103007
2010-05-04 12:43:36 +00:00
Devang Patel
fa560fdfc1
Check for side effects before splitting loop.
...
Patch by Jakub Staszak!
llvm-svn: 102928
2010-05-03 18:06:58 +00:00