Commit Graph

22678 Commits

Author SHA1 Message Date
Evan Cheng 7e4a55bc58 Be more careful with insert_subreg and extract_subreg where either source or destination operand has already been coalesced with another register that's defined by a insert_subreg or extract_subreg.
llvm-svn: 49843
2008-04-17 07:58:04 +00:00
Owen Anderson f9ae76d89c Make GVN able to remove unnecessary calls to read-only functions again.
llvm-svn: 49842
2008-04-17 05:36:50 +00:00
Bill Wendling 288ef83b8a Use correct name for method in comment.
llvm-svn: 49841
2008-04-17 05:20:39 +00:00
Dan Gohman 9752a8f3b4 Correct the SrcValue information in the Expand code for va_copy.
llvm-svn: 49839
2008-04-17 02:09:26 +00:00
Scott Michel 376acf4aaa Remove unused variable
llvm-svn: 49838
2008-04-17 01:30:44 +00:00
Evan Cheng c8c3a899c0 Fix a sub-register indice propagation bug.
llvm-svn: 49832
2008-04-17 00:06:42 +00:00
Scott Michel f66cb3696a Workaround for PR2207, in which pred_iterator assert gets triggered due to a
wee problem in Xcode 2.[45]/gcc 4.0.1.

llvm-svn: 49831
2008-04-16 23:46:39 +00:00
Evan Cheng 147cb764b5 Don't forget about sub-register indices when rematting instructions.
llvm-svn: 49830
2008-04-16 23:44:44 +00:00
Dale Johannesen c1279f5e4b Unbreak build on x86-64.
llvm-svn: 49822
2008-04-16 22:24:33 +00:00
Nicolas Geoffray a7557dfe71 Correlate stubs with functions in JIT: when emitting a stub, the JIT tells the memory manager which function
the stub will resolve.

llvm-svn: 49814
2008-04-16 20:46:05 +00:00
Evan Cheng 59aa126e48 After reading memory that's already freed.
llvm-svn: 49810
2008-04-16 20:24:25 +00:00
Nicolas Geoffray ae84bbdbed Infrastructure for getting the machine code size of a function and an instruction. X86, PowerPC and ARM are implemented
llvm-svn: 49809
2008-04-16 20:10:13 +00:00
Evan Cheng a15cee1036 Initialize X863DNowLevel.
llvm-svn: 49808
2008-04-16 19:03:02 +00:00
Evan Cheng 23f12757ed Fix PR2226. Avoid using uninitialized variables.
llvm-svn: 49807
2008-04-16 18:48:43 +00:00
Evan Cheng 8dc8a8d8af Empty basic block should have an empty range.
llvm-svn: 49800
2008-04-16 18:01:08 +00:00
Dale Johannesen 4675c4e7e7 Don't read off end of the input array.
llvm-svn: 49799
2008-04-16 17:31:41 +00:00
Roman Levenstein a3ee1a38a3 Ongoing work on improving the instruction selection infrastructure:
Rename SDOperandImpl back to SDOperand.
Introduce the SDUse class that represents a use of the SDNode referred by
an SDOperand. Now it is more similar to Use/Value classes.

Patch is approved by Dan Gohman.

llvm-svn: 49795
2008-04-16 16:15:27 +00:00
Evan Cheng e45b8f89c5 Rewrite LiveVariable liveness computation. The new implementation is much simplified. It eliminated the nasty recursive routines and removed the partial def / use bookkeeping. There is also potential for performance improvement by replacing the conservative handling of partial physical register definitions. The code is currently disabled until live interval analysis is taught of the name scheme.
This patch also fixed a couple of nasty corner cases.

llvm-svn: 49784
2008-04-16 09:46:40 +00:00
Evan Cheng 6c17773ccc Code clean up.
llvm-svn: 49783
2008-04-16 09:41:59 +00:00
Owen Anderson 57236b58f7 Major repairs to the post-dominators implementation. Patch from Florian Brandner!
llvm-svn: 49768
2008-04-16 04:21:16 +00:00
Dan Gohman d43d3beeb0 Add support for the form of the SSE41 extractps instruction that
puts its result in a 32-bit GPR.

llvm-svn: 49762
2008-04-16 02:32:24 +00:00
Dan Gohman 8c99ccaf96 Recreate the size SDNode instead of reusing the old one in the x86
memcpy lowering code; this ensures that the size node has the desired
result type. This fixes a regression from r49572 with @llvm.memcpy.i64
on x86-32.

llvm-svn: 49761
2008-04-16 01:32:32 +00:00
Evan Cheng e29e9774a4 Avoid read after free.
llvm-svn: 49760
2008-04-16 01:22:28 +00:00
Dan Gohman 3dd8ba6235 Remove X86_64SRet; it isn't used anymore.
llvm-svn: 49759
2008-04-16 00:24:30 +00:00
Dan Gohman 01a5d36d9d Add movd instructions to move from MMX registers
to 64-bit GPR registers on x86-64.

llvm-svn: 49757
2008-04-15 23:55:07 +00:00
Dan Gohman 82b6673c44 Fix the new scheduler assertion checks to work when
the scheduler has inserted no-ops. This fixes
the 2006-07-03-schedulers.ll regression on ppc32.

llvm-svn: 49747
2008-04-15 22:40:14 +00:00
Chuck Rose III c6a47e8a79 VisualStudio project files updated. #include <algorithm> added to make VisualStudio happy. Also had to undefine setjmp because of #include <csetjmp> turning setjmp into _setjmp in VisualStudio.
llvm-svn: 49743
2008-04-15 21:27:11 +00:00
Dale Johannesen 8fc8a272e0 Don't assume a tail call can't reference a byval
argument to the outer function, this isn't correct.

llvm-svn: 49731
2008-04-15 17:41:34 +00:00
Dan Gohman 53d3241b52 Use gv's --spartan option, which trades away an extra row of UI buttons
for more space for displaying the graph.

llvm-svn: 49730
2008-04-15 17:27:05 +00:00
Nicolas Geoffray 7000c8f1aa Change Divided flag to Split, as suggested by Evan
llvm-svn: 49715
2008-04-15 08:08:50 +00:00
Dan Gohman 4370f26750 Treat EntryToken nodes as "passive" so that they aren't added to the
ScheduleDAG; they don't correspond to any actual instructions so they
don't need to be scheduled.

This fixes a bug where the EntryToken was being scheduled multiple
times in some cases, though it ended up not causing any trouble because 
EntryToken doesn't expand into anything. With this fixed the schedulers
reliably schedule the expected number of units, so we can check this
with an assertion.

This requires a tweak to test/CodeGen/X86/loop-hoist.ll because it
ends up getting scheduled differently in a trivial way, though it was
enough to fool the prcontext+grep that the test does.

llvm-svn: 49701
2008-04-15 01:22:18 +00:00
Dan Gohman e5f21cea3e In -view-sunit-dags, display "special" chain dependencies as cyan
instead of blue to distinguish them from regular dependencies.

llvm-svn: 49696
2008-04-14 23:15:07 +00:00
Dan Gohman 4fff979a43 Remove unnecessary <sstream> includes.
llvm-svn: 49681
2008-04-14 20:40:47 +00:00
Dan Gohman 5b61a288a7 Avoid creating MERGE_VALUES nodes for single values.
llvm-svn: 49676
2008-04-14 18:43:25 +00:00
Dan Gohman 2cd8e38ab9 Teach AliasSetTracker about VAArgInst.
llvm-svn: 49674
2008-04-14 18:34:50 +00:00
Dan Gohman e36714c0b4 Minor whitespace and comment cleanups.
llvm-svn: 49671
2008-04-14 18:26:16 +00:00
Dan Gohman 5e6ce7bb33 In the special case, call the comparison function instead of
manually performing the comparison. This allows the special
case to work correctly even in the case where someone is
experimenting with a different comparison function :-).

llvm-svn: 49670
2008-04-14 18:23:56 +00:00
Dan Gohman 2505d86783 Fix const-correctness issues with the SrcValue handling in the
memory intrinsic expansion code.

llvm-svn: 49666
2008-04-14 17:55:48 +00:00
Dale Johannesen 876224b1e8 Reverse sense of unwind-tables option. This means
stack tracebacks on Darwin x86-64 won't work by default;
nevertheless, everybody but me thinks this is a good idea.

llvm-svn: 49663
2008-04-14 17:54:17 +00:00
Owen Anderson 7629b71dd4 Revert r49614. As Dan pointed out, some of these aren't correct.
llvm-svn: 49657
2008-04-14 17:38:21 +00:00
Nicolas Geoffray db0ea1ff4e Fix /test/CodeGen/PowerPC/big-endian-actual-args.ll for linux/ppc32
llvm-svn: 49652
2008-04-14 17:17:14 +00:00
Dan Gohman 19bce7f18c VAArg may trap.
llvm-svn: 49646
2008-04-14 15:07:08 +00:00
Duncan Sands 6c503f9a65 Initial libcall support for LegalizeTypes. This is
much simpler than in LegalizeDAG because calls are
not yet expanded into call sequences: that happens
after type legalization has finished.

llvm-svn: 49634
2008-04-14 06:48:48 +00:00
Chris Lattner cc9709cff4 add a new CallGraphNode::removeCallEdgeFor method, tidy some comments.
llvm-svn: 49617
2008-04-13 19:41:25 +00:00
Owen Anderson 1f6fbc4bc3 Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2),
which is significantly more efficient.

llvm-svn: 49614
2008-04-13 19:15:17 +00:00
Duncan Sands 0a8a4c4a0c LegalizeTypes can sometimes have deleted nodes
in its maps.  Add some sanity checks that catch
this kind of thing.  Hopefully these can be
removed one day (once all problems are fixed!)
but for the moment it seems wise to have them in.

llvm-svn: 49612
2008-04-13 16:04:03 +00:00
Nicolas Geoffray dcc2eda5fc Add a divided flag for the first piece of an argument divided into mulitple parts. Fixes PR1643
llvm-svn: 49611
2008-04-13 13:40:22 +00:00
Chris Lattner 4d232bccca Fix some serious logic errors that broke the jit on darwin/x86-64.
llvm-svn: 49606
2008-04-13 07:04:56 +00:00
Duncan Sands a07136ee2d Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder.  Patch by Dominic Hamon.

llvm-svn: 49604
2008-04-13 06:22:09 +00:00
Chris Lattner a0a58b63f7 Gabor points out that reserveOperandSpace takes # of values,
not # of operands as an input.

llvm-svn: 49599
2008-04-13 00:14:42 +00:00
Anton Korobeynikov b9f38f38fa Provide option for stack alignment override
llvm-svn: 49593
2008-04-12 22:12:22 +00:00
Arnold Schwaighofer 634fc9a33a This patch corrects the handling of byval arguments for tailcall
optimized x86-64 (and x86) calls so that they work (... at least for
my test cases).

Should fix the following problems:

Problem 1: When i introduced the optimized handling of arguments for
tail called functions (using a sequence of copyto/copyfrom virtual
registers instead of always lowering to top of the stack) i did not
handle byval arguments correctly e.g they did not work at all :).

Problem 2: On x86-64 after the arguments of the tail called function
are moved to their registers (which include ESI/RSI etc), tail call
optimization performs byval lowering which causes xSI,xDI, xCX
registers to be overwritten. This is handled in this patch by moving
the arguments to virtual registers first and after the byval lowering
the arguments are moved from those virtual registers back to
RSI/RDI/RCX.

llvm-svn: 49584
2008-04-12 18:11:06 +00:00
Duncan Sands 844d55a42a Factor some libcall code.
llvm-svn: 49583
2008-04-12 17:14:18 +00:00
Dan Gohman 544ab2c50b Drop ISD::MEMSET, ISD::MEMMOVE, and ISD::MEMCPY, which are not Legal
on any current target and aren't optimized in DAGCombiner. Instead
of using intermediate nodes, expand the operations, choosing between
simple loads/stores, target-specific code, and library calls,
immediately.

Previously, the code to emit optimized code for these operations
was only used at initial SelectionDAG construction time; now it is
used at all times. This fixes some cases where rep;movs was being
used for small copies where simple loads/stores would be better.

This also cleans up code that checks for alignments less than 4;
let the targets make that decision instead of doing it in
target-independent code. This allows x86 to use rep;movs in
low-alignment cases.

Also, this fixes a bug that resulted in the use of rep;stos for
memsets of 0 with non-constant memory size when the alignment was
at least 4. It's better to use the library in this case, which
can be significantly faster when the size is large.

This also preserves more SourceValue information when memory
intrinsics are lowered into simple loads/stores.

llvm-svn: 49572
2008-04-12 04:36:06 +00:00
Dan Gohman 8c7cf88f7e Fix a bug that prevented x86-64 from using rep.movsq for
8-byte-aligned data.

llvm-svn: 49571
2008-04-12 02:35:39 +00:00
Nate Begeman 7417348a7e 80 col fix
llvm-svn: 49569
2008-04-12 00:47:57 +00:00
Nate Begeman 4840515dff Restore code to disable crash catcher on older OS X systems
llvm-svn: 49568
2008-04-12 00:47:46 +00:00
Evan Cheng 213ea6b276 Add debugging code.
llvm-svn: 49566
2008-04-12 00:22:01 +00:00
Chris Lattner ad281e8e19 Reenable JIT symbol table.
llvm-svn: 49548
2008-04-11 18:11:56 +00:00
Evan Cheng 305d268ac3 Do not add empty live intervals to handled_. They should never be undone for backtracking.
llvm-svn: 49544
2008-04-11 17:55:47 +00:00
Evan Cheng 33281864c1 If a PHI node has a single implicit_def source, replace it with an implicit_def instead of a copy.
llvm-svn: 49543
2008-04-11 17:54:45 +00:00
Evan Cheng 499ffa9055 Use of implicit_def is not part of live interval. Create empty intervals for the uses when the live interval is being spilled.
llvm-svn: 49542
2008-04-11 17:53:36 +00:00
Gabor Greif c422383e08 detabify
llvm-svn: 49524
2008-04-11 09:34:57 +00:00
Owen Anderson 1e73f29a7f Fix PR2213 by simultaneously making GVN more aggressive with the return values
of calls and less aggressive with non-readnone calls.

llvm-svn: 49516
2008-04-11 05:11:49 +00:00
Evan Cheng c6864b6652 Remove implicit_def instructions that become dead as result of coalescing.
llvm-svn: 49513
2008-04-10 23:48:35 +00:00
Evan Cheng 2cb98eb4bb Allow registers defined by implicit_def to be clobbered.
llvm-svn: 49512
2008-04-10 23:47:53 +00:00
Dan Gohman 9b5ffc8408 Fix a typo in a comment.
llvm-svn: 49504
2008-04-10 23:02:38 +00:00
Owen Anderson 53336d8055 Fix for PR2190. Memdep's non-local caching was checking dirtied blocks in the
wrong order.

llvm-svn: 49499
2008-04-10 22:13:32 +00:00
Dan Gohman f4bc782495 Make several symbols static.
llvm-svn: 49496
2008-04-10 21:11:47 +00:00
Dan Gohman 99b7b3f03b Teach InstCombine's ComputeMaskedBits to handle pointer expressions
in addition to integer expressions. Rewrite GetOrEnforceKnownAlignment
as a ComputeMaskedBits problem, moving all of its special alignment
knowledge to ComputeMaskedBits as low-zero-bits knowledge.

Also, teach ComputeMaskedBits a few basic things about Mul and PHI
instructions.

This improves ComputeMaskedBits-based simplifications in a few cases,
but more noticeably it significantly improves instcombine's alignment
detection for loads, stores, and memory intrinsics.

llvm-svn: 49492
2008-04-10 18:43:06 +00:00
Evan Cheng 16ea87d6ee A copy instruction may use a register multiple times on some targets. Change them all.
llvm-svn: 49491
2008-04-10 18:38:47 +00:00
Evan Cheng 5e1971c894 Add comment.
llvm-svn: 49469
2008-04-10 08:03:14 +00:00
Chris Lattner aeb23a8a34 add a note, this is actually not too bad to implement.
llvm-svn: 49466
2008-04-10 05:54:50 +00:00
Chris Lattner c692188075 move the x86-32 part of PR2108 here.
llvm-svn: 49465
2008-04-10 05:37:47 +00:00
Chris Lattner ad75302497 Fix the x86-64 side of PR2108 by adding a v2f64 version of
MOVZQI2PQIrr.  This would be better handled as a dag combine 
(with the goal of eliminating the bitconvert) but I don't know
how to do that safely.  Thoughts welcome.

llvm-svn: 49463
2008-04-10 05:13:43 +00:00
Evan Cheng 9d339849ee Teach branch folding pass about implicit_def instructions. Unfortunately we can't just eliminate them since register scavenger expects every register use to be defined. However, we can delete them when there are no intra-block uses. Carefully removing some implicit def's which enable more blocks to be optimized away.
llvm-svn: 49461
2008-04-10 02:32:10 +00:00
Chris Lattner a29d2536aa Disable an xform we've had for a long time, pow(x,0.5) -> sqrt.
This is not safe for all inputs.

llvm-svn: 49458
2008-04-10 02:07:51 +00:00
Evan Cheng c8eeb752a3 - More aggressively coalescing away copies whose source is defined by an implicit_def.
- Added insert_subreg coalescing support.

llvm-svn: 49448
2008-04-09 20:57:25 +00:00
Dan Gohman 33b3300178 Make isVectorClearMaskLegal's operand list const.
llvm-svn: 49446
2008-04-09 20:09:42 +00:00
Dan Gohman 3d074a3125 Add XMM1 as a second return value register for f32 and f64 on x86-64. This
is needed for the x86-64-ABI handling of structs that contain floating-point
members that are returned by value.

llvm-svn: 49441
2008-04-09 17:54:37 +00:00
Dan Gohman cbf87313a2 Add DX as a second return value register for i16 on x86.
llvm-svn: 49440
2008-04-09 17:53:38 +00:00
Chris Lattner 802134fc02 Generalize getUnaryFloatFunction to handle any FP unary function, automatically
figuring out the suffix to use.  implement pow(2,x) -> exp2(x).

llvm-svn: 49437
2008-04-09 17:48:11 +00:00
Chris Lattner cca74e5ab9 use the new ConstantFP::get method to make this work with
long double and simplify the code.

llvm-svn: 49435
2008-04-09 17:17:35 +00:00
Devang Patel a7dfbc0366 Be conservative if getresult operand is neither call nor invoke.
llvm-svn: 49430
2008-04-09 15:58:24 +00:00
Owen Anderson ef9a6fd5c2 Factor a bunch of functionality related to memcpy and memset transforms out of
GVN and into its own pass.

llvm-svn: 49419
2008-04-09 08:23:16 +00:00
Owen Anderson 8ee792d1b6 Remove accidentally duplicated code.
llvm-svn: 49418
2008-04-09 07:55:01 +00:00
Chris Lattner 98bd939af8 add a simplified accessor for creating an fp constant of a
particular value but variable type.

llvm-svn: 49416
2008-04-09 06:38:30 +00:00
Evan Cheng aa3b55f842 Missed a hasInterval check.
llvm-svn: 49415
2008-04-09 01:30:15 +00:00
Chris Lattner b5b3e3136b add a version of ConstantFP::get that doesn't take a redundant Type* value,
start migrating code over to use it.

llvm-svn: 49413
2008-04-09 00:45:01 +00:00
Chris Lattner b859fb49ed many cleanups to the pow optimizer. Allow it to handle powf,
add support for  pow(x, 2.0) -> x*x.

llvm-svn: 49411
2008-04-09 00:07:45 +00:00
Dale Johannesen 4c0c018bc5 Rename -disable-required-unwind-tables to unwind-tables-optional.
llvm-svn: 49389
2008-04-08 18:07:49 +00:00
Duncan Sands 57d3a36386 Convenience method for setting the nounwind
attribute for a function.

llvm-svn: 49373
2008-04-08 07:23:58 +00:00
Devang Patel 8cd2a3ae2a Fix insert point handling for multiple return values.
llvm-svn: 49367
2008-04-08 02:24:08 +00:00
Dale Johannesen fe767621ca Handle the situation in 2008-01-25-EmptyFunction.ll
correctly when unwind info is being generated.

llvm-svn: 49366
2008-04-08 00:37:56 +00:00
Dale Johannesen 344aec2952 Implement new llc flag -disable-required-unwind-tables.
Corresponds to -fno-unwind-tables (usually default in gcc).

llvm-svn: 49361
2008-04-08 00:10:24 +00:00
Ted Kremenek a518bb79b1 Make getDirnameSep a static method (not part of Path's interface).
llvm-svn: 49354
2008-04-07 22:01:32 +00:00
Ted Kremenek c042bf1db5 Added method Path::getDirname().
llvm-svn: 49352
2008-04-07 21:53:57 +00:00
Dan Gohman 3bc3ddd638 Rename MemOperand to MachineMemOperand. This was suggested by
review feedback from Chris quite a while ago. No functionality
change.

llvm-svn: 49348
2008-04-07 19:35:22 +00:00
Owen Anderson ed92b41a39 Add operator= implementations to SparseBitVector, allowing it to be used in GVN. This results
in both time and memory savings for GVN.  For example, one testcase went from 10.5s to 6s with
this patch.

llvm-svn: 49345
2008-04-07 17:38:23 +00:00
Daniel Berlin b646062ad5 Fix PR 2169.
llvm-svn: 49339
2008-04-07 14:20:50 +00:00