summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move MaskedValueIsZero from the DAGCombiner to the TargetLowering ↵Chris Lattner2006-01-301-120/+21
| | | | | | interface,making isMaskedValueZeroForTargetNode simpler, and useable from other partsof the compiler. llvm-svn: 25803
* pass the address of MaskedValueIsZero into isMaskedValueZeroForTargetNode,Chris Lattner2006-01-301-1/+1
| | | | | | to permit recursion llvm-svn: 25799
* eliminate uses of SelectionDAG::getBR2Way_CCChris Lattner2006-01-291-3/+10
| | | | llvm-svn: 25767
* Add a missing case to the dag combiner.Nate Begeman2006-01-281-2/+3
| | | | llvm-svn: 25723
* Add explicit #includes of <iostream>Chris Lattner2006-01-221-0/+1
| | | | llvm-svn: 25515
* Get rid of code in the DAGCombiner that is duplicated in SelectionDAG.cppNate Begeman2006-01-181-74/+80
| | | | | | Now all constant folding in the code generator is in one place. llvm-svn: 25426
* Fix a backwards conditional that caused an inf loop in some cases. ThisChris Lattner2006-01-181-1/+1
| | | | | | fixes: test/Regression/CodeGen/Generic/2005-01-18-SetUO-InfLoop.ll llvm-svn: 25419
* Disable two transformations that contribute to bus errors on SparcV8.Chris Lattner2006-01-151-2/+6
| | | | llvm-svn: 25339
* Add a simple missing fold to produce this:Chris Lattner2006-01-121-0/+8
| | | | | | | | | | | subfic r3, r2, 33 instead of this: subfic r2, r2, 32 addi r3, r2, 1 llvm-svn: 25255
* Don't create rotate instructions in unsupported types, because we don't haveChris Lattner2006-01-121-2/+2
| | | | | | promote/expand code yet. This fixes the 177.mesa failure on PPC. llvm-svn: 25250
* Add bswap, rotl, and rotr nodesNate Begeman2006-01-111-2/+36
| | | | | | | | | Add dag combiner code to recognize rotl, rotr Add ppc code to match rotl Targets should add rotl/rotr patterns if they have them llvm-svn: 25222
* Revert the previous check-in. Leave shl x, 1 along for target to deal with.Evan Cheng2006-01-061-3/+0
| | | | llvm-svn: 25121
* fold (shl x, 1) -> (add x, x)Evan Cheng2006-01-061-0/+3
| | | | llvm-svn: 25120
* Added initial support for DEBUG_LABEL allowing debug specific labels to beJim Laskey2006-01-051-2/+1
| | | | | | inserted in the code. llvm-svn: 25104
* Add unique id to debug location for debug label use (work in progress.)Jim Laskey2006-01-041-1/+2
| | | | llvm-svn: 25096
* Remove redundant debug locations.Jim Laskey2005-12-231-0/+34
| | | | llvm-svn: 24995
* Simplify store(bitconv(x)) to store(x). This allows us to compile this:Chris Lattner2005-12-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void bar(double Y, double *X) { *X = Y; } to this: bar: save -96, %o6, %o6 st %i1, [%i2+4] st %i0, [%i2] restore %g0, %g0, %g0 retl nop instead of this: bar: save -104, %o6, %o6 st %i1, [%i6+-4] st %i0, [%i6+-8] ldd [%i6+-8], %f0 std %f0, [%i2] restore %g0, %g0, %g0 retl nop on sparcv8. llvm-svn: 24983
* fold (conv (load x)) -> (load (conv*)x).Chris Lattner2005-12-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to compile this: void foo(double); void bar(double *X) { foo(*X); } To this: bar: save -96, %o6, %o6 ld [%i0+4], %o1 ld [%i0], %o0 call foo nop restore %g0, %g0, %g0 retl nop instead of this: bar: save -104, %o6, %o6 ldd [%i0], %f0 std %f0, [%i6+-8] ld [%i6+-4], %o1 ld [%i6+-8], %o0 call foo nop restore %g0, %g0, %g0 retl nop on SparcV8. llvm-svn: 24982
* Fold bitconv(bitconv(x)) -> x. We now compile this:Chris Lattner2005-12-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void foo(double); void bar(double X) { foo(X); } to this: bar: save -96, %o6, %o6 or %g0, %i0, %o0 or %g0, %i1, %o1 call foo nop restore %g0, %g0, %g0 retl nop instead of this: bar: save -112, %o6, %o6 st %i1, [%i6+-4] st %i0, [%i6+-8] ldd [%i6+-8], %f0 std %f0, [%i6+-16] ld [%i6+-12], %o1 ld [%i6+-16], %o0 call foo nop restore %g0, %g0, %g0 retl nop on V8. llvm-svn: 24981
* constant fold bits_convert in getNode and in the dag combiner for fp<->intChris Lattner2005-12-231-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | conversions. This allows V8 to compiles this: void %test() { call float %test2( float 1.000000e+00, float 2.000000e+00, double 3.000000e+00, double* null ) ret void } into: test: save -96, %o6, %o6 sethi 0, %o3 sethi 1049088, %o2 sethi 1048576, %o1 sethi 1040384, %o0 or %g0, %o3, %o4 call test2 nop restore %g0, %g0, %g0 retl nop instead of: test: save -112, %o6, %o6 sethi 0, %o4 sethi 1049088, %l0 st %o4, [%i6+-12] st %l0, [%i6+-16] ld [%i6+-12], %o3 ld [%i6+-16], %o2 sethi 1048576, %o1 sethi 1040384, %o0 call test2 nop restore %g0, %g0, %g0 retl nop llvm-svn: 24980
* * Fix a GlobalAddress lowering bug.Evan Cheng2005-12-211-1/+4
| | | | | | * Teach DAG combiner about X86ISD::SETCC by adding a TargetLowering hook. llvm-svn: 24921
* Don't create SEXTLOAD/ZEXTLOAD instructions that the target doesn't supportChris Lattner2005-12-151-2/+4
| | | | | | if after legalize. This fixes IA64 failures. llvm-svn: 24725
* When folding loads into ops, immediately replace uses of the op with theChris Lattner2005-12-141-6/+6
| | | | | | | | | load. This reduces number of worklist iterations and avoid missing optimizations depending on folding of things into sext_inreg nodes (which aren't supported by all targets). Tested by Regression/CodeGen/X86/extend.ll:test2 llvm-svn: 24712
* Fix the (zext (zextload)) case to trigger, similarly for sign extends.Chris Lattner2005-12-141-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow (zext (truncate)) to apply after legalize if the target supports AND (which all do). This compiles short %foo() { %tmp.0 = load ubyte* %X ; <ubyte> [#uses=1] %tmp.3 = cast ubyte %tmp.0 to short ; <short> [#uses=1] ret short %tmp.3 } to: _foo: movzbl _X, %eax ret instead of: _foo: movzbl _X, %eax movzbl %al, %eax ret thanks to Evan for pointing this out. llvm-svn: 24709
* Fix a miscompilation in crafty due to a recent patchChris Lattner2005-12-141-1/+1
| | | | llvm-svn: 24706
* Fold (zext (load x) to (zextload x).Evan Cheng2005-12-141-1/+18
| | | | llvm-svn: 24702
* Only transform (sext (truncate x)) -> (sextinreg x) if before legalize orChris Lattner2005-12-071-1/+3
| | | | | | if the target supports the resultant sextinreg llvm-svn: 24632
* Teach the dag combiner to turn a truncate/sign_extend pair into a sextinregChris Lattner2005-12-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when the types match up. This allows the X86 backend to compile: sbyte %toggle_value(sbyte* %tmp.1) { %tmp.2 = load sbyte* %tmp.1 ret sbyte %tmp.2 } to this: _toggle_value: mov %EAX, DWORD PTR [%ESP + 4] movsx %EAX, BYTE PTR [%EAX] ret instead of this: _toggle_value: mov %EAX, DWORD PTR [%ESP + 4] movsx %EAX, BYTE PTR [%EAX] movsx %EAX, %AL ret noticed in Shootout/objinst. -Chris llvm-svn: 24630
* Fix operator precedence bug caught by VC++.Jeff Cohen2005-11-121-2/+2
| | | | llvm-svn: 24318
* Switch the allnodes list from a vector of pointers to an ilist of nodes.This ↵Chris Lattner2005-11-091-1/+3
| | | | | | | | eliminates the vector, allows constant time removal of a node froma graph, and makes iteration over the all nodes list stable when adding nodes to the graph. llvm-svn: 24263
* Fix a crash that Andrew noticed, and add a pair of braces to unfconfuseNate Begeman2005-11-021-5/+5
| | | | | | XCode's indenting. llvm-svn: 24159
* Fix a source of undefined behavior when dealing with 64-bit types. ThisChris Lattner2005-11-021-1/+1
| | | | | | may fix PR652. Thanks to Andrew for tracking down the problem. llvm-svn: 24145
* Codegen mul by negative power of two with a shift and negate.Chris Lattner2005-10-301-3/+13
| | | | | | | | | | | | | | | | | | | This implements test/Regression/CodeGen/PowerPC/mul-neg-power-2.ll, producing: _foo: slwi r2, r3, 1 subfic r3, r2, 63 blr instead of: _foo: mulli r2, r3, -2 addi r3, r2, 63 blr llvm-svn: 24106
* Fix DSE to not nuke dead stores unless they redundant store is the sameChris Lattner2005-10-271-1/+4
| | | | | | VT as the killing one. Fix fixes PR491 llvm-svn: 24034
* Add a simple xform that is useful for bitfield operations.Chris Lattner2005-10-271-0/+9
| | | | llvm-svn: 24029
* Clear a bit in this file that was causing a miscompilation of 178.galgel.Chris Lattner2005-10-251-1/+1
| | | | llvm-svn: 23980
* BuildSDIV and BuildUDIV only work for i32/i64, but they don't check thatChris Lattner2005-10-221-10/+20
| | | | | | | | the input is that type, this caused a failure on gs on X86 last night. Move the hard checks into Build[US]Div since that is where decisions like this should be made. llvm-svn: 23881
* add a case missing from the dag combiner that exposed the failure onChris Lattner2005-10-211-0/+3
| | | | | | 2005-10-21-longlonggtu.ll. llvm-svn: 23875
* Fix a typo in the dag combiner, so that this can work on i64 targetsNate Begeman2005-10-211-3/+2
| | | | llvm-svn: 23856
* Invert the TargetLowering flag that controls divide by consant expansion.Nate Begeman2005-10-211-10/+37
| | | | | | | | | | Add a new flag to TargetLowering indicating if the target has really cheap signed division by powers of two, make ppc use it. This will probably go away in the future. Implement some more ISD::SDIV folds in the dag combiner Remove now dead code in the x86 backend. llvm-svn: 23853
* Fix a couple bugs in the const div stuff where we'd generate MULHS/MULHUNate Begeman2005-10-201-3/+4
| | | | | | | for types that aren't legal, and fail a divisor is less than zero comparison, which would cause us to drop a subtract. llvm-svn: 23846
* don't use llabs with apparently VC++ doesn't haveChris Lattner2005-10-201-1/+1
| | | | llvm-svn: 23845
* Move the target constant divide optimization up into the dag combiner, soNate Begeman2005-10-201-0/+263
| | | | | | | that the nodes can be folded with other nodes, and we can not duplicate code in every backend. Alpha will probably want this too. llvm-svn: 23835
* Fold (select C, load A, load B) -> load (select C, A, B). This happens quiteChris Lattner2005-10-181-7/+82
| | | | | | | | | | | | | | | | | | | | | | a lot throughout many programs. In particular, specfp triggers it a bunch for constant FP nodes when you have code like cond ? 1.0 : -1.0. If the PPC ISel exposed the loads implicit in pic references to external globals, we would be able to eliminate a load in cases like this as well: %X = external global int %Y = external global int int* %test4(bool %C) { %G = select bool %C, int* %X, int* %Y ret int* %G } Note that this breaks things that use SrcValue's (see the fixme), but since nothing uses them yet, this is ok. Also, simplify some code to use hasOneUse() on an SDOperand instead of hasNUsesOfValue directly. llvm-svn: 23781
* Implement some feedback from Chris re: constant canonicalizationNate Begeman2005-10-181-39/+27
| | | | llvm-svn: 23777
* fold fmul X, +2.0 -> fadd X, X;Nate Begeman2005-10-171-14/+17
| | | | llvm-svn: 23774
* add a trivial foldChris Lattner2005-10-171-0/+4
| | | | llvm-svn: 23764
* Fix this logic.Chris Lattner2005-10-151-1/+1
| | | | llvm-svn: 23756
* Add a case we were missing that was causing us to fail ↵Chris Lattner2005-10-151-0/+14
| | | | | | CodeGen/PowerPC/rlwinm.ll:test3 llvm-svn: 23755
* fold sext_in_reg, sext_in_reg where both have the same VT. This wasNate Begeman2005-10-141-1/+1
| | | | | | popping up in Fourinarow. llvm-svn: 23722
OpenPOWER on IntegriCloud