Commit Graph

22496 Commits

Author SHA1 Message Date
Evan Cheng
ed70cbb3f3 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 19:03:01 +00:00
Roman Levenstein
e326332acd 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. 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 12:39:26 +00:00
Roman Levenstein
8dba9afd08 Fixed some spelling errors. Thanks, Duncan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48819 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 11:23:38 +00:00
Roman Levenstein
e513ba4958 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 09:18:09 +00:00
Evan Cheng
7aae876db1 Fix some SSE4.1 instruction encoding bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48815 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 08:11:49 +00:00
Owen Anderson
d382f8a32d Dead PHI instructions need to be handled specially.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 03:03:23 +00:00
Dale Johannesen
27c31054ec 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48808 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 23:29:30 +00:00
Evan Cheng
e22e62b5c0 Smaller function alignment when optimizing for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:29:46 +00:00
Evan Cheng
2659343f04 Rename option -optimizefor-size to -optimize-size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48804 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:28:39 +00:00
Owen Anderson
e4ded8937a Remove some debugging code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:26:43 +00:00
Owen Anderson
403dad6660 StrongPHIElimination doesn't support swapping live intervals like the coalescer does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:25:27 +00:00
Dan Gohman
950a4c40b8 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:06:05 +00:00
Dan Gohman
cfbb2f074d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48800 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 21:45:14 +00:00
Dan Gohman
62c7b8c371 Avoid outputing spaces at the ends of lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48797 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 21:38:12 +00:00
Devang Patel
73ee9c3fb1 Do not align loops if optimizing for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 21:03:02 +00:00
Devang Patel
55c666a867 Add optimize-for-size knob.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 21:02:35 +00:00
Evan Cheng
26471c48b3 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 20:08:07 +00:00
Evan Cheng
d34af7875b 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 20:07:13 +00:00
Dan Gohman
cffbd2562a Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 17:10:29 +00:00
Dan Gohman
27845362d9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 16:53:19 +00:00
Bill Wendling
92e73d7628 Fix PR2062: Don't build Intrinsics.gen in the source directory. Do it in the
object directory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 09:12:48 +00:00
Evan Cheng
a2fb634def lastRegisterUse() should ignore identity copies. Those will be erased.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 02:02:19 +00:00
Evan Cheng
ea10046ebc Remove an unneeded test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48755 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 23:55:16 +00:00
Evan Cheng
066114555d Add \t after .set. Fix by Jay Freeman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48753 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 23:36:49 +00:00
Evan Cheng
6f83fc8afb If the coalescer commuted a def MI to allow coalescing, it can changed a previously coalesced copy into an non-identity copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48752 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 23:31:21 +00:00
Evan Cheng
af8c563e11 Add an assertion to catch register of illegal class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 23:28:21 +00:00
Bill Wendling
3e98c30cf5 Use the bit size of the operand instead of the hard-coded 32 to generate the
mask.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 23:16:37 +00:00
Evan Cheng
62a3f1538c - 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 21:52:23 +00:00
Owen Anderson
19cfd733e2 Revert r48676. I had plans for using it, but now it's just dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 21:29:58 +00:00
Owen Anderson
9a31444ee6 Remove #include<iostream>, which I was using for debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 20:36:47 +00:00
Devang Patel
60a12907c3 Add incoming value from header only if phi node has any use inside the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 20:16:14 +00:00
Dan Gohman
52837078c7 Shrink the size of AllocationInst by using its SubclassData
field to store the alignment value instead of haing a
separate field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48727 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 16:55:58 +00:00
Dan Gohman
4c931fc6e2 APIntify SelectionDAG's EXTRACT_ELEMENT code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48726 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 16:38:05 +00:00
Evan Cheng
8d84d5b62c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 06:37:48 +00:00
Evan Cheng
88ffdddcc4 Temporarily disabling memset forming optimization. Add an option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48720 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 05:28:38 +00:00
Owen Anderson
e46611e6bc 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48719 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 04:11:27 +00:00
Evan Cheng
b98a10e8a3 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 00:21:34 +00:00
Evan Cheng
3d5cd6118d Remove duplicated entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 22:56:07 +00:00
Gordon Henriksen
4733be3893 Objective Caml bindings for basic block, function, global, and arg iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 22:21:29 +00:00
Anton Korobeynikov
82818eb223 Minor typo fixes. Also add another FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 20:32:06 +00:00
Anton Korobeynikov
9e49f1bc58 Preserve calling convention during function cloning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 16:03:00 +00:00
Anton Korobeynikov
f8e7416632 Add license header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48707 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 14:53:18 +00:00
Anton Korobeynikov
231e964ad2 Add Win64 compilation callback. This allows easy examples to be JITed on Win64!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 14:44:32 +00:00
Anton Korobeynikov
8c27829514 Provide a JIT selector on win64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 13:43:47 +00:00
Anton Korobeynikov
c15b81ba17 Hack out the PIC mode on Win64 targets. This needs to be investigated later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 13:41:18 +00:00
Anton Korobeynikov
fd9d976d74 Code cleanup. Provide generic way of selecting JIT pointer bitwidth regardless
of compiler used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48702 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 13:40:45 +00:00
Anton Korobeynikov
6aeedfd0f5 Remove old-standing obsolete code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 12:32:54 +00:00
Anton Korobeynikov
2b4f780585 Honour built-in defines on win64 targets for automatically subtarget recognize.
Force stack alignment to 16 bytes on win targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 21:18:22 +00:00
Anton Korobeynikov
508f0fdb53 Recognize "windows" in target triple, not only "win32"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 21:12:53 +00:00
Anton Korobeynikov
1dcce2148d Add information about callee-saved registers on Win64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 21:04:01 +00:00