1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

534 Commits

Author SHA1 Message Date
Bill Wendling
4f61644d4c Propagate debug loc info for AND. Also clean up some comments.
llvm-svn: 63416
2009-01-30 20:43:18 +00:00
Bill Wendling
79d8e31a5a Propagate debug loc info in SimplifyBinOpWithSameOpcodeHands.
llvm-svn: 63411
2009-01-30 19:25:47 +00:00
Bill Wendling
4d923185fc Propagate debug loc info in SimplifyNodeWithTwoResults.
llvm-svn: 63376
2009-01-30 03:08:40 +00:00
Bill Wendling
7067a571ce Propagate debug loc info for MULHS.
llvm-svn: 63375
2009-01-30 03:00:18 +00:00
Bill Wendling
031d7dcfe2 Propagate debug loc info for SREM and UREM.
llvm-svn: 63374
2009-01-30 02:57:00 +00:00
Bill Wendling
f4506379ae Propagate debug loc info for UDIV.
llvm-svn: 63373
2009-01-30 02:55:25 +00:00
Bill Wendling
532bb33a10 Propagate debug loc info for SDIV.
llvm-svn: 63372
2009-01-30 02:52:17 +00:00
Bill Wendling
577589aa4a Forgot to propagate debug loc info here.
llvm-svn: 63371
2009-01-30 02:49:26 +00:00
Bill Wendling
ff10c16660 Propagate debug loc info for MUL.
llvm-svn: 63369
2009-01-30 02:45:56 +00:00
Bill Wendling
a7791b0e4e Propagate debug loc info in SUB.
llvm-svn: 63368
2009-01-30 02:42:10 +00:00
Bill Wendling
665afce822 Propagate debug loc info in ADDC and ADDE.
llvm-svn: 63367
2009-01-30 02:38:00 +00:00
Bill Wendling
1ad9d3d9d1 Propagate debug loc info in DAG combine's "ADD".
llvm-svn: 63366
2009-01-30 02:31:17 +00:00
Bill Wendling
030f0fced8 - Propagate debug loc info in combineSelectAndUse().
- Modify ReassociateOps so that the resulting SDValue is what the comment claims
  it is.

llvm-svn: 63365
2009-01-30 02:23:43 +00:00
Bill Wendling
31986c393f Propagate debug location info for the token factor.
llvm-svn: 63355
2009-01-30 01:13:16 +00:00
Bill Wendling
8165903969 Add DebugLoc propagation to some of the methods in DAG combiner.
llvm-svn: 63350
2009-01-30 00:45:56 +00:00
Dan Gohman
9d120d6d8f Make x86's BT instruction matching more thorough, and add some
dagcombines that help it match in several more cases. Add
several more cases to test/CodeGen/X86/bt.ll. This doesn't
yet include matching for BT with an immediate operand, it
just covers more register+register cases.

llvm-svn: 63266
2009-01-29 01:59:02 +00:00
Dan Gohman
bc43253a91 Make isOperationLegal do what its name suggests, and introduce a
new isOperationLegalOrCustom, which does what isOperationLegal
previously did.

Update a bunch of callers to use isOperationLegalOrCustom
instead of isOperationLegal. In some case it wasn't obvious
which behavior is desired; when in doubt I changed then to
isOperationLegalOrCustom as that preserves their previous
behavior.

This is for the second half of PR3376.

llvm-svn: 63212
2009-01-28 17:46:25 +00:00
Dan Gohman
0400e83ed8 Add an assertion to the form of SelectionDAG::getConstant that takes
a uint64_t to verify that the value is in range for the given type,
to help catch accidental overflow. Fix a few places that relied on
getConstant implicitly truncating the value.

llvm-svn: 63128
2009-01-27 20:39:34 +00:00
Dan Gohman
4abaebae0c Take the next steps in making SDUse more consistent with LLVM Use, and
tidy up SDUse and related code.
 - Replace the operator= member functions with a set method, like
   LLVM Use has, and variants setInitial and setNode, which take
   care up updating use lists, like LLVM Use's does. This simplifies
   code that calls these functions.
 - getSDValue() is renamed to get(), as in LLVM Use, though most
   places can either use the implicit conversion to SDValue or the
   convenience functions instead.
 - Fix some more node vs. value terminology issues.

Also, eliminate the one remaining use of SDOperandPtr, and
SDOperandPtr itself.

llvm-svn: 62995
2009-01-26 04:35:06 +00:00
Dan Gohman
c971f3cf5b Fold x-0 to x in unsafe-fp-math mode. This comes up in the
testcase from PR3376, and in fact is sufficient to completely
avoid the problem in that testcase.

There's an underlying problem though; TLI.isOperationLegal
considers Custom to be Legal, which might be ok in some
cases, but that's what DAGCombiner is using in many places
to test if something is legal when LegalOperations is true.
When DAGCombiner is running after legalize, this isn't
sufficient. I'll address this in a separate commit.

llvm-svn: 62860
2009-01-23 19:10:37 +00:00
Bob Wilson
d79e684d1e Fix a minor bug in DAGCombiner's folding of SELECT. Folding "select C, 0, 1"
to "C ^ 1" is only valid when C is known to be either 0 or 1.  Most of the
similar foldings in this function only handle "i1" types, but this one appears
intentionally written to handle larger integer types.  If C has an integer
type larger than "i1", this needs to check if the high bits of a boolean
are known to be zero.  I also changed the comment to describe this folding as
"C ^ 1" instead of "~C", since that is what the code does and since the latter
would only be valid for "i1" types.  The good news is that most LLVM targets
use TargetLowering::ZeroOrOneBooleanContent so this change will not disable
the optimization; the bad news is that I've been unable to come up with a
testcase to demonstrate the problem.

I have also removed a "FIXME" comment for folding "select C, X, 0" to "C & X",
since the code looks correct to me.  It could be made more aggressive by not
limiting the type to "i1", but that would then require checking for
TargetLowering::ZeroOrNegativeOneBooleanContent.  Similar changes could be
done for the other SELECT foldings, but it was decided to be not worth the
trouble and complexity (see e.g., r44663).

llvm-svn: 62790
2009-01-22 22:05:48 +00:00
Dan Gohman
a6e5948fce Don't create ISD::FNEG nodes after legalize if they aren't legal.
Simplify x+0 to x in unsafe-fp-math mode. This avoids a bunch of
redundant work in many cases, because in unsafe-fp-math mode,
ISD::FADD with a constant is considered free to negate, so the
DAGCombiner often negates x+0 to -0-x thinking it's free, when
in reality the end result is -x, which is more expensive than x.

Also, combine x*0 to 0.

This fixes PR3374.

llvm-svn: 62789
2009-01-22 21:58:43 +00:00
Bob Wilson
186046e657 Add SelectionDAG::getNOT method to construct bitwise NOT operations,
corresponding to the "not" and "vnot" PatFrags.  Use the new method
in some places where it seems appropriate.

llvm-svn: 62768
2009-01-22 17:39:32 +00:00
Dan Gohman
d021a20409 Simplify ReduceLoadWidth's logic: it doesn't need several different
special cases after producing the new reduced-width load, because the
new load already has the needed adjustments built into it. This fixes
several bugs due to the special cases, including PR3317.

llvm-svn: 62692
2009-01-21 15:17:51 +00:00
Dan Gohman
ff4c4ab39f Fix a dagcombine to not generate loads of non-round integer types,
as its comment says, even in the case where it will be generating
extending loads. This fixes PR3216.

llvm-svn: 62557
2009-01-20 01:06:45 +00:00
Dan Gohman
af4e583c93 Fix SelectionDAG::ReplaceAllUsesWith to behave correctly when
uses are added to the From node while it is processing From's
use list, because of automatic local CSE. The fix is to avoid
visiting any new uses.

Fix a few places in the DAGCombiner that assumed that after
a RAUW call, the From node has no users and may be deleted.

This fixes PR3018.

llvm-svn: 62533
2009-01-19 21:44:21 +00:00
Mon P Wang
27ea1af89f Simplify extract element based on comments from Duncan Sands.
llvm-svn: 62459
2009-01-18 06:43:40 +00:00
Mon P Wang
563134282c Simplify extract element of a scalar to vector.
llvm-svn: 62383
2009-01-17 00:07:25 +00:00
Dan Gohman
4dc9f47c97 Use the getNode() accessor instead of accessing the Node
member directly, which is private as of r55504.

llvm-svn: 62364
2009-01-16 21:47:21 +00:00
Chris Lattner
cfaf556999 new nodes should be added to the worklist, not old nodes.
llvm-svn: 62359
2009-01-16 21:15:56 +00:00
Dan Gohman
6fcee67989 Move a few containers out of ScheduleDAGInstrs::BuildSchedGraph
and into the ScheduleDAGInstrs class, so that they don't get
destructed and re-constructed for each block. This fixes a
compile-time hot spot in the post-pass scheduler.

To help facilitate this, tidy and do some minor reorganization
in the scheduler constructor functions.

llvm-svn: 62275
2009-01-15 19:20:50 +00:00
Dan Gohman
2a079de3f5 Fix a DAGCombiner abort on an invalid shift count constant. This fixes PR3250.
llvm-svn: 61613
2009-01-03 19:22:06 +00:00
Duncan Sands
190d6bc636 Fix PR3274: when promoting the condition of a BRCOND node,
promote from i1 all the way up to the canonical SetCC type.
In order to discover an appropriate type to use, pass
MVT::Other to getSetCCResultType.  In order to be able to
do this, change getSetCCResultType to take a type as an
argument, not a value (this is also more logical).

llvm-svn: 61542
2009-01-01 15:52:00 +00:00
Dale Johannesen
88e47fa0e4 Change comments so everybody can understand them, hopefully.
llvm-svn: 61405
2008-12-23 23:47:22 +00:00
Dale Johannesen
e1a3d2da49 Add another permutation where we should get rid of a-a.
llvm-svn: 61401
2008-12-23 23:01:27 +00:00
Dale Johannesen
425b44516f One more permutation of subtracting off a base value.
llvm-svn: 61361
2008-12-23 01:59:54 +00:00
Dale Johannesen
e348900657 A new dag combine; several permutations of this
are there under ADD, this one was missing.

llvm-svn: 61107
2008-12-16 22:13:49 +00:00
Bill Wendling
5d026e47c1 Redo the arithmetic with overflow architecture. I was changing the semantics of
ISD::ADD to emit an implicit EFLAGS. This was horribly broken. Instead, replace
the intrinsic with an ISD::SADDO node. Then custom lower that into an
X86ISD::ADD node with a associated SETCC that checks the correct condition code
(overflow or carry). Then that gets lowered into the correct X86::ADDOvf
instruction.

Similar for SUB and MUL instructions.

llvm-svn: 60915
2008-12-12 00:56:36 +00:00
Bill Wendling
060f17c854 Clarify FIXME.
llvm-svn: 60867
2008-12-11 01:26:44 +00:00
Mon P Wang
4448877ed7 Make fix for r60829 less conservative to allow the proper optimization for
vec_extract-sse4.ll.

llvm-svn: 60865
2008-12-11 00:26:16 +00:00
Bill Wendling
292263313b If ADD, SUB, or MUL have an overflow bit that's used, don't do transformation on
them. The DAG combiner expects that nodes that are transformed have one value
result.

llvm-svn: 60857
2008-12-10 22:36:00 +00:00
Mon P Wang
308879dcfc Fixed a bug when trying to optimize a extract vector element of a
bit convert that changes the number of elements of a shuffle.

llvm-svn: 60829
2008-12-10 03:59:02 +00:00
Dale Johannesen
c9123e12e3 One more transformation.
llvm-svn: 60432
2008-12-02 18:40:40 +00:00
Dale Johannesen
29fb1bf708 Add a few more transformations.
llvm-svn: 60391
2008-12-02 01:30:54 +00:00
Dale Johannesen
0d6dd4bdb9 Add a missing case in visitADD.
llvm-svn: 60137
2008-11-27 00:43:21 +00:00
Duncan Sands
9816d42357 If the type legalizer actually legalized anything
(this doesn't happen that often, since most code
does not use illegal types) then follow it by a
DAG combiner run that is allowed to generate
illegal operations but not illegal types.  I didn't
modify the target combiner code to distinguish like
this between illegal operations and illegal types,
so it will not produce illegal operations as well
as not producing illegal types.

llvm-svn: 59960
2008-11-24 14:53:14 +00:00
Duncan Sands
f9ea1124c9 Rename SetCCResultContents to BooleanContents. In
practice these booleans are mostly produced by SetCC,
however the concept is more general.

llvm-svn: 59911
2008-11-23 15:47:28 +00:00
Bill Wendling
3175516f94 - Move conversion of [SU]ADDO from DAG combiner into legalizer.
- Add "promote integer type" stuff to the legalizer for these nodes.

llvm-svn: 59847
2008-11-22 00:22:52 +00:00
Bill Wendling
6c369d3a6f Default to converting UADDO to the generic form that SADDO is converted to.
llvm-svn: 59801
2008-11-21 07:44:30 +00:00
Bill Wendling
e4815d4f45 Remove chains. Unnecessary.
llvm-svn: 59783
2008-11-21 02:22:59 +00:00