summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Teach DAG combiner to commute commutable binary nodes in order to achieve ↵Evan Cheng2008-03-221-0/+17
| | | | | | sdisel CSE. llvm-svn: 48673
* Check even more carefully before applying this DAGCombine transform.Christopher Lamb2008-03-201-13/+19
| | | | llvm-svn: 48580
* Fix this xform: (sra (shl X, m), result_size) -> (sign_extend (trunc (shl X, ↵Evan Cheng2008-03-201-1/+3
| | | | | | result_size - n - m))) llvm-svn: 48578
* Fix X86's isTruncateFree to not claim that truncate to i1 is free. This ↵Christopher Lamb2008-03-191-0/+25
| | | | | | fixes Bill's testcase that failed for r48491. llvm-svn: 48542
* Temporarily revert r48491. It's breaking test/CodeGen/X86/xorl.ll.Bill Wendling2008-03-181-26/+0
| | | | llvm-svn: 48510
* Target independent DAG transform to use truncate for field extraction + sign ↵Christopher Lamb2008-03-181-0/+26
| | | | | | extend on targets where this is profitable. Passes nightly on x86-64. llvm-svn: 48491
* More APInt-ification.Dan Gohman2008-03-131-54/+64
| | | | llvm-svn: 48344
* Clean up my own mess.Evan Cheng2008-03-121-7/+1
| | | | | | X86 lowering normalize vector 0 to v4i32. However DAGCombine can fold (sub x, x) -> 0 after legalization. It can create a zero vector of a type that's not expected (e.g. v8i16). We don't want to disable the optimization since leaving a (sub x, x) is really bad. Add isel patterns for other types of vector 0 to ensure correctness. It's highly unlikely to happen other than in bugpoint reduced test cases. llvm-svn: 48279
* Total brain cramp.Evan Cheng2008-03-121-1/+1
| | | | llvm-svn: 48274
* Somewhat better solution.Evan Cheng2008-03-101-3/+4
| | | | llvm-svn: 48170
* Give TargetLowering::getSetCCResultType() a parameter so that ISD::SETCC'sScott Michel2008-03-101-5/+5
| | | | | | | | return ValueType can depend its operands' ValueType. This is a cosmetic change, no functionality impacted. llvm-svn: 48145
* DohEvan Cheng2008-03-101-1/+2
| | | | llvm-svn: 48140
* Avoid creating BUILD_VECTOR of all zero elements of "non-normalized" type ↵Evan Cheng2008-03-101-0/+4
| | | | | | (e.g. v8i16 on x86) after legalizer. Instruction selection does not expect to see them. In all likelihood this can only be an issue in a bugpoint reduced test case. llvm-svn: 48136
* Rename isOperand() to isOperandOf() (and other similar methods). It always ↵Evan Cheng2008-03-041-9/+9
| | | | | | confuses me. llvm-svn: 47872
* Misc. APInt-ification in the DAGCombiner.Dan Gohman2008-03-031-17/+20
| | | | llvm-svn: 47869
* Convert SimplifyDemandedMask and ShrinkDemandedConstant to use APInt.Dan Gohman2008-02-271-5/+12
| | | | | | | | Change several cases in SimplifyDemandedMask that don't ever do any simplifying to reuse the logic in ComputeMaskedBits instead of duplicating it. llvm-svn: 47648
* Fix PR2096, a regression introduced with my patch last night. ThisChris Lattner2008-02-261-1/+1
| | | | | | also fixes cfrac, flops, and 175.vpr llvm-svn: 47605
* Fix isNegatibleForFree to not return true for ConstantFP nodes Chris Lattner2008-02-261-33/+47
| | | | | | | | | after legalize. Just because a constant is legal (e.g. 0.0 in SSE) doesn't mean that its negated value is legal (-0.0). We could make this stronger by checking to see if the negated constant is actually legal post negation, but it doesn't seem like a big deal. llvm-svn: 47591
* Convert MaskedValueIsZero and all its users to use APInt. Also addDan Gohman2008-02-251-28/+38
| | | | | | a SignBitIsZero function to simplify a common use case. llvm-svn: 47561
* Add explicit keywords.Dan Gohman2008-02-201-1/+1
| | | | llvm-svn: 47382
* Convert DAGCombiner to use the APInt form of ComputeMaskedBits.Dan Gohman2008-02-201-12/+13
| | | | llvm-svn: 47381
* Update gcc 4.3 warnings fix patch with recent head changesAnton Korobeynikov2008-02-201-8/+11
| | | | llvm-svn: 47368
* - When DAG combiner is folding a bit convert into a BUILD_VECTOR, it should ↵Evan Cheng2008-02-181-5/+8
| | | | | | | | check if it's essentially a SCALAR_TO_VECTOR. Avoid turning (v8i16) <10, u, u, u> to <10, 0, u, u, u, u, u, u>. Instead, simply convert it to a SCALAR_TO_VECTOR of the proper type. - X86 now normalize SCALAR_TO_VECTOR to (BIT_CONVERT (v4i32 SCALAR_TO_VECTOR)). Get rid of X86ISD::S2VEC. llvm-svn: 47290
* teach dag combiner how to eliminate MERGE_VALUES nodes.Chris Lattner2008-02-131-0/+14
| | | | llvm-svn: 47052
* Add a isBigEndian method to complement isLittleEndian.Duncan Sands2008-02-111-4/+4
| | | | llvm-svn: 46954
* Return "(c1 + c2)" instead of yet another ADD node (which made this aBill Wendling2008-02-101-1/+1
| | | | | | no-op). llvm-svn: 46922
* the world doesn't need my debugging code.Chris Lattner2008-02-031-1/+0
| | | | llvm-svn: 46678
* Change the 'global modification' APIs in SelectionDAG to take a newChris Lattner2008-02-031-117/+124
| | | | | | | | | | DAGUpdateListener object pointer instead of just returning a vector of deleted nodes. This makes the interfaces more efficient (no more allocating a vector [at least a malloc], filling it in, then walking it) and more clean. This also allows the client to be notified of nodes that are *changed* but not deleted. llvm-svn: 46677
* Factor the addressing mode and the load/store VT out of LoadSDNodeDan Gohman2008-01-301-26/+26
| | | | | | | | and StoreSDNode into their common base class LSBaseSDNode. Member functions getLoadedVT and getStoredVT are replaced with the common getMemoryVT to simplify code that will handle both loads and stores. llvm-svn: 46538
* Use empty() instead of comparing size() with zero.Dan Gohman2008-01-291-1/+1
| | | | llvm-svn: 46514
* Fix PowerPC/./2007-10-18-PtrArithmetic.llChris Lattner2008-01-271-7/+14
| | | | llvm-svn: 46424
* fix a crash on CodeGen/X86/vector-rem.llChris Lattner2008-01-271-4/+6
| | | | llvm-svn: 46422
* Implement some dag combines that allow doing fneg/fabs/fcopysign in integerChris Lattner2008-01-271-2/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | registers if used by a bitconvert or using a bitconvert. This allows us to avoid constant pool loads and use cheaper integer instructions when the values come from or end up in integer regs anyway. For example, we now compile CodeGen/X86/fp-in-intregs.ll to: _test1: movl $2147483648, %eax xorl 4(%esp), %eax ret _test2: movl $1065353216, %eax orl 4(%esp), %eax andl $3212836864, %eax ret Instead of: _test1: movss 4(%esp), %xmm0 xorps LCPI2_0, %xmm0 movd %xmm0, %eax ret _test2: movss 4(%esp), %xmm0 andps LCPI3_0, %xmm0 movss LCPI3_1, %xmm1 andps LCPI3_2, %xmm1 orps %xmm0, %xmm1 movd %xmm1, %eax ret bitconverts can happen due to various calling conventions that require fp values to passed in integer regs in some cases, e.g. when returning a complex. llvm-svn: 46414
* Infer alignment of loads and increase their alignment when we can tell they are Chris Lattner2008-01-261-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | from the stack. This allows us to compile stack-align.ll to: _test: movsd LCPI1_0, %xmm0 movapd %xmm0, %xmm1 *** andpd 4(%esp), %xmm1 andpd _G, %xmm0 addsd %xmm1, %xmm0 movl 20(%esp), %eax movsd %xmm0, (%eax) ret instead of: _test: movsd LCPI1_0, %xmm0 ** movsd 4(%esp), %xmm1 ** andpd %xmm0, %xmm1 andpd _G, %xmm0 addsd %xmm1, %xmm0 movl 20(%esp), %eax movsd %xmm0, (%eax) ret llvm-svn: 46401
* Fix some bugs in SimplifyNodeWithTwoResults where it would call deletenode to Chris Lattner2008-01-261-41/+31
| | | | | | | | | | delete a node even if it was not dead in some cases. Instead, just add it to the worklist. Also, make sure to use the CombineTo methods, as it was doing things that were unsafe: the top level combine loop could touch dangling memory. This fixes CodeGen/Generic/2008-01-25-dag-combine-mul.ll llvm-svn: 46384
* reduce indentationChris Lattner2008-01-251-42/+44
| | | | llvm-svn: 46377
* Add skeletal code to increase the alignment of loads and stores whenChris Lattner2008-01-251-0/+38
| | | | | | | we can infer it. This will eventually help stuff, though it doesn't do much right now because all fixed FI's have an alignment of 1. llvm-svn: 46349
* clarify a comment, thanks Duncan.Chris Lattner2008-01-241-2/+3
| | | | llvm-svn: 46313
* Fix this buggy transformation. Two observations:Chris Lattner2008-01-241-17/+8
| | | | | | | | | | | | 1. we already know the value is dead, so don't bother replacing it with undef. 2. The very case the comment describes actually makes the load live which asserts in deletenode. If we do the replacement and the node becomes live, just treat it as new. This fixes a failure on X86/2008-01-16-InvalidDAGCombineXform.ll with some local changes in my tree. llvm-svn: 46306
* The dag combiner is missing revisiting nodes that it really should, and thus ↵Chris Lattner2008-01-241-0/+5
| | | | | | | | | | leaving dead stuff around. This gets fed into the isel pass and causes certain foldings from happening because nodes have extraneous uses floating around. For example, if we turned foo(bar(x)) -> baz(x), we sometimes left bar(x) around. llvm-svn: 46305
* fold fp_round(fp_round(x)) -> fp_round(x).Chris Lattner2008-01-241-0/+9
| | | | llvm-svn: 46304
* This commit changes:Chris Lattner2008-01-171-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Legalize now always promotes truncstore of i1 to i8. 2. Remove patterns and gunk related to truncstore i1 from targets. 3. Rename the StoreXAction stuff to TruncStoreAction in TLI. 4. Make the TLI TruncStoreAction table a 2d table to handle from/to conversions. 5. Mark a wide variety of invalid truncstores as such in various targets, e.g. X86 currently doesn't support truncstore of any of its integer types. 6. Add legalize support for truncstores with invalid value input types. 7. Add a dag combine transform to turn store(truncate) into truncstore when safe. The later allows us to compile CodeGen/X86/storetrunc-fp.ll to: _foo: fldt 20(%esp) fldt 4(%esp) faddp %st(1) movl 36(%esp), %eax fstps (%eax) ret instead of: _foo: subl $4, %esp fldt 24(%esp) fldt 8(%esp) faddp %st(1) fstps (%esp) movl 40(%esp), %eax movss (%esp), %xmm0 movss %xmm0, (%eax) addl $4, %esp ret llvm-svn: 46140
* code cleanups, no functionality change.Chris Lattner2008-01-171-7/+9
| | | | llvm-svn: 46126
* * Introduce a new SelectionDAG::getIntPtrConstant methodChris Lattner2008-01-171-11/+25
| | | | | | | | | | | | | and switch various codegen pieces and the X86 backend over to using it. * Add some comments to SelectionDAGNodes.h * Introduce a second argument to FP_ROUND, which indicates whether the FP_ROUND changes the value of its input. If not it is safe to xform things like fp_extend(fp_round(x)) -> x. llvm-svn: 46125
* Fixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.Evan Cheng2008-01-161-6/+44
| | | | | | | | | | | | | | | | | | | | It's not safe to use the two value CombineTo variant to combine away a dead load. e.g. v1, chain2 = load chain1, loc v2, chain3 = load chain2, loc v3 = add v2, c Now we replace use of v1 with undef, use of chain2 with chain1. ReplaceAllUsesWith() will iterate through uses of the first load and update operands: v1, chain2 = load chain1, loc v2, chain3 = load chain1, loc v3 = add v2, c Now the second load is the same as the first load, SelectionDAG cse will ensure the use of second load is replaced with the first load. v1, chain2 = load chain1, loc v3 = add v1, c Then v1 is replaced with undef and bad things happen. llvm-svn: 46099
* Factor the ReachesChainWithoutSideEffects out of dag combiner into Chris Lattner2008-01-161-28/+1
| | | | | | | a public SDOperand::reachesChainWithoutSideEffects method. No functionality change. llvm-svn: 46050
* Make load->store deletion a bit smarter. This allows us to compile this:Chris Lattner2008-01-081-3/+33
| | | | | | | | | | | | | | | | | | | | | | void test(long long *P) { *P ^= 1; } into just: _test: movl 4(%esp), %eax xorl $1, (%eax) ret instead of code like this: _test: movl 4(%esp), %ecx xorl $1, (%ecx) movl 4(%ecx), %edx movl %edx, 4(%ecx) ret llvm-svn: 45762
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* make sure not to zap volatile stores, thanks a lot to Dale for noticing this!Chris Lattner2007-12-291-1/+2
| | | | llvm-svn: 45402
* don't fold fp_round(fp_extend(load)) -> fp_round(extload)Chris Lattner2007-12-291-0/+4
| | | | llvm-svn: 45400
OpenPOWER on IntegriCloud