summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Sometimes (rarely) nodes held in LegalizeTypesDuncan Sands2008-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | maps can be deleted. This happens when RAUW replaces a node N with another equivalent node E, deleting the first node. Solve this by adding (N, E) to ReplacedNodes, which is already used to remap nodes to replacements. This means that deleted nodes are being allowed in maps, which can be delicate: the memory may be reused for a new node which might get confused with the old deleted node pointer hanging around in the maps, so detect this and flush out maps if it occurs (ExpungeNode). The expunging operation is expensive, however it never occurs during a llvm-gcc bootstrap or anywhere in the nightly testsuite. It occurs three times in "make check": Alpha/illegal-element-type.ll, PowerPC/illegal-element-type.ll and X86/mmx-shift.ll. If expunging proves to be too expensive then there are other more complicated ways of solving the problem. In the normal case this patch adds the overhead of a few more map lookups, which is hopefully negligable. llvm-svn: 52214
* Various tweaks related to apint codegen. No functionalityDuncan Sands2008-06-091-2/+2
| | | | | | change for non-funky-sized integers. llvm-svn: 52151
* Remove some DAG combiner assumptions about sizesDuncan Sands2008-06-091-28/+21
| | | | | | | | | | | of integer types. Fix the isMask APInt method to actually work (hopefully) rather than crashing because it adds apints of different bitwidths. It looks like isShiftedMask is also broken, but I'm leaving that one to the APInt people (it is not used anywhere). llvm-svn: 52142
* Remove comparison methods for MVT. The main causeDuncan Sands2008-06-081-23/+21
| | | | | | | | | | | of apint codegen failure is the DAG combiner doing the wrong thing because it was comparing MVT's using < rather than comparing the number of bits. Removing the < method makes this mistake impossible to commit. Instead, add helper methods for comparing bits and use them. llvm-svn: 52098
* Wrap MVT::ValueType in a struct to get type safetyDuncan Sands2008-06-061-232/+232
| | | | | | | | | | | | | | | | and better control the abstraction. Rename the type to MVT. To update out-of-tree patches, the main thing to do is to rename MVT::ValueType to MVT, and rewrite expressions like MVT::getSizeInBits(VT) in the form VT.getSizeInBits(). Use VT.getSimpleVT() to extract a MVT::SimpleValueType for use in switch statements (you will get an assert failure if VT is an extended value type - these shouldn't exist after type legalization). This results in a small speedup of codegen and no new testsuite failures (x86-64 linux). llvm-svn: 52044
* Add #includes to make some dependencies explicit.Dan Gohman2008-05-231-0/+1
| | | | llvm-svn: 51496
* Code simplification.Dan Gohman2008-05-201-6/+4
| | | | llvm-svn: 51345
* Instead of a vector load, shuffle and then extract an element. Load the ↵Evan Cheng2008-05-131-33/+66
| | | | | | | | | | | element from address with an offset. pshufd $1, (%rdi), %xmm0 movd %xmm0, %eax => movl 4(%rdi), %eax llvm-svn: 51026
* Xform bitconvert(build_pair(load a, load b)) to a single load if the load ↵Evan Cheng2008-05-121-0/+49
| | | | | | locations are at the right offset from each other. llvm-svn: 51008
* Evan pointed out that folding sext to zext may not be correctDan Gohman2008-04-281-1/+2
| | | | | | if the zext is not legal. llvm-svn: 50368
* Teach DAGCombine to convert (sext x) to (zext x) when theDan Gohman2008-04-281-0/+4
| | | | | | sign-bit of x is known to be zero. llvm-svn: 50357
* Ongoing work on improving the instruction selection infrastructure:Roman Levenstein2008-04-161-1/+2
| | | | | | | | | | Rename SDOperandImpl back to SDOperand. Introduce the SDUse class that represents a use of the SDNode referred by an SDOperand. Now it is more similar to Use/Value classes. Patch is approved by Dan Gohman. llvm-svn: 49795
* Re-commit of the r48822, where the infinite looping problem discoveredRoman Levenstein2008-04-071-8/+8
| | | | | | by Dan Gohman is fixed. llvm-svn: 49330
* Backing out 48222 temporarily.Evan Cheng2008-04-031-8/+8
| | | | llvm-svn: 49124
* Fix a DAGCombiner optimization to respect volatile qualification.Dan Gohman2008-03-311-1/+2
| | | | llvm-svn: 48994
* Use a linked data structure for the uses lists of an SDNode, just like Roman Levenstein2008-03-261-8/+8
| | | | | | | | | | | | | 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
* Handle a special case xor undef, undef -> 0. Technically this should be ↵Evan Cheng2008-03-251-0/+3
| | | | | | transformed to undef. But this is such a common idiom (misuse) we are going to handle it. llvm-svn: 48792
* Remove an unneeded test.Evan Cheng2008-03-241-1/+1
| | | | llvm-svn: 48755
* 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
OpenPOWER on IntegriCloud