Commit Graph

22409 Commits

Author SHA1 Message Date
Evan Cheng 289ba4f335 Avoid commuting a def MI in order to coalesce a copy instruction away if any use of the same val# is a copy instruction that has already been coalesced.
llvm-svn: 48833
2008-03-26 19:03:01 +00:00
Roman Levenstein 358e04a185 Use a linked data structure for the uses lists of an SDNode, just like
LLVM Value/Use does and MachineRegisterInfo/MachineOperand does.
This allows constant time for all uses list maintenance operations.

The idea was suggested by Chris. Reviewed by Evan and Dan.
Patch is tested and approved by Dan.

On normal use-cases compilation speed is not affected. On very big basic
blocks there are compilation speedups in the range of 15-20% or even better. 

llvm-svn: 48822
2008-03-26 12:39:26 +00:00
Roman Levenstein 733a4d6e85 Fixed some spelling errors. Thanks, Duncan!
llvm-svn: 48819
2008-03-26 11:23:38 +00:00
Roman Levenstein 7e71b4baaf Some improvements related to the computation of isReachable.
This fixes Bugzilla #1835 (http://llvm.org/bugs/show_bug.cgi?id=1835).
This patched is reviewed by Tanya and Dan. Dan tested and approved it.

The reason for the bad performance of the old algorithm is that it is very naive and scans every
time all nodes of the DAG in the worst case.

This patch introduces  a new algorithm based on the paper "Online algorithms
for maintaining the topological order of a directed acyclic graph" by
David J.Pearce and Paul H.J.Kelly. This is the MNR algorithm. It has a
linear time worst-case and performs much better in most situations.

The paper can be found here:
http://fano.ics.uci.edu/cites/Document/Online-algorithms-for-maintaining-the-topological-order-of-a-directed-acyclic-graph.html

The main idea of the new algorithm is to compute the topological ordering of the SNodes in the
DAG and to maintain it even after DAG modifications. The topological ordering allows for very fast 
node reachability checks. 

Tests on very big  input files with tens of thousands of instructions in a BB indicate huge 
speed-ups (up to 10x compilation time improvement) compared to the old version.

llvm-svn: 48817
2008-03-26 09:18:09 +00:00
Evan Cheng 292063603e Fix some SSE4.1 instruction encoding bugs.
llvm-svn: 48815
2008-03-26 08:11:49 +00:00
Owen Anderson 5d2d1776e0 Dead PHI instructions need to be handled specially.
llvm-svn: 48811
2008-03-26 03:03:23 +00:00
Dale Johannesen ad6c23d5e9 Use ## for comment delimiter on darwin x86-32, so
llvm's output .s files will go through gcc -std=c99
without triggering preprocesser errors.  Approach
suggested by Daveed Vandevoorde.

llvm-svn: 48808
2008-03-25 23:29:30 +00:00
Evan Cheng ddc58ff92a Smaller function alignment when optimizing for size.
llvm-svn: 48805
2008-03-25 22:29:46 +00:00
Evan Cheng 88c44ef91f Rename option -optimizefor-size to -optimize-size.
llvm-svn: 48804
2008-03-25 22:28:39 +00:00
Owen Anderson 9f129318dc Remove some debugging code.
llvm-svn: 48803
2008-03-25 22:26:43 +00:00
Owen Anderson 1d46d45e35 StrongPHIElimination doesn't support swapping live intervals like the coalescer does.
llvm-svn: 48802
2008-03-25 22:25:27 +00:00
Dan Gohman c60c67fc37 Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman bdc24adaaf A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.

llvm-svn: 48800
2008-03-25 21:45:14 +00:00
Dan Gohman a7ba51f6ec Avoid outputing spaces at the ends of lines.
llvm-svn: 48797
2008-03-25 21:38:12 +00:00
Devang Patel 72cfe84f05 Do not align loops if optimizing for size.
llvm-svn: 48794
2008-03-25 21:03:02 +00:00
Devang Patel 246a52740b Add optimize-for-size knob.
llvm-svn: 48793
2008-03-25 21:02:35 +00:00
Evan Cheng df1690dc7c Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
llvm-svn: 48792
2008-03-25 20:08:07 +00:00
Evan Cheng 2b72c05992 Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
llvm-svn: 48791
2008-03-25 20:07:13 +00:00
Dan Gohman fd227e9c3a Fix typos.
llvm-svn: 48779
2008-03-25 17:10:29 +00:00
Dan Gohman 883cbfd0ba Add CMP32mr and friends to the load-unfolding table. Among
other things, this allows the scheduler to unfold a load operand
in the 2008-01-08-SchedulerCrash.ll testcase, so it now successfully
clones the comparison to avoid a pushf+popf.

llvm-svn: 48777
2008-03-25 16:53:19 +00:00
Bill Wendling 0ee1bd9588 Fix PR2062: Don't build Intrinsics.gen in the source directory. Do it in the
object directory.

llvm-svn: 48766
2008-03-25 09:12:48 +00:00
Evan Cheng 7d564c3b4a lastRegisterUse() should ignore identity copies. Those will be erased.
llvm-svn: 48759
2008-03-25 02:02:19 +00:00
Evan Cheng fe7610f37f Remove an unneeded test.
llvm-svn: 48755
2008-03-24 23:55:16 +00:00
Evan Cheng 50b536eef9 Add \t after .set. Fix by Jay Freeman.
llvm-svn: 48753
2008-03-24 23:36:49 +00:00
Evan Cheng 69a3f9c417 If the coalescer commuted a def MI to allow coalescing, it can changed a previously coalesced copy into an non-identity copy.
llvm-svn: 48752
2008-03-24 23:31:21 +00:00
Evan Cheng 6e225173c5 Add an assertion to catch register of illegal class.
llvm-svn: 48751
2008-03-24 23:28:21 +00:00
Bill Wendling 6306183df3 Use the bit size of the operand instead of the hard-coded 32 to generate the
mask.

llvm-svn: 48750
2008-03-24 23:16:37 +00:00
Evan Cheng 615488ab45 - SSE4.1 extractfps extracts a f32 into a gr32 register. Very useful! Not. Fix the instruction specification and teaches lowering code to use it only when the only use is a store instruction.
llvm-svn: 48746
2008-03-24 21:52:23 +00:00
Owen Anderson c905fe9407 Revert r48676. I had plans for using it, but now it's just dead code.
llvm-svn: 48743
2008-03-24 21:29:58 +00:00
Owen Anderson e2707768a4 Remove #include<iostream>, which I was using for debugging.
llvm-svn: 48739
2008-03-24 20:36:47 +00:00
Devang Patel a38f58aa5c Add incoming value from header only if phi node has any use inside the loop.
llvm-svn: 48738
2008-03-24 20:16:14 +00:00
Dan Gohman aa583d75b1 Shrink the size of AllocationInst by using its SubclassData
field to store the alignment value instead of haing a
separate field.

llvm-svn: 48727
2008-03-24 16:55:58 +00:00
Dan Gohman d8ea040c31 APIntify SelectionDAG's EXTRACT_ELEMENT code.
llvm-svn: 48726
2008-03-24 16:38:05 +00:00
Evan Cheng 3471ae8c5d Increasing the inline limit from (overly conservative) 200 to 300. Given each BB costs 20 and each instruction costs 5, 200 means a 4 BB function + 24 instructions (actually less because caller's size also contributes to it).
Furthermore, double the limit when more than 10% of the callee instructions are vector instructions. Multimedia kernels tend to love inlining.

llvm-svn: 48725
2008-03-24 06:37:48 +00:00
Evan Cheng 21a8e3d260 Temporarily disabling memset forming optimization. Add an option.
llvm-svn: 48720
2008-03-24 05:28:38 +00:00
Owen Anderson 200e57840e Be sure to remove intervals after we've joined them. Also, remove some duplicated code.
With this pass, StrongPHIElim can compile very simple testcases correctly.  There's still a ways
to go before it's ready for prime time, though.

llvm-svn: 48719
2008-03-24 04:11:27 +00:00
Evan Cheng c3cf9f872a Transform (zext (or (icmp), (icmp))) to (or (zext (cimp), (zext icmp))) if at least one of the (zext icmp) can be transformed to eliminate an icmp.
llvm-svn: 48715
2008-03-24 00:21:34 +00:00
Evan Cheng 58db865d6e Remove duplicated entries.
llvm-svn: 48714
2008-03-23 22:56:07 +00:00
Gordon Henriksen 07a45f4edb Objective Caml bindings for basic block, function, global, and arg iterators.
llvm-svn: 48711
2008-03-23 22:21:29 +00:00
Anton Korobeynikov 1fdd5e9133 Minor typo fixes. Also add another FIXME.
llvm-svn: 48710
2008-03-23 20:32:06 +00:00
Anton Korobeynikov d38b3fb127 Preserve calling convention during function cloning
llvm-svn: 48708
2008-03-23 16:03:00 +00:00
Anton Korobeynikov 17fb491469 Add license header
llvm-svn: 48707
2008-03-23 14:53:18 +00:00
Anton Korobeynikov 9f0e820fa3 Add Win64 compilation callback. This allows easy examples to be JITed on Win64!
llvm-svn: 48706
2008-03-23 14:44:32 +00:00
Anton Korobeynikov a347663762 Provide a JIT selector on win64
llvm-svn: 48704
2008-03-23 13:43:47 +00:00
Anton Korobeynikov 7574ead985 Hack out the PIC mode on Win64 targets. This needs to be investigated later.
llvm-svn: 48703
2008-03-23 13:41:18 +00:00
Anton Korobeynikov 4733e72a25 Code cleanup. Provide generic way of selecting JIT pointer bitwidth regardless
of compiler used.

llvm-svn: 48702
2008-03-23 13:40:45 +00:00
Anton Korobeynikov bd47269f13 Remove old-standing obsolete code.
llvm-svn: 48701
2008-03-23 12:32:54 +00:00
Anton Korobeynikov cec773d8e7 Honour built-in defines on win64 targets for automatically subtarget recognize.
Force stack alignment to 16 bytes on win targets.

llvm-svn: 48695
2008-03-22 21:18:22 +00:00
Anton Korobeynikov 07a789d2b5 Recognize "windows" in target triple, not only "win32"
llvm-svn: 48694
2008-03-22 21:12:53 +00:00
Anton Korobeynikov b86e0936f1 Add information about callee-saved registers on Win64
llvm-svn: 48692
2008-03-22 21:04:01 +00:00