Commit Graph

5789 Commits

Author SHA1 Message Date
Dale Johannesen
8bb2ef4760 Adjust grep's for new code sequence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 18:53:58 +00:00
Evan Cheng
e7321441ac Fix asm printing of MOVSDto64mr and MOV64toSDrm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55300 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 04:11:42 +00:00
Bill Wendling
3574c2d849 Fix this test. Don't null out the file, just XFAIL it until patch can be fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 21:48:46 +00:00
Bill Wendling
59b63e4a18 Temporarily reverting r55292. It's causing a bootstraping failure:
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/xgcc ... src/libiberty/make-temp-file.c -o make-temp-file.o
Assertion failed: (Node2Index[SU->NodeNum] > Node2Index[I->Dep->NodeNum] && "Wrong topological sorting"), function InitDAGTopologicalSorting, file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp, line 508.
../../../../llvm-gcc.src/libiberty/hashtab.c:955: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [hashtab.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [multi-do] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libiberty] Error 2
make: *** [all] Error 2



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55295 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 21:45:30 +00:00
Evan Cheng
32c727cd95 Move callseq_start above the call address load to allow load to be folded into the call node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55292 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 19:19:55 +00:00
Anton Korobeynikov
8ff7ce3dd2 Testcase for 64bit maskmovq
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 15:53:47 +00:00
Chris Lattner
259f88e3c9 Verify that the alignment argument to llvm.memcpy is a constant
integer, PR2318.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55228 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 05:31:10 +00:00
Chris Lattner
88e6dc8bf1 Fix PR2423 by checking all indices for out of range access, not only
indices that start with an array subscript.  x->field[10000] is just 
as bad as (*X)[14][10000].


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 05:21:06 +00:00
Dale Johannesen
169b5ed46e Test all currently supported atomic builtins on x86-{32,64}.
These just test that they go through the BE.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55208 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 22:39:21 +00:00
Dale Johannesen
7916fad6ef Comprehensive test of FE handling of __sync builtins.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55206 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 21:47:03 +00:00
Dan Gohman
22bb31103d Factor out the predicate check code from DAGISelEmitter.cpp
and use it in FastISelEmitter.cpp, and make FastISel
subtarget aware. Among other things, this lets it work
properly on x86 targets that don't have SSE, where it
successfully selects x87 instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 00:20:26 +00:00
Bill Wendling
403483c200 Testcase for PR2585.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55151 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 23:04:49 +00:00
Dan Gohman
c67670b1ae Add -mattr=sse2 so this test doesn't fail on non-x86 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55145 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 22:34:25 +00:00
Dale Johannesen
e2122a5e2e Make x86 and sse2 explicit for non-x86 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 21:26:06 +00:00
Evan Cheng
1887c1c2f9 Fix a number of byval / memcpy / memset related codegen issues.
1. x86-64 byval alignment should be max of 8 and alignment of type. Previously the code was not doing what the commit message was saying.
2. Do not use byte repeat move and store operations. These are slow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 21:00:15 +00:00
Dan Gohman
5cc101ec89 getelementptr doesn't work on x86-64 yet, because it
has MOV64ri32 and no plain MOV64ri.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55126 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 17:28:42 +00:00
Dan Gohman
7a0e6593d0 MVT::getMVT uses iPTR for pointer types, while we need the actual
intptr_t type in this case. FastISel can now select simple
getelementptr instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 17:25:26 +00:00
Nick Lewycky
5d52c4501a Revert r54876 r54877 r54906 and r54907. Evan found that these caused a 20%
slowdown in bzip2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55113 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 05:56:10 +00:00
Dan Gohman
d5fe57d2f9 Basic fast-isel support for instructions with constant int operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 01:41:07 +00:00
Dan Gohman
5c6aea9714 Add a -march line for this test, and run it on x86-64 too for fun.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:56:07 +00:00
Chris Lattner
80b7bc865a ll printer prints each zeroinit on the same line now, update regex
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55025 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:33:57 +00:00
Dan Gohman
8014e86580 Add FastISel support for floating-point operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:23:20 +00:00
Dan Gohman
bdedd44773 Add FastISel support for several more binary operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:11:48 +00:00
Bill Wendling
108ecf3975 Add support for the __sync_sub_and_fetch atomics and friends for X86. The code
was already present, but not hooked up to anything.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55018 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 23:09:18 +00:00
Dan Gohman
d3aedf445c Fast-isel is now *minimally* functional. Add a testcase to
demonstrate the extent of its capabilities. Note that it
only attempts to operate on one of the blocks in this
testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55016 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 22:37:59 +00:00
Dale Johannesen
140be2dfb7 Add support for 8 and 16 bit forms of __sync
builtins on X86.

Change "lock" instructions to be on a separate line.
This is needed to work around a bug in the Darwin
assembler.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54999 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 18:47:28 +00:00
Bill Wendling
2dcca3a6d8 XFAIL this test for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 18:29:54 +00:00
Nick Lewycky
91a0f78265 Consider the case where xor by -1 and xor by 128 have been combined already to
produce an xor by 127.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54906 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 19:58:24 +00:00
Evan Cheng
4e49c80289 Didn't mean to change this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 19:25:28 +00:00
Evan Cheng
0ac3fc2a61 Fix a (u)comiss intrinsic lowering bug. It was using anyext which can return junk in higher bits. Patch by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 19:22:34 +00:00
Gordon Henriksen
5eca075b74 Rename some GC classes so that their roll will hopefully be clearer.
In particular, Collector was confusing to implementors. Several
thought that this compile-time class was the place to implement
their runtime GC heap. Of course, it doesn't even exist at runtime.
Specifically, the renames are:

  Collector               -> GCStrategy
  CollectorMetadata       -> GCFunctionInfo
  CollectorModuleMetadata -> GCModuleInfo
  CollectorRegistry       -> GCRegistry
  Function::getCollector  -> getGC (setGC, hasGC, clearGC)

Several accessors and nested types have also been renamed to be
consistent. These changes should be obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 18:44:35 +00:00
Nick Lewycky
1b344bc986 Xor'ing both sides of icmp by sign-bit is equivalent to swapping signedness of
the predicate.

Also, make this optz'n apply in more cases where it's safe to do so.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 07:34:14 +00:00
Owen Anderson
7c856c09cd Remove GCSE and LoadVN from the testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 00:00:54 +00:00
Devang Patel
35115f92e4 Reapply 54786. Add overflow and number of mantissa bits checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-15 21:21:34 +00:00
Evan Cheng
21066541ae Revert 54786. It's not checking for overflows, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54813 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-15 08:12:11 +00:00
Bill Wendling
0d9deac485 Renaming LLVMC/dg.exp to LLVM/llvmc.exp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 23:37:58 +00:00
Devang Patel
488dc6732d The pass manager is not able to schedule -loop-deletion -loop-index-split.
The loop-deletion pass does not preserve dom frontier, which is required by
loop-index-split. When the PM checks dom frontier for loop-index-split, it has
already verified that lcssa is availalble. However, new dom frontier forces new
loop pass manager, which does not  have lcssa yet.

The PM should recheck availability of required analysis passes in such cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 23:07:48 +00:00
Devang Patel
79ceb4463e If IV is used in a int-to-float cast inside the loop then try to eliminate the cast opeation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 20:58:31 +00:00
Dan Gohman
7f8613e5b8 Improve support for vector casts in LLVM IR and CodeGen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 20:04:46 +00:00
Dan Gohman
a60832b018 Fix a bogus srem rule - a negative value srem'd by a power-of-2
can have a non-negative result; for example, -16%16 is 0. Also,
clarify the related comments. This fixes PR2670.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 23:12:35 +00:00
Dan Gohman
6ab6422f25 Allow SelectionDAG to create EXTRACT_VECTOR_ELT nodes with
non-constant indices. Only a few of the peephole checks require
a constant index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 21:51:37 +00:00
Dan Gohman
2edeb63ece Fix SCCP's handling of struct value loads and stores. SCCP doesn't
track individual leaf values in such cases, so it needs to treat
struct values as normal values in this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 21:22:48 +00:00
Duncan Sands
81b06be055 Teach constant folding that an inttoptr of a
ptrtoint can be turned into a bitcast if the
integer is at least as wide as a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54752 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 20:20:35 +00:00
Devang Patel
d16aba22c9 Check sign to detect overflow before changing compare stride.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 02:05:14 +00:00
Dan Gohman
3837218ea0 Extend ScalarEvolution's executesAtLeastOnce logic to be able to
continue past the first conditional branch when looking for a
relevant test. This helps it avoid using MAX expressions in
loop trip counts in more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 20:17:31 +00:00
Chris Lattner
b8cd4d3d49 Implement support for simplifying vector comparisons by 0.0 and 1.0 like we
do for scalars.  Patch contributed by Nicolas Capens

This also generalizes the previous xforms to work on long double, now that 
isExactlyValue works for long double.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54653 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 22:06:05 +00:00
Dan Gohman
00f19b6542 Improve the grep commands for this test to be tolerant of ABI
differences, and to be more specific.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 20:10:41 +00:00
Dan Gohman
8cea8ff34c Take the FrameOffset into account when computing the alignment
of stack objects. This fixes PR2656.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 18:27:03 +00:00
Gordon Henriksen
21491edbf4 [PR-2610] Adding Ocaml bindings for Switch::addCase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 01:55:52 +00:00
Dan Gohman
d9ced09299 Add an EXTRACTPSmr pattern to match the pattern that
X86ISelLowering creates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 18:30:21 +00:00
Nick Lewycky
ffa45431c8 Testcase for r54520.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 07:00:26 +00:00
Evan Cheng
711b6dce24 It's not legal to output a GV in a coalesced section if it's used in an ARM PIC relative constantpool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54519 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 06:56:16 +00:00
Nick Lewycky
d6227385fc Don't crash printing the asm for a ConstantExpr PtrToInt just because the int
is narrower than the pointer. This testcase emits:

  .byte (((17) - 16) & 255)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54517 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 06:34:07 +00:00
Bruno Cardoso Lopes
65ad452536 Support added for ctlz intrinsic, test case added.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54516 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 06:16:31 +00:00
Bruno Cardoso Lopes
ab243df91f [Last] Batch 7 of Mips CodeGen tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 04:12:42 +00:00
Bruno Cardoso Lopes
4230586091 Batch 6 of Mips CodeGen tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 04:11:30 +00:00
Bruno Cardoso Lopes
0b4e136c74 Batch 5 of Mips CodeGen tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 04:09:57 +00:00
Bruno Cardoso Lopes
29b4ff7c73 Batch 4 of Mips CodeGen tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 04:08:30 +00:00
Bruno Cardoso Lopes
ba3442fc24 Batch 3 of Mips CodeGen tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 04:05:51 +00:00
Bruno Cardoso Lopes
e5813b7aa8 Batch 2 of Mips CodeGen tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 04:03:25 +00:00
Bruno Cardoso Lopes
6d523c0fe3 Batch 1 of Mips CodeGen tests, more coming...
I had a lot of simple local codegen tests and they are now ready to be placed
in test/CodeGen. 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 03:58:34 +00:00
Dale Johannesen
ea98fe2cd2 Testcases for 54503. One derived from PR 2533, the
other from Python.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 03:37:11 +00:00
Duncan Sands
c93346af8e Use correct compiler component names for objc
and objc++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 17:59:54 +00:00
Duncan Sands
dbfccf64d9 Move tests of the ObjC++ front-end to their own
directory: some people (guess who!) may build llvm-gcc
with support for objc but not with support for objc++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 17:48:08 +00:00
Matthijs Kooijman
1d63d92092 Add a basic test for the SRETPromotion pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54466 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 15:55:18 +00:00
Matthijs Kooijman
0d4ee1a7cd Move two tests from SRETPromotion to Inline, since they only call opt -inline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 15:36:46 +00:00
Anton Korobeynikov
feac94b18d Print section flags ok on platforms, which use '@' as comment string. Fix test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 09:55:06 +00:00
Dan Gohman
e3d920699c Re-enable elimination of unnecessary SUBREG_TO_REG instructions in
LowerSubregs, and fix an x86-64 isel bug that this exposed.

SUBREG_TO_REG for x86-64 implicit zero extension is only safe for
isel to generate when the source is known to always have zeros in
the high 32 bits. The EXTRACT_SUBREG instruction does not clear
the high 32 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54444 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 02:54:50 +00:00
Dan Gohman
865db4566e Add an extra example that shouldn't get an and instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 02:23:06 +00:00
Dan Gohman
8a1510d192 Re-introduce the 8-bit subreg zext-inreg patterns for x86-32,
this time using MOV32to32_ and MOV16to16_. Thanks to Evan for
suggesting this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:27:21 +00:00
Dan Gohman
4ce9627e97 Fix a shufflevector instcombine that was emitting invalid masks indices
when it meant to be emitting undef indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:17:32 +00:00
Evan Cheng
d756f8820a PR2535, not PR2355.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54416 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:06:48 +00:00
Evan Cheng
f5e25f32c7 Fix PR2355: bug in ChangeCompareStride. When the loop termination compare is the only use of its iv stride, the stride can be eliminated by moving it to another stride. If the scale is negative, swap the predicate instead of using a inverse predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:04:43 +00:00
Chris Lattner
46bbad217b optimize a common idiom generated by clang for bitfield access, PR2638.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 07:35:52 +00:00
Chris Lattner
5af5f463e1 Zap sitofp/fptoui pairs. In all cases when the sign difference
matters, the result is undefined anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 05:13:06 +00:00
Nick Lewycky
b30591ec64 Reinstate this optimization, but without the miscompile. Thanks to Bill for
tracking down that this was breaking llvm-gcc bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 04:54:03 +00:00
Bill Wendling
5226698f67 Just grep for through the LL code instead of the ASM code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 00:10:32 +00:00
Bill Wendling
201bf25f83 Add default architecture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 23:36:00 +00:00
Bill Wendling
0b101b0399 Testcase for PR2629.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 22:23:59 +00:00
Evan Cheng
e9d5035838 Fix PR2620: Fix X86cmppd selection code so it expects operands to be v2f64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54376 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 22:19:15 +00:00
Evan Cheng
e3b8a48d32 Fix PR2596: out of bound reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:51:46 +00:00
Bill Wendling
021507be82 Revert r53282. This was causing a miscompile on Linux. Also, the transformation
looks bogus. Please see PR2629 for details on why this is breaking things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:23:45 +00:00
Owen Anderson
b6634e9e27 Update the remaining tests not to use -disable-correct-folding, and remove two
that couldn't be updated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:19:14 +00:00
Owen Anderson
551ddf718c One more -disable-correct-folding case removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:08:56 +00:00
Owen Anderson
2a1f07ea6a Remove another -disable-correct-folding use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:05:58 +00:00
Owen Anderson
d6db225800 Eliminate another use of -disable-correct-folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:03:01 +00:00
Owen Anderson
287b7b7ed7 This check is unnecessary, and getting rid of it removes a use of -disable-correct-folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 17:52:54 +00:00
Owen Anderson
3888aa0b7d Remove the need for -disable-correct-folding from this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 17:49:52 +00:00
Dan Gohman
c3be0fd8c3 Fix the AsmWriter to not print extra spaces after parameter attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 15:51:44 +00:00
Evan Cheng
068b4ff553 Fix PR2568: Fix bug that cause redudant kill marker after its live interval has been extended due to coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 07:10:38 +00:00
Owen Anderson
2b85dc3544 Update these tests to work by disabling the new correct CFG generation. This flag should ONLY be used to for tests like these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:55:29 +00:00
Eli Friedman
b42a626122 PR2621: Improvements to the SCEV AddRec binomial expansion. This
version uses a new algorithm for evaluating the binomial coefficients 
which is significantly more efficient for AddRecs of more than 2 terms 
(see the comments in the code for details on how the algorithm works).  
It also fixes some bugs: it removes the arbitrary length restriction for 
AddRecs, it fixes the silent generation of incorrect code for AddRecs 
which require a wide calculation width, and it fixes an issue where we 
were incorrectly truncating the iteration count too far when evaluating 
an AddRec expression narrower than the induction variable.

There are still a few related issues I know of: I think there's 
still an issue with the SCEVExpander expansion of AddRec in terms of
the width of the induction variable used.  The hack to avoid generating 
too-wide integers shouldn't be necessary; instead, the callers should be 
considering the cost of the expansion before expanding it (in addition 
to not expanding too-wide integers, we might not want to expand 
expressions that are really expensive, especially when optimizing for 
size; calculating an length-17 32-bit AddRec currently generates about 250 
instructions of straight-line code on X86).  Also, for long 32-bit 
AddRecs on X86, CodeGen really sucks at scheduling the code.  I'm planning on 
filing follow-up PRs for these issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:49:06 +00:00
Dan Gohman
6f498b0a8e Fix SDISel lowering of PHI nodes to use ComputeValueVTs.
This allows it to work correctly on aggregate values.
This fixes PR2623.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:42:46 +00:00
Dan Gohman
1f565bcff6 Fix SDISel lowering of zeroinitializer and undef to use ComputeValueVTs.
This allows it to work correctly on nested aggregate values.
This fixes PR2625.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 23:30:41 +00:00
Dale Johannesen
3b4c45203e Make sse2 explicit, for non-x86 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 20:16:33 +00:00
Dan Gohman
75dcf08243 Improve dagcombining for sext-loads and sext-in-reg nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 00:50:31 +00:00
Dan Gohman
90d33ee746 Don't look for leaf values to store when lowering stores of
empty structs. This fixes PR2612.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:36:51 +00:00
Dan Gohman
1053502486 I missed this file in r54223. movzbl is now used instead
of movzbw here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:23:34 +00:00
Dan Gohman
11ba3b1af6 Reapply r54147 with a constraint to only use the 8-bit
subreg form on x86-64, to avoid the problem with x86-32
having GPRs that don't have 8-bit subregs.

Also, change several 16-bit instructions to use 
equivalent 32-bit instructions. These have a smaller
encoding and avoid partial-register updates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:09:17 +00:00
Mon P Wang
e3b3a7241c Added support for overloading intrinsics (atomics) based on pointers
to different address spaces.  This alters the naming scheme for those
intrinsics, e.g., atomic.load.add.i32 => atomic.load.add.i32.p0i32


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 04:36:53 +00:00
Eli Friedman
1fbffe0cef Another SCEV issue from PR2607; essentially the same issue, but this
time applying to the implicit comparison in smin expressions. The 
correct way to transform an inequality into the opposite 
inequality, either signed or unsigned, is with a not expression.

I looked through the SCEV code, and I don't think there are any more 
occurrences of this issue.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 04:36:32 +00:00
Eli Friedman
068acc3caa Fix for PR2607: SCEV miscomputing the loop count for loops with an
SGT exit condition.  Essentially, the correct way to flip an inequality 
in 2's complement is the not operator, not the negation operator.  
That said, the difference only affects cases involving INT_MIN.

Also, enhance the pre-test search logic to be a bit smarter about 
inequalities flipped with a not operator, so it can eliminate the smax 
from the iteration count for simple loops.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 00:04:08 +00:00
Duncan Sands
68d4d1d49c Fix PR2609. If a label is deleted, then it needs
to be marked invalid regardless of whether it is
a debug, an exception handling or (hopefully) a
GC label.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 20:56:02 +00:00
Nate Begeman
5bc1ea0736 Add vector shifts to the IR, patch by Eli Friedman.
CodeGen & Clang work coming next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 15:49:41 +00:00
Matthijs Kooijman
75cf9cc527 Add -unroll-allow-partial command line option that enabled the loop unroller to
partially unroll a loop when fully unrolling would not fit under the threshold.

Patch by Mikael Lepistö.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 13:21:23 +00:00
Matthijs Kooijman
477f5a2f11 Restructure ArgumentPromotion a bit. Instead of just having a single boolean
that says "unconditional loads from this argument are safe", we now keep track
of the safety per set of indices from which loads happen. This prevents
ArgPromotion from promoting loads that aren't really valid. As an added effect,
this will now disregard the the type of the indices passed to a GEP, so
"load GEP %A, i32 1" and "load GEP %A, i64 1" will result in a single argument,
not two.

This fixes PR2598, for which a testcase has been added as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54159 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 10:00:13 +00:00
Dan Gohman
7ba145b0b4 Revert 54147.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 01:02:18 +00:00
Dan Gohman
b1e8cad61e Add x86 isel patterns to match what would be a ZERO_EXTEND_INREG operation,
which is represented in codegen as an 'and' operation. This matches them
with movz instructions, instead of leaving them to be matched by and
instructions with an immediate field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54147 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 22:18:25 +00:00
Duncan Sands
ecf4fa2744 Test this differently: I saw this test fail
because opt exited while llvm-as was still
writing to the pipe, causing it to get a
SIGPIPE.  It seems best to change things to
avoid the race altogether.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 19:09:01 +00:00
Dan Gohman
171f3dcff1 Fix a bashism in TestRunner.sh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 18:41:03 +00:00
Owen Anderson
8aa895b19a Add support for eliminating stores that store the same value that was just loaded.
This fixes PR2599.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-28 16:14:26 +00:00
Dan Gohman
6c4942641f Fix embedded CRLF characters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 18:37:58 +00:00
Nate Begeman
907f46a81f Fix test RUN line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 19:08:59 +00:00
Nate Begeman
fb8ead0c20 Disable mov{L, LP, HP, HLP, *DUP} shuffles for mmx
mmx needs its own fancy shuffle logic based on unpack; for now we get correct but awful code.

Also commit Mon Ping's VSETCC patch


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 19:05:58 +00:00
Dan Gohman
1f335e3139 This test needs -aggressive-remat enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54015 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 15:25:32 +00:00
Evan Cheng
d1b3da621b Teach ARM isLegalAddressingMode to handle unknown type without crashing. This fixes pr2589.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 00:55:17 +00:00
Dan Gohman
6d69ba8a69 Enable rematerialization of constants using AliasAnalysis::pointsToConstantMemory,
and knowledge of PseudoSourceValues. This unfortunately isn't sufficient to allow
constants to be rematerialized in PIC mode -- the extra indirection is a
complication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 00:02:30 +00:00
Dan Gohman
3eee6542f5 Put the LICM of constant GlobalVariables, introduced in r53945, under a
command-line option, and disable it by default. It introduced performance
regressions because CodeGen is currently not able to remat such loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 23:57:25 +00:00
Dan Gohman
5444c30723 Add target triples so these tests behave as expected on non-darwin hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 18:08:01 +00:00
Evan Cheng
982a05955a Fix a catastrophic PPC64 ABI bug: i32 operands which are passed in memory (all of the parameter registers are used) are loaded from sp offsets that were off by 4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53979 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 08:17:07 +00:00
Evan Cheng
2d58bfac59 New test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 00:22:05 +00:00
Chris Lattner
967948b4e2 "Allow LICM to sink or lift loads from constant memory. Also add a test
case for this.

This allows instructions like loads from global variables declared to
be constant to be moved out of loops."

Patch by Stefanus Du Toit!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53945 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 05:06:28 +00:00
Dan Gohman
fc74abfba5 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:34:11 +00:00
Evan Cheng
5e6ebaf4d1 Fix PR2485: do all 4-element SSE shuffles in max. of 2 shuffle instructions.
Based on patch by Nicolas Capens.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:22:17 +00:00
Duncan Sands
11e56cb4dc LegalizeTypes support for VSETCC. Fixes PR2575.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 23:54:03 +00:00
Evan Cheng
2925786765 Fix pr2566: incorrect assumption about bit_convert. It doesn't not have to output a vector value. Patch by Nicolas Capens!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 20:42:56 +00:00
Evan Cheng
52672b813e Fix PR2574: implement v2f32 scalar_to_vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53927 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 18:39:19 +00:00
Dan Gohman
1d8973b499 Add the PR number to the test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53880 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:50:25 +00:00
Dan Gohman
7375fbcbf2 Fix a bug in LSR's dead-PHI cleanup. If a PHI has a def-use chain that
leads into a cycle involving a different PHI, LSR got stuck running
around that cycle looking for the original PHI. To avoid this, keep
track of visited PHIs and stop searching if we see one more than once.
This fixes PR2570.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:45:02 +00:00
Wojciech Matyjewicz
de0f2382e4 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 15:55:14 +00:00
Bill Wendling
3180e20cda Fix for first part of PR2562. Generate the "pinsrw" instruction for inserts
into v4i16 vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 02:32:23 +00:00
Nick Lewycky
e637727bed XFAIL this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 15:52:06 +00:00
Wojciech Matyjewicz
5c779a46b0 While testing particular algorithms to compute loop iteration count the brute
force evaluation (ComputeIterationCountExhaustively) should be turned off.

It doesn't apply to trip-count2.ll because this file tests the brute force
evaluation.

The test for PR2364 (2008-05-25-NegativeStepToZero.ll) currently fails
showing that the patch for this bug doesn't work. I'll fix it in a few hours
with a patch for PR2088.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:26:15 +00:00
Anton Korobeynikov
33500e5882 Testcase for PR2549
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53785 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 06:31:12 +00:00
Duncan Sands
c3e26727c1 Softfloat support for FDIV. Patch by
Richard Pennington.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 21:18:48 +00:00
Dan Gohman
5a11abaf2c In the CBackend, use casts to force integer add, subtract, and
multiply to be done as unsigned, so that they have well defined
behavior on overflow. This fixes PR2408.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 18:43:12 +00:00
Evan Cheng
76a4d58998 Subreg live interval valno may not have a corresponding def machineinstr since it's less precise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:48:53 +00:00
Evan Cheng
d1718252b5 Add nounwind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53733 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:48:04 +00:00
Dan Gohman
e8be6c6391 Add a new function, ReplaceAllUsesOfValuesWith, which handles bulk
replacement of multiple values. This is slightly more efficient
than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically
could be optimized even further. However, an important property of this
new function is that it handles the case where the source value set and
destination value set overlap. This makes it feasible for isel to use
SelectNodeTo in many very common cases, which is advantageous because
SelectNodeTo avoids a temporary node and it doesn't require CSEMap
updates for users of values that don't change position.

Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to
handle operand lists more efficiently, and to correctly handle a number
of corner cases to which its new wider use exposes it.

This commit also includes a change to the encoding of post-isel opcodes
in SDNodes; now instead of being sandwiched between the target-independent
pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel
opcodes are now represented as negative values. This makes it possible
to test if an opcode is pre-isel or post-isel without having to know
the size of the current target's post-isel instruction set.

These changes speed up llc overall by 3% and reduce memory usage by 10%
on the InstructionCombining.cpp testcase with -fast and -regalloc=local.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53728 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:10:17 +00:00
Duncan Sands
79ada108dd LegalizeTypes support for what seems to be the
only missing ppc long double operations: FNEG
and FP_EXTEND.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53723 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:35:14 +00:00
Duncan Sands
f00e74f4d6 Turn LegalizeTypes back off again for the moment:
it is breaking Darwin bootstrap due to missing
functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:06:03 +00:00
Matthijs Kooijman
bc1f989e3c Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 11:59:53 +00:00
Chris Lattner
d137ab4783 Fix PR2553
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 06:07:20 +00:00
Duncan Sands
95db39a9de Add support for promoting and expanding AssertZext
and AssertSext.  Needed when passing huge integer
parameters with the zeroext or signext attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 16:03:07 +00:00
Duncan Sands
836b3e63bd Test passing of integer parameters for integers
of all sizes from i1 to i256.  The code is not
always that great, for example (x86)
        movw    %di, %ax
        movw    %ax, i17_s
where the store could be directly from %di.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 13:37:36 +00:00
Duncan Sands
8b5e62f0db Test codegen of loads and stores of all integer
sizes from i1 to i256.  The generated code is
like one huge bug report of things that the DAG
combiner fails to simplify!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 13:10:20 +00:00
Matthijs Kooijman
d8b4d60490 Add a few cases to instcombine's extractvalue testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53675 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 12:57:25 +00:00
Matthijs Kooijman
5f0028e211 Un-XFAIL multdeadretval, since instcombine now properly handles the mess deadargelim leaves behind :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 12:56:52 +00:00
Duncan Sands
7f1d8aeef6 Turn on LegalizeTypes by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 11:36:51 +00:00
Duncan Sands
17991c3234 The atomic.cmp.swap promotion logic is wrong: it
simply does the atomic.cmp.swap on the larger type,
which means it blows away whatever is sitting in
the bytes just after the memory location, i.e.
causes a buffer overflow.  This really requires
target specific code, which is why LegalizeTypes
doesn't try to handle this case generically.  The
existing (wrong) code in LegalizeDAG will go away
automatically once the type legalization code is
removed from LegalizeDAG so I'm leaving it there
for the moment.  Meanwhile, don't test for this
feature.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53669 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 08:09:48 +00:00
Evan Cheng
be8efa54b6 Fix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 07:28:14 +00:00
Matthijs Kooijman
b79d2a6bfa XFAIL the multdeadretval test for now, I will be fixing instcombine to make it work again tomorrow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53614 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 16:05:09 +00:00
Duncan Sands
295a7cddbd LegalizeTypes support for fabs on ppc long double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 15:02:44 +00:00
Matthijs Kooijman
790dd75b97 Remove a few tests which no longer hold for deadargelim (since it is now
allowed to canonicalize return values).

Add a test that checks if return value and function attributes are not removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53612 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:57:01 +00:00
Matthijs Kooijman
2439911ac5 Add a testcase for the canonicalizations now performed by deadargelim.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:42:58 +00:00
Matthijs Kooijman
eb32b453b3 Make deadargelim a bit less smart, so it doesn't choke on nested structs as
return values that are still (partially) live. Instead of updating all uses of
a call instruction after removing some elements, it now just rebuilds the
original struct (With undef gaps where the unused values were) and leaves it to
instcombine to clean this up.

The added testcase still fails currently, but this is due to instcombine which
isn't good enough yet. I will fix that part next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:03:10 +00:00
Matthijs Kooijman
ae15ddf61b Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 13:15:10 +00:00
Duncan Sands
c07e6e53f7 LegalizeTypes support for promotion of bswap.
In LegalizeDAG the value is zero-extended to
the new type before byte swapping.  It doesn't
matter how the extension is done since the new
bits are shifted off anyway after the swap, so
extend by any old rubbish bits.  This results
in the final assembler for the testcase being
one line shorter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:18:22 +00:00
Duncan Sands
8d56a6f4d8 LegalizeTypes support for promotion of SIGN_EXTEND_INREG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:14:24 +00:00
Chris Lattner
6157e383c4 Reimplement LinkFunctionProtos in terms of GetLinkageResult. This fixes
the second half of link-global-to-func.ll and causes some minor changes in
messages.

There are two TODOs here.  First, this causes a regression in 
2008-07-06-AliasWeakDest.ll, which is now failing (so I xfailed it).  Anton,
I would really appreciate it if you could take a look at this.  It should be
a matter of adding proper alias support to GetLinkageResult, and was probably
already a latent bug that would manifest with globals.

The second todo is to reimplement LinkAlias in the same pattern as 
function and global linking.  This should be pretty straight-forward for 
someone who knows aliases, but isn't a requirement for correctness.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 07:23:24 +00:00
Chris Lattner
d1ec48c641 implement linking of globals to functions, in one direction
(replacing a function with a global).  This is needed when building
llvm itself with LTO on darwin, because of the EXPLICIT_SYMBOL hack
in lib/system/DynamicLibrary.cpp.

Implementation of linking the other way will need to wait for a 
cleanup of LinkFunctionProtos.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 06:49:45 +00:00
Chris Lattner
bbedb0e408 Fix a bunch of bugs handling vector compare constant expressions, fixing
PR2317.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 05:17:31 +00:00
Chris Lattner
fdb19e5887 Fix PR2506 by being a bit more careful about reverse fact propagation when
disproving a condition.  This actually compiles the existing testcase
(udiv_select_to_select_shift) to:

define i64 @test(i64 %X, i1 %Cond) {
entry:
	%divisor1.t = lshr i64 %X, 3		; <i64> [#uses=1]
	%quotient2 = lshr i64 %X, 3		; <i64> [#uses=1]
	%sum = add i64 %divisor1.t, %quotient2		; <i64> [#uses=1]
	ret i64 %sum
}

instead of:

define i64 @test(i64 %X, i1 %Cond) {
entry:
	%quotient1.v = select i1 %Cond, i64 3, i64 4		; <i64> [#uses=1]
	%quotient1 = lshr i64 %X, %quotient1.v		; <i64> [#uses=1]
	%quotient2 = lshr i64 %X, 3		; <i64> [#uses=1]
	%sum = add i64 %quotient1, %quotient2		; <i64> [#uses=1]
	ret i64 %sum
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:15:52 +00:00
Chris Lattner
093a438502 Fix mishandling of the infinite loop case when merging two blocks. This
fixes PR2540.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 22:23:11 +00:00
Nick Lewycky
59cff12f88 Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 07:41:32 +00:00
Nick Lewycky
3ac9e109b2 Enhance analysis of srem.
Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an
'and' instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 05:04:38 +00:00
Evan Cheng
79a796c2b1 Fix PR2536: a nasty spiller bug. If a two-address instruction uses a register but the use portion of its live range is not part of its liveinterval, it must be defined by an implicit_def. In that case, do not spill the use. e.g.
8   %reg1024<def> = IMPLICIT_DEF
12  %reg1024<def> = INSERT_SUBREG %reg1024<kill>, %reg1025, 2

The live range [12, 14) are not part of the r1024 live interval since it's defined by an implicit def. It will not conflicts with live interval of r1025. Now suppose both registers are spilled, you can easily see a situation where both registers are reloaded before the INSERT_SUBREG and both target registers that would overlap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:56:02 +00:00
Duncan Sands
edfba7e707 Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was
copied to LegalizeTypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:54:57 +00:00
Nick Lewycky
4bf1e59819 Add another optimization from PR2330. Also catch some missing cases that are
similar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:20:53 +00:00
Bill Wendling
71ca353ae6 The frame address on an x86-64 box needs to be offset by -8, not -4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53450 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:18:52 +00:00
Chris Lattner
85b5eb0505 Fix folding of icmp's of i1 where the comparison is signed. The code
was using the algorithm for folding unsigned comparisons which is
completely wrong.  This has been broken since the signless types change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53444 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 04:20:58 +00:00
Chris Lattner
f299184565 Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, true)
This cause a regression in InstCombine/JavaCompare, which was doing the right
thing on accident.  To handle the missed case, generalize the comparisons based
on masked bits a little bit to handle comparisons against the max value. For 
example, we can now xform (slt i32 (and X, 4), 4) -> (setne i32 (and X, 4), 4)




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 04:09:09 +00:00
Chris Lattner
99672cb130 make this condition more precise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 03:54:57 +00:00
Chris Lattner
d15990189d Implement PR2538
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 00:30:06 +00:00
Bill Wendling
bbcec684e3 Put CPPBackend tests into their own directory and run them only if they're
supported.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 22:35:32 +00:00
Chris Lattner
85e7ac0353 Fix an altivec constant miscompilation that Duncan found through
his work on legalizetypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53410 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 16:33:38 +00:00
Matthijs Kooijman
d16918f843 Restructure dead argument elimination, try #3 :-)
Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.

The pass now looks properly inside returned structs, but only at the first
level (ie, not inside nested structs).

This version fixed a few more bugs and was cleaned up a bit. It now passes all
of LLVM's testing, and should still pass SPEC2006. There is still a minor bug
with regard to returning nested structs. Since there is currently nothing that
emits such IR, I will fix that in a seperate commit (partly because it requires
a non-trivial fix).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53400 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 10:24:08 +00:00
Nick Lewycky
5dcc41f5b3 Fix overzealous optimization. Thanks to Duncan Sands for pointing out my error!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 05:51:40 +00:00
Evan Cheng
331e2bd942 Fix for PR2472. Use movss to set lower 32-bits of a zero XMM vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53386 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 01:08:23 +00:00
Chris Lattner
fea85c46c0 Fix a case where vector comparison constant folding would cause an
infinite recursion.  part of PR2529


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 00:29:28 +00:00
Chris Lattner
330e7e4d25 elementwise comparison of vector constants was completely wrong. Fix
it for PR2529


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53380 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 00:08:17 +00:00
Anton Korobeynikov
091be59220 Testcase for PR2024
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53327 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 14:09:41 +00:00
Nick Lewycky
9ee863ecc0 Fold (a < 8) && (b < 8) into (a|b) < 8 for unsigned less or greater than.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53282 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 07:29:11 +00:00
Nick Lewycky
d1f77bf931 Fold ((1 << a) & 1) to (a == 0).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53276 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 05:20:13 +00:00
Chris Lattner
2782ed1f14 Fix a broken test. Neither load is eliminable without changing the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53273 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 05:01:02 +00:00
Nick Lewycky
b4d1bc989e Reduce x - y to -y when we know the 'x' part will get masked off anyways.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 04:32:37 +00:00
Devang Patel
a5e27f8028 If loop induction variable's start value is less then its exit value then do not split the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 00:12:01 +00:00
Dale Johannesen
62b9b6e38c Testcase for debug info from data-only files.
This one is x86-32-Darwin specific.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 21:57:56 +00:00
Chris Lattner
d038c27516 'Optimize' test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 18:33:33 +00:00
Chris Lattner
895860e27b new testcase for PR2496
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 17:18:05 +00:00
Duncan Sands
4a497a2757 Testcase for PR2520.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 10:11:36 +00:00
Chris Lattner
155a490258 Fix three bugs:
1) evaluate [v]fcmp true/false with undefs to true or false instead
   of undef.
2) fix vector comparisons with undef to return a vector result instead 
   of i1
3) fix vector comparisons with evaluatable results to return vector
   true/false instead of i1 true/false (PR2529)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 05:46:34 +00:00
Dan Gohman
95d110920e Refactor the tablegen DAGISelEmitter code for outputing calls to
getTargetNode and SelectNodeTo to reduce duplication, and to
make some of the getTargetNode code available to SelectNodeTo.
Use SelectNodeTo instead of getTargetNode in several new
interesting cases, as it mutates nodes in place instead of
creating new ones.

This triggers some scheduling behavior differences due to nodes
being presented to the scheduler in a different order. Some of the
arbitrary scheduling decisions it makes are now arbitrarily made
differently. This is visible in CodeGen/PowerPC/LargeAbsoluteAddr.ll,
where a trivial scheduling difference led to a trivial register
allocation difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53203 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 21:00:17 +00:00
Evan Cheng
1ce75dcbbc Fix two serious LSR bugs.
1. LSR runOnLoop is always returning false regardless if any transformation is made.
2. AddUsersIfInteresting can create new instructions that are added to DeadInsts. But there is a later early exit which prevents them from being freed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53193 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 19:51:32 +00:00
Anton Korobeynikov
7ab23c4297 Testcase for PR2463
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 23:33:40 +00:00
Anton Korobeynikov
e56ac813e6 Testcase for PR2146
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53155 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 23:03:46 +00:00
Nick Lewycky
b8cd6a49b5 Fix missed optimization opportunity when analyzing cast of mul and select.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53151 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 21:19:34 +00:00
Owen Anderson
9da02b844f Remove the ability for ADCE to remove unreachable blocks in loop nests, because, as Eli pointed out, SimplifyCFG already does this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 17:21:41 +00:00
Owen Anderson
77d76b7ef7 Add support to ADCE for pruning unreachable blocks. This addresses the final
part of PR2509.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:05:19 +00:00
Owen Anderson
f2aa160b35 A better fix for PR2503 that doesn't pessimize GVN in the presence of unreachable blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53032 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 17:20:16 +00:00