1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
Commit Graph

4038 Commits

Author SHA1 Message Date
Chris Lattner
0b41a42411 Rewrite chain handling validation and input TokenFactor handling
stuff now that we don't care about emulating the old broken 
behavior of the old isel.  This eliminates the 
'CheckChainCompatible' check (along with IsChainCompatible) which
did an incorrect and inefficient scan *up* the chain nodes which
happened as the pattern was being formed and does the validation
at the end in HandleMergeInputChains when it forms a structural 
pattern.  This scans "down" the graph, which means that it is
quickly bounded by nodes already selected.  This also handles
token factors that get "trapped" in the dag.

Removing the CheckChainCompatible nodes also shrinks the 
generated tables by about 6K for X86 (down to 83K).

There are two pieces remaining before I can nuke PreprocessRMW:
1. I xfailed a test because we're now producing worse code in a 
   case that has nothing to do with the change: it turns out that
   our use of MorphNodeTo will leave dead nodes in the graph
   which (depending on how the graph is walked) end up causing
   bogus uses of chains and blocking matches.  This is really 
   bad for other reasons, so I'll fix this in a follow-up patch.

2. CheckFoldableChainNode needs to be improved to handle the TF.

llvm-svn: 97539
2010-03-02 02:22:10 +00:00
Dan Gohman
56a20fc5eb Fix several places to handle vector operands properly.
Based on a patch by Micah Villmow for PR6438.

llvm-svn: 97538
2010-03-02 02:14:38 +00:00
Bill Wendling
5990930d72 Remove dead parameter passing.
llvm-svn: 97536
2010-03-02 01:55:18 +00:00
Chris Lattner
53bd8b1717 remove dead code.
llvm-svn: 97529
2010-03-02 00:40:26 +00:00
Chris Lattner
e6f86e288c refactor some code out of OPC_EmitMergeInputChains into a
new helper function.

llvm-svn: 97525
2010-03-02 00:00:03 +00:00
Chris Lattner
4ecd0eb275 remove all but one version of SelectionDAG::MorphNodeTo
(the most general) the others are dead.

llvm-svn: 97511
2010-03-01 22:20:05 +00:00
Chris Lattner
b65ac4a796 Accelerate isel dispatch for tables that start with a top-level
OPC_SwitchOpcode to use a table lookup instead of having to go
through the interpreter for this.

llvm-svn: 97469
2010-03-01 18:47:11 +00:00
Dan Gohman
99c98139c7 Fix optimization of ISD::TRUNCATE on vector operands. Based on a patch
by Micah Villmow for PR6335.

llvm-svn: 97461
2010-03-01 17:59:21 +00:00
Chris Lattner
f62ad24616 some trivial microoptimizations.
llvm-svn: 97441
2010-03-01 07:43:08 +00:00
Chris Lattner
cdfa80eaaf eliminate the CheckMultiOpcodeMatcher code and have each
ComplexPattern at the root be generated multiple times, once
for each opcode they are part of.  This encourages factoring
because the opcode checks get treated just like everything
else in the matcher.

llvm-svn: 97439
2010-03-01 07:17:40 +00:00
Chris Lattner
8529ea0237 add a new OPC_SwitchOpcode which is semantically equivalent
to a scope where every child starts with a CheckOpcode, but
executes more efficiently.  Enhance DAGISelMatcherOpt to 
form it.

This also fixes a bug in CheckOpcode: apparently the SDNodeInfo
objects are not pointer comparable, we have to compare the
enum name.

llvm-svn: 97438
2010-03-01 06:59:22 +00:00
Chris Lattner
4408939f12 eliminate GetInt1/2
llvm-svn: 97426
2010-02-28 22:38:43 +00:00
Chris Lattner
afa7d2eacc hoist the new isel interpreter out of DAGISelHeader.h
(which gets #included into the middle of each 
target's DAGISel class) into a .cpp file where it is
only compiled once.

llvm-svn: 97425
2010-02-28 22:37:22 +00:00
Chris Lattner
61a0c6674e enhance the new isel to handle the 'node already exists'
case of MorphNodeTo directly.

llvm-svn: 97417
2010-02-28 21:36:14 +00:00
Chris Lattner
f6124c5583 simplify this code, return only ever has zero or one operands.
llvm-svn: 97408
2010-02-28 18:53:13 +00:00
Evan Cheng
94051bc37e Re-apply 97040 with fix. This survives a ppc self-host llvm-gcc bootstrap.
llvm-svn: 97310
2010-02-27 07:36:59 +00:00
Dale Johannesen
516867fd79 Move dbg_value generation to target-independent FastISel,
as X86 is currently the only FastISel target.  Per review.

llvm-svn: 97255
2010-02-26 20:01:55 +00:00
Dan Gohman
17447493ea Fix ExpandVectorBuildThroughStack for the case where the
operands are themselves vectors. Based on a patch by
Micah Villmow for PR6338.

llvm-svn: 97165
2010-02-25 20:30:49 +00:00
Dan Gohman
084112437d Revert r97064. Duncan pointed out that bitcasts are defined in
terms of store and load, which means bitcasting between scalar
integer and vector has endian-specific results, which undermines
this whole approach.

llvm-svn: 97137
2010-02-25 15:20:39 +00:00
Chris Lattner
5ca790deef clean up various VT manipulations, patch by Micah Villmow! PR6337
llvm-svn: 97072
2010-02-24 22:44:06 +00:00
Dan Gohman
424e8f22d0 Make getTypeSizeInBits work correctly for array types; it should return
the number of value bits, not the number of bits of allocation for in-memory
storage.

Make getTypeStoreSize and getTypeAllocSize work consistently for arrays and
vectors.

Fix several places in CodeGen which compute offsets into in-memory vectors
to use TargetData information.

This fixes PR1784.

llvm-svn: 97064
2010-02-24 22:05:23 +00:00
Chris Lattner
75062cedf7 convert cycle checker to smallptrset, add comments and make it
more elegant.

llvm-svn: 97059
2010-02-24 21:34:04 +00:00
Chris Lattner
fbafa903b5 revert david's patch which does not even build.
llvm-svn: 97057
2010-02-24 21:25:08 +00:00
David Greene
68c9ece3da Use a SmallPtrSet as suggested by Chris.
llvm-svn: 97056
2010-02-24 20:59:49 +00:00
Daniel Dunbar
24c99e027e Speculatively revert r97011, "Re-apply 96540 and 96556 with fixes.", again in
the hopes of fixing PPC bootstrap.

llvm-svn: 97040
2010-02-24 17:05:47 +00:00
Dan Gohman
c0c6077fed When forming SSE min and max nodes for UGE and ULE comparisons, it's
necessary to swap the operands to handle NaN and negative zero properly.

Also, reintroduce logic for checking for NaN conditions when forming
SSE min and max instructions, fixed to take into consideration NaNs and
negative zeros. This allows forming min and max instructions in more
cases.

llvm-svn: 97025
2010-02-24 06:52:40 +00:00
Chris Lattner
52a02205d8 Change the scheduler from adding nodes in allnodes order
to adding them in a determinstic order (bottom up from 
the root) based on the structure of the graph itself.

This updates tests for some random changes, interesting
bits: CodeGen/Blackfin/promote-logic.ll no longer crashes.
I have no idea why, but that's good right?

CodeGen/X86/2009-07-16-LoadFoldingBug.ll also fails, but
now compiles to have one fewer constant pool entry, making
the expected load that was being folded disappear.  Since it
is an unreduced mass of gnast, I just removed it.

This fixes PR6370

llvm-svn: 97023
2010-02-24 06:11:37 +00:00
Chris Lattner
b1b5df8a16 add node #'s to debug dumps.
llvm-svn: 97019
2010-02-24 04:24:44 +00:00
Evan Cheng
5787cd9349 Re-apply 96540 and 96556 with fixes.
llvm-svn: 97011
2010-02-24 01:42:31 +00:00
Chris Lattner
80c14ff96b make selectnodeto set the nodeid to -1. This makes it more akin to
creating a new node then replacing uses.

llvm-svn: 97000
2010-02-23 23:01:35 +00:00
Chris Lattner
f6e9f39042 fix a bug in findNonImmUse (used by IsLegalToFold) where nodes with
no id's would cause early exit allowing IsLegalToFold to return true
instead of false, producing a cyclic dag.

This was striking the new isel because it isn't using SelectNodeTo yet,
which theoretically is just an optimization.

llvm-svn: 96972
2010-02-23 19:32:27 +00:00
Chris Lattner
4d568129c4 Print node ID's in dumps and views if set.
llvm-svn: 96971
2010-02-23 19:31:18 +00:00
David Greene
dad0944642 Speed up cycle checking significantly by caching results.
llvm-svn: 96956
2010-02-23 17:37:50 +00:00
Duncan Sands
5d5cce2e19 Revert commits 96556 and 96640, because commit 96556 breaks the
dragonegg self-host build.  I reverted 96640 in order to revert
96556 (96640 goes on top of 96556), but it also looks like with
both of them applied the breakage happens even earlier.  The
symptom of the 96556 miscompile is the following crash:

  llvm[3]: Compiling AlphaISelLowering.cpp for Release build
  cc1plus: /home/duncan/tmp/tmp/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4982: void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*, llvm::SDNode*, llvm::SelectionDAG::DAGUpdateListener*): Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed.
  Stack dump:
  0.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN4llvm19AlphaTargetLowering14LowerOperationENS_7SDValueERNS_12SelectionDAGE'
  g++: Internal error: Aborted (program cc1plus)

This occurs when building LLVM using LLVM built by LLVM (via
dragonegg).  Probably LLVM has miscompiled itself, though it
may have miscompiled GCC and/or dragonegg itself: at this point
of the self-host build, all of GCC, LLVM and dragonegg were built
using LLVM.  Unfortunately this kind of thing is extremely hard
to debug, and while I did rummage around a bit I didn't find any
smoking guns, aka obviously miscompiled code.

Found by bisection.

r96556 | evancheng | 2010-02-18 03:13:50 +0100 (Thu, 18 Feb 2010) | 5 lines

Some dag combiner goodness:
Transform br (xor (x, y)) -> br (x != y)
Transform br (xor (xor (x,y), 1)) -> br (x == y)
Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"

r96640 | evancheng | 2010-02-19 01:34:39 +0100 (Fri, 19 Feb 2010) | 16 lines

Transform (xor (setcc), (setcc)) == / != 1 to
(xor (setcc), (setcc)) != / == 1.

e.g. On x86_64
  %0 = icmp eq i32 %x, 0
  %1 = icmp eq i32 %y, 0
  %2 = xor i1 %1, %0
  br i1 %2, label %bb, label %return
=>
	testl   %edi, %edi
	sete    %al
	testl   %esi, %esi
	sete    %cl
	cmpb    %al, %cl
	je      LBB1_2

llvm-svn: 96672
2010-02-19 11:30:41 +00:00
Evan Cheng
32031f7404 Transform (xor (setcc), (setcc)) == / != 1 to
(xor (setcc), (setcc)) != / == 1.

e.g. On x86_64
  %0 = icmp eq i32 %x, 0
  %1 = icmp eq i32 %y, 0
  %2 = xor i1 %1, %0
  br i1 %2, label %bb, label %return
=>
	testl   %edi, %edi
	sete    %al
	testl   %esi, %esi
	sete    %cl
	cmpb    %al, %cl
	je      LBB1_2

llvm-svn: 96640
2010-02-19 00:34:39 +00:00
Evan Cheng
9af06dfc83 Some dag combiner goodness:
Transform br (xor (x, y)) -> br (x != y)
Transform br (xor (xor (x,y), 1)) -> br (x == y)
Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"

llvm-svn: 96556
2010-02-18 02:13:50 +00:00
David Greene
d93fb1f15d Make the non-temporal bit "significant" in MemSDNodes so they aren't
CSE'd or otherwise combined with temporal MemSDNodes.

llvm-svn: 96505
2010-02-17 20:21:42 +00:00
Chris Lattner
955ce23e27 sink special case "cannotyetselect" for intrinsics out of the
tblgen splatted code into the implementation.

llvm-svn: 96460
2010-02-17 06:28:22 +00:00
Duncan Sands
1b33dd3c83 There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy().  Convert most instances of the first form to the second form.
Requested by Chris.

llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Evan Cheng
df9a8c9d49 Fix a memory leak. Patch by Nicolas Geoffray.
llvm-svn: 96295
2010-02-15 23:16:53 +00:00
Evan Cheng
b5fe25544c Split SelectionDAGISel::IsLegalAndProfitableToFold to
IsLegalToFold and IsProfitableToFold. The generic version of the later simply checks whether the folding candidate has a single use.

This allows the target isel routines more flexibility in deciding whether folding makes sense. The specific case we are interested in is folding constant pool loads with multiple uses.

llvm-svn: 96255
2010-02-15 19:41:07 +00:00
David Greene
4f983d569c Add non-temporal flags and remove an assumption of default arguments.
llvm-svn: 96240
2010-02-15 17:00:31 +00:00
Duncan Sands
2acaf3609c Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Jakob Stoklund Olesen
3aca1b0249 Use array_pod_sort instead of std::sort for improved code size.
Use SmallVector instead of std::vector for better speed when indirectbr has
few successors.

llvm-svn: 95879
2010-02-11 18:06:56 +00:00
Jakob Stoklund Olesen
215d9f3898 Remove duplicate successors from indirectbr instructions before building the machine CFG.
This makes early tail duplication run 60 times faster when compiling the Firefox
JavaScript interpreter, see PR6186.

llvm-svn: 95831
2010-02-11 00:34:18 +00:00
Mon P Wang
c17e781f35 The previous fix of widening divides that trap was too fragile as it depends on custom
lowering and requires that certain types exist in ValueTypes.h.  Modified widening to
check if an op can trap and if so, the widening algorithm will apply only the op on
the defined elements.  It is safer to do this in widening because the optimizer can't
guarantee removing unused ops in some cases.

llvm-svn: 95823
2010-02-10 23:37:45 +00:00
Dan Gohman
92b6122204 Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Evan Cheng
8bee7fb61d Now that ShrinkDemandedOps() is separated out from DAG combine. It sometimes leave some obvious nops which dag combine used to clean up afterwards e.g. (trunk (ext n)) -> n. Look for them and squash them.
llvm-svn: 95757
2010-02-10 02:17:34 +00:00
Evan Cheng
8c2662f96a Emit an error for illegal inline asm constraint (which uses illegal type) rather than asserting.
llvm-svn: 95746
2010-02-10 01:21:02 +00:00
Dale Johannesen
c9f253214e Fix comments to reflect renaming elsewhere.
llvm-svn: 95730
2010-02-10 00:11:11 +00:00