Commit Graph

22443 Commits

Author SHA1 Message Date
Evan Cheng 1973a46cd3 Re-apply 48911.
llvm-svn: 48977
2008-03-31 07:54:19 +00:00
Evan Cheng 73d7c3bfba The support for remat of instructions with a register operand is hackish, to say the least. Since the register operand guaranteed to be PIC base and that it is already live at all uses, we are making sure it will not be spilled after its uses are rematerialized for both performance and correctness reasons.
llvm-svn: 48976
2008-03-31 07:53:30 +00:00
Owen Anderson f28fc71c93 Fix a major bug in the DFS calculation. Thanks for Christopher Lamb for pointing this out.
llvm-svn: 48973
2008-03-31 01:39:20 +00:00
Nate Begeman f2b0b0eb17 Don't eliminate bitcast instructions that change the type of a pointer
llvm-svn: 48971
2008-03-31 00:22:16 +00:00
Duncan Sands 7d6c8ae488 Fix comment typo.
llvm-svn: 48967
2008-03-30 19:38:55 +00:00
Nick Lewycky 9fb8908457 Moved from PR1570.
llvm-svn: 48965
2008-03-30 19:07:11 +00:00
Chris Lattner 0f760dfe09 Fix "Control reaches the end of non-void function" warnings,
patch by David Chisnall.

llvm-svn: 48963
2008-03-30 18:22:13 +00:00
Chris Lattner 519a51a76f minor code cleanups, allow constant folding sinf/cosf.
llvm-svn: 48961
2008-03-30 18:02:00 +00:00
Evan Cheng 16d72072df Cosmetic changes.
llvm-svn: 48947
2008-03-29 18:34:22 +00:00
Chris Lattner 4311ad2dae change iterator invalidation avoidance to just move the iterator backward
when something changes, instead of moving forward.  This allows us to 
simplify memset lowering, inserting the memset at the end of the range of 
stuff we're touching instead of at the start.

This, in turn, allows us to make use of the addressing instructions already
used in the function instead of inserting our own.  For example, we now
codegen:

	%tmp41 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 0		; <i8*> [#uses=2]
	call void @llvm.memset.i64( i8* %tmp41, i8 -1, i64 8, i32 1 )

instead of:

	%tmp20 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 7		; <i8*> [#uses=1]
	%ptroffset = getelementptr i8* %tmp20, i64 -7		; <i8*> [#uses=1]
	call void @llvm.memset.i64( i8* %ptroffset, i8 -1, i64 8, i32 1 )

llvm-svn: 48940
2008-03-29 05:15:47 +00:00
Chris Lattner ac95515741 make the common case of a single store (which clearly shouldn't be turned
into a memset!) faster by avoiding an allocation of an std::list node.

llvm-svn: 48939
2008-03-29 04:52:12 +00:00
Chris Lattner d528b21a65 give form-memset a significantly more sane heuristic, enable it by default.
llvm-svn: 48937
2008-03-29 04:36:18 +00:00
Owen Anderson 8b22873bdd Remove some unneeded code for LiveInterval joining, and fix a bug in the Phi elimination algorithm where we were accidentally reasoning about
the source rather than the destination.

llvm-svn: 48936
2008-03-29 01:58:47 +00:00
Dan Gohman fd2eb00cc2 Fix a tokenfactor node to use the load chain rather than the
load value. This fixes PR2177.

llvm-svn: 48932
2008-03-28 23:45:16 +00:00
Evan Cheng b8654202dd Backing out 48911 for now. It's breaking stuff.
llvm-svn: 48922
2008-03-28 17:49:06 +00:00
Chris Lattner a148acdc82 ifdef out a dead function. Should this be removed?
llvm-svn: 48916
2008-03-28 15:36:27 +00:00
Duncan Sands 35c7cdac07 Rename getAnyLoad to getLoad is suggested by Evan.
llvm-svn: 48914
2008-03-28 09:45:24 +00:00
Evan Cheng 81e0c9a32c New entry.
llvm-svn: 48912
2008-03-28 07:07:06 +00:00
Evan Cheng 9ae4d7b719 Load from stub is already re-materializable.
llvm-svn: 48911
2008-03-28 06:49:25 +00:00
Nick Lewycky f88c84f690 Update example to new syntax.
llvm-svn: 48910
2008-03-28 06:46:51 +00:00
Chris Lattner d62964a7d8 make memset inference significantly more powerful: it can now handle
memsets that initialize "structs of arrays" and other store sequences
that are not sequential.  This is still only enabled if you pass 
-form-memset-from-stores.  The flag is not heavily tested and I haven't
analyzed the perf regressions when -form-memset-from-stores is passed
either, but this causes no make check regressions.

llvm-svn: 48909
2008-03-28 06:45:13 +00:00
Evan Cheng 87bac50d7b New entry.
llvm-svn: 48908
2008-03-28 06:34:23 +00:00
Duncan Sands f740509e58 Implement LegalizeTypes support for softfloat LOAD.
In order to handle indexed nodes I had to introduce
a new constructor, and since I was there I factorized
the code in the various load constructors.

llvm-svn: 48894
2008-03-27 20:23:40 +00:00
Dan Gohman cad51cb671 Avoid creating chain dependencies from CopyToReg nodes to load and store
nodes. This doesn't currently have much impact the generated code, but it
does produce simpler-looking SelectionDAGs, and consequently
simpler-looking ScheduleDAGs, because there are fewer spurious
dependencies.

In particular, CopyValueToVirtualRegister now uses the entry node as the
input chain dependency for new CopyToReg nodes instead of calling getRoot
and depending on the most recent memory reference.

Also, rename UnorderedChains to PendingExports and pull it up from being
a local variable in SelectionDAGISel::BuildSelectionDAG to being a
member variable of SelectionDAGISel, so that it doesn't have to be
passed around to all the places that need it.

llvm-svn: 48893
2008-03-27 19:56:19 +00:00
Devang Patel eb1e3fcbe0 PHI->removeIncomingValue may remove PHInode.
Increment iterator in advance.

llvm-svn: 48890
2008-03-27 17:32:46 +00:00
Roman Levenstein 30d09518b5 Fix spelling. Thanks, Duncan! :-)
llvm-svn: 48873
2008-03-27 09:44:37 +00:00
Roman Levenstein bc674501ba Speed-up the SumOfUnscheduledPredsOfSuccs by introducing a new function
called LimitedSumOfUnscheduledPredsOfSuccs. It terminates the computation
after a given treshold is reached. This new function is always faster, but
brings real wins only on bigger test-cases.

The old function SumOfUnscheduledPredsOfSuccs is left in-place for now and therefore a warning about an unused static function is produced.

llvm-svn: 48872
2008-03-27 09:14:57 +00:00
Evan Cheng 308e564693 Code clean up.
llvm-svn: 48856
2008-03-27 01:45:11 +00:00
Evan Cheng 29e62a59f3 Allow certain lea instructions to be rematerialized.
llvm-svn: 48855
2008-03-27 01:41:09 +00:00
Evan Cheng 4fb07c6500 Remove an unused command line option.
llvm-svn: 48854
2008-03-27 01:30:24 +00:00
Evan Cheng 5832410d77 Fix a memory bug: increment an iterator of a deleted machine instr.
llvm-svn: 48853
2008-03-27 01:27:25 +00:00
Erick Tryzelaar 8ac07c2834 Expose ExecutionEngine::getTargetData() to c and ocaml bindings.
llvm-svn: 48851
2008-03-27 00:27:14 +00:00
Dale Johannesen 87c6ada5de Fix a bug in Darwin EH: FDE->CIE pointer must
be relocatable.  Describe why .set is needed better.

llvm-svn: 48848
2008-03-26 23:31:39 +00:00
Evan Cheng db390694ff One more coalescer fix wrt deadness propagation.
llvm-svn: 48837
2008-03-26 20:15:49 +00:00
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