summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* This test case:Bill Wendling2010-03-031-5/+7
| | | | | | | | | | | | | | | | | | | | | long test(long x) { return (x & 123124) | 3; } Currently compiles to: _test: orl $3, %edi movq %rdi, %rax andq $123127, %rax ret This is because instruction and DAG combiners canonicalize (or (and x, C), D) -> (and (or, D), (C | D)) However, this is only profitable if (C & D) != 0. It gets in the way of the 3-addressification because the input bits are known to be zero. llvm-svn: 97616
* Fix several places to handle vector operands properly.Dan Gohman2010-03-021-3/+3
| | | | | | Based on a patch by Micah Villmow for PR6438. llvm-svn: 97538
* Re-apply 97040 with fix. This survives a ppc self-host llvm-gcc bootstrap.Evan Cheng2010-02-271-2/+53
| | | | llvm-svn: 97310
* Speculatively revert r97011, "Re-apply 96540 and 96556 with fixes.", again inDaniel Dunbar2010-02-241-53/+2
| | | | | | the hopes of fixing PPC bootstrap. llvm-svn: 97040
* Re-apply 96540 and 96556 with fixes.Evan Cheng2010-02-241-2/+53
| | | | llvm-svn: 97011
* Revert commits 96556 and 96640, because commit 96556 breaks theDuncan Sands2010-02-191-50/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Some dag combiner goodness:Evan Cheng2010-02-181-2/+50
| | | | | | | | 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
* Add non-temporal flags and remove an assumption of default arguments.David Greene2010-02-151-34/+61
| | | | llvm-svn: 96240
* Fix "the the" and similar typos.Dan Gohman2010-02-101-1/+1
| | | | llvm-svn: 95781
* Improve EXTRACT_VECTOR_ELT patch based on comments from DuncanMon P Wang2010-02-011-4/+1
| | | | llvm-svn: 95012
* Fixed a couple of optimization with EXTRACT_VECTOR_ELT that assumes the resultMon P Wang2010-02-011-4/+11
| | | | | | | | type is the same as the element type of the vector. EXTRACT_VECTOR_ELT can be used to extended the width of an integer type. This fixes a bug for Generic/vector-casts.ll on a ppc750. llvm-svn: 94990
* Implement cond ? -1 : 0 with sbb.Evan Cheng2010-01-261-0/+8
| | | | llvm-svn: 94490
* Fold (add x, shl(0 - y, n)) -> sub(x, shl(y, n)), to simplify some codeDan Gohman2010-01-191-0/+20
| | | | | | that SCEVExpander can produce when running on behalf of LSR. llvm-svn: 93949
* Canonicalize -1 - x to ~x.Evan Cheng2010-01-181-0/+3
| | | | | | | | | | Instcombine does this but apparently there are situations where this pattern will escape the optimizer and / or created by isel. Here is a case that's seen in JavaScriptCore: %t1 = sub i32 0, %a %t2 = add i32 %t1, -1 The dag combiner pattern: ((c1-A)+c2) -> (c1+c2)-A will fold it to -1 - %a. llvm-svn: 93773
* Fix a codegen abort seen in 483.xalancbmk.Dan Gohman2010-01-141-0/+3
| | | | llvm-svn: 93417
* Disable transformation of select of two loads to a select of address and ↵Mon P Wang2010-01-111-28/+41
| | | | | | | | then a load if the loads are not in the default address space because the transformation discards src value info. llvm-svn: 93180
* Revert an earlier change to SIGN_EXTEND_INREG for vectors. The VTSDNodeDan Gohman2010-01-091-11/+15
| | | | | | | | | | really does need to be a vector type, because TargetLowering::getOperationAction for SIGN_EXTEND_INREG uses that type, and it needs to be able to distinguish between vectors and scalars. Also, fix some more issues with legalization of vector casts. llvm-svn: 93043
* Fix rdar://7517201, a regression introduced by r92849.Chris Lattner2010-01-071-1/+1
| | | | | | | | | | When folding a and(any_ext(load)) both the any_ext and the load have to have only a single use. This removes the anyext-uses.ll testcase which started failing because it is unreduced and unclear what it is testing. llvm-svn: 92950
* factor this code better and reduce nesting at the sameChris Lattner2010-01-071-61/+41
| | | | | | time, no functionality change. llvm-svn: 92948
* Teach dag combine to fold the following transformation more aggressively:Evan Cheng2010-01-061-55/+123
| | | | | | | | | | (OP (trunc x), (trunc y)) -> (trunc (OP x, y)) Unfortunately this simple change causes dag combine to infinite looping. The problem is the shrink demanded ops optimization tend to canonicalize expressions in the opposite manner. That is badness. This patch disable those optimizations in dag combine but instead it is done as a late pass in sdisel. This also exposes some deficiencies in dag combine and x86 setcc / brcond lowering. Teach them to look pass ISD::TRUNCATE in various places. llvm-svn: 92849
* Don't assign the shift the same type as the variable being shifted. This couldBill Wendling2010-01-051-1/+3
| | | | | | result in illegal types for the SHL operator. llvm-svn: 92797
* Change errs() to dbgs().David Greene2010-01-051-21/+21
| | | | llvm-svn: 92578
* Increase opportunities to optimize (brcond (srl (and c1), c2)).Evan Cheng2009-12-181-1/+28
| | | | llvm-svn: 91717
* Revert this dag combine change:Evan Cheng2009-12-171-13/+0
| | | | | | | | Fold (zext (and x, cst)) -> (and (zext x), cst) DAG combiner likes to optimize expression in the other way so this would end up cause an infinite looping. llvm-svn: 91574
* Make 91378 more conservative.Evan Cheng2009-12-151-1/+11
| | | | | | | 1. Only perform (zext (shl (zext x), y)) -> (shl (zext x), y) when y is a constant. This makes sure it remove at least one zest. 2. If the shift is a left shift, make sure the original shift cannot shift out bits. llvm-svn: 91399
* Fold (zext (and x, cst)) -> (and (zext x), cst).Evan Cheng2009-12-151-0/+13
| | | | llvm-svn: 91380
* Propagate zest through logical shift.Evan Cheng2009-12-151-0/+10
| | | | llvm-svn: 91378
* Fix integer cast code to handle vector types.Dan Gohman2009-12-141-1/+1
| | | | llvm-svn: 91362
* Implement vector widening, splitting, and scalarizing for SIGN_EXTEND_INREG.Dan Gohman2009-12-111-17/+19
| | | | llvm-svn: 91158
* Move isConsecutiveLoad to SelectionDAG. It's not target dependent and it's ↵Evan Cheng2009-12-091-2/+1
| | | | | | primary used by selectdag passes. llvm-svn: 90922
* Refactor InferAlignment out of DAGCombine.Evan Cheng2009-12-091-45/+2
| | | | llvm-svn: 90917
* Don't pull vector sext through both hands of a logical operation, since ↵Nate Begeman2009-12-031-2/+8
| | | | | | | | | doing so prevents the fusion of vector sext and setcc into vsetcc. Add a testcase for the above transformation. Fix a bogus use of APInt noticed while tracking this down. llvm-svn: 90423
* Don't call getValueType() on a null SDValueJakob Stoklund Olesen2009-12-031-1/+2
| | | | llvm-svn: 90415
* Remove the optimizations that convert BRCOND and BR_CC intoDan Gohman2009-11-171-17/+12
| | | | | | | | | | unconditional branches or fallthroghes. Instcombine/SimplifyCFG should be simplifying branches with known conditions. This fixes some problems caused by these transformations not updating the MachineBasicBlock CFG. llvm-svn: 89017
* Remove an unneeded #include.Dan Gohman2009-11-091-1/+0
| | | | llvm-svn: 86601
* When discarding SrcValue information, discard all of it so that codeDan Gohman2009-10-311-7/+5
| | | | | | that uses this information knows to behave conservatively. llvm-svn: 85654
* Don't call SDNode::isPredecessorOf when it isn't necessary. If the load'sDan Gohman2009-10-281-6/+10
| | | | | | chains have no users, they can't be predecessors of the condition. llvm-svn: 85394
* Remove includes of Support/Compiler.h that are no longer needed after theNick Lewycky2009-10-251-1/+0
| | | | | | VISIBILITY_HIDDEN removal. llvm-svn: 85043
* Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.Nick Lewycky2009-10-251-3/+2
| | | | | | | Chris claims we should never have visibility_hidden inside any .cpp file but that's still not true even after this commit. llvm-svn: 85042
* Fix invalid for vector types fneg(bitconvert(x)) => bitconvert(x ^ sign)Anton Korobeynikov2009-10-201-4/+6
| | | | | | transform. llvm-svn: 84683
* More heuristics for Combiner-AA. Still catches all important cases, butNate Begeman2009-10-121-6/+19
| | | | | | | compile time penalty on gnugo, the worst case in MultiSource, is down to about 2.5% from 30% llvm-svn: 83824
* Fix combiner-aa issue with bases which are different, but can alias.Nate Begeman2009-09-251-14/+34
| | | | | | | Previously, it treated GV+28 GV+0 as different bases, and assumed they could not alias. llvm-svn: 82753
* Use getStoreSize() instead of getStoreSizeInBits()/8.Dan Gohman2009-09-231-2/+2
| | | | llvm-svn: 82656
* Rename several variables from EVT to more descriptive names, now that EVTDan Gohman2009-09-231-20/+20
| | | | | | | is also the name of their type, as declarations like "EVT EVT" look really odd. llvm-svn: 82654
* Substantially speed up combiner-aa in the following ways:Nate Begeman2009-09-151-33/+69
| | | | | | | | | | | | | | 1. Switch from an std::set to a SmallPtrSet for visited chain nodes. 2. Do not force the recursive flattening of token factor nodes, regardless of use count. 3. Immediately process newly created TokenFactor nodes. Also, improve combiner-aa by teaching it that loads to non-overlapping offsets of relatively aligned objects cannot alias. These changes result in a >5x speedup for combiner-aa on most testcases. llvm-svn: 81816
* Don't swap the operands of a subtraction when trying to create aBob Wilson2009-09-101-1/+1
| | | | | | post-decrement load/store. llvm-svn: 81464
* Remove some unused variables and methods warned about byDuncan Sands2009-09-061-3/+0
| | | | | | icc (#177, partial). Patch by Erick Tryzelaar. llvm-svn: 81106
* remove a few DOUTs here and there.Chris Lattner2009-08-231-22/+37
| | | | llvm-svn: 79832
* Add check for completeness. Note that this doesn't actually have any Eli Friedman2009-08-231-1/+1
| | | | | | effect with the way the current code is structured. llvm-svn: 79792
* PR4737: Fix a nasty bug in load narrowing with non-power-of-two types.Eli Friedman2009-08-191-1/+2
| | | | llvm-svn: 79415
OpenPOWER on IntegriCloud