Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fix the #1 code quality problem that I have seen on X86 (and it also affects | Chris Lattner | 2005-12-05 | 1 | -6/+162 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PPC and other targets). In a particular, consider code like this: struct Vector3 { double x, y, z; }; struct Matrix3 { Vector3 a, b, c; }; double dot(Vector3 &a, Vector3 &b) { return a.x * b.x + a.y * b.y + a.z * b.z; } Vector3 mul(Vector3 &a, Matrix3 &b) { Vector3 r; r.x = dot( a, b.a ); r.y = dot( a, b.b ); r.z = dot( a, b.c ); return r; } void transform(Matrix3 &m, Vector3 *x, int n) { for (int i = 0; i < n; i++) x[i] = mul( x[i], m ); } we compile transform to a loop with all of the GEP instructions for indexing into 'm' pulled out of the loop (9 of them). Because isel occurs a bb at a time we are unable to fold the constant index into the loads in the loop, leading to PPC code that looks like this: LBB3_1: ; no_exit.preheader li r2, 0 addi r6, r3, 64 ;; 9 values live across the loop body! addi r7, r3, 56 addi r8, r3, 48 addi r9, r3, 40 addi r10, r3, 32 addi r11, r3, 24 addi r12, r3, 16 addi r30, r3, 8 LBB3_2: ; no_exit lfd f0, 0(r30) lfd f1, 8(r4) fmul f0, f1, f0 lfd f2, 0(r3) ;; no constant indices folded into the loads! lfd f3, 0(r4) lfd f4, 0(r10) lfd f5, 0(r6) lfd f6, 0(r7) lfd f7, 0(r8) lfd f8, 0(r9) lfd f9, 0(r11) lfd f10, 0(r12) lfd f11, 16(r4) fmadd f0, f3, f2, f0 fmul f2, f1, f4 fmadd f0, f11, f10, f0 fmadd f2, f3, f9, f2 fmul f1, f1, f6 stfd f0, 0(r4) fmadd f0, f11, f8, f2 fmadd f1, f3, f7, f1 stfd f0, 8(r4) fmadd f0, f11, f5, f1 addi r29, r4, 24 stfd f0, 16(r4) addi r2, r2, 1 cmpw cr0, r2, r5 or r4, r29, r29 bne cr0, LBB3_2 ; no_exit uh, yuck. With this patch, we now sink the constant offsets into the loop, producing this code: LBB3_1: ; no_exit.preheader li r2, 0 LBB3_2: ; no_exit lfd f0, 8(r3) lfd f1, 8(r4) fmul f0, f1, f0 lfd f2, 0(r3) lfd f3, 0(r4) lfd f4, 32(r3) ;; much nicer. lfd f5, 64(r3) lfd f6, 56(r3) lfd f7, 48(r3) lfd f8, 40(r3) lfd f9, 24(r3) lfd f10, 16(r3) lfd f11, 16(r4) fmadd f0, f3, f2, f0 fmul f2, f1, f4 fmadd f0, f11, f10, f0 fmadd f2, f3, f9, f2 fmul f1, f1, f6 stfd f0, 0(r4) fmadd f0, f11, f8, f2 fmadd f1, f3, f7, f1 stfd f0, 8(r4) fmadd f0, f11, f5, f1 addi r6, r4, 24 stfd f0, 16(r4) addi r2, r2, 1 cmpw cr0, r2, r5 or r4, r6, r6 bne cr0, LBB3_2 ; no_exit This is much nicer as it reduces register pressure in the loop a lot. On X86, this takes the function from having 9 spilled registers to 2. This should help some spec programs on X86 (gzip?) This is currently only enabled with -enable-gep-isel-opt to allow perf testing tonight. llvm-svn: 24606 | ||||
* | dbg.stoppoint returns a value, don't forget to init it | Chris Lattner | 2005-12-03 | 1 | -0/+1 |
| | | | | llvm-svn: 24583 | ||||
* | bah, must generate all results | Andrew Lenharth | 2005-12-02 | 1 | -2/+8 |
| | | | | llvm-svn: 24574 | ||||
* | cycle counter fix | Andrew Lenharth | 2005-12-02 | 1 | -0/+6 |
| | | | | llvm-svn: 24573 | ||||
* | Don't remove two operand, two result nodes from the binary ops map. These | Chris Lattner | 2005-12-01 | 1 | -36/+39 |
| | | | | | | | | should come from the arbitrary ops map. This fixes Regression/CodeGen/PowerPC/2005-12-01-Crash.ll llvm-svn: 24571 | ||||
* | Promote line and column number information for our friendly 64-bit targets. | Chris Lattner | 2005-12-01 | 1 | -3/+10 |
| | | | | llvm-svn: 24568 | ||||
* | This is a bugfix for SelectNodeTo. In certain situations, we could be | Chris Lattner | 2005-12-01 | 1 | -0/+110 |
| | | | | | | | | | | selecting a node and use a mix of getTargetNode() and SelectNodeTo. Because SelectNodeTo didn't check the CSE maps for a preexisting node and didn't insert its result into the CSE maps, we would sometimes miss a CSE opportunity. This is extremely rare, but worth fixing for completeness. llvm-svn: 24565 | ||||
* | Support multiple ValueTypes per RegisterClass, needed for upcoming vector | Nate Begeman | 2005-12-01 | 1 | -1/+1 |
| | | | | | | work. This change has no effect on generated code. llvm-svn: 24563 | ||||
* | Make SelectNodeTo return N | Chris Lattner | 2005-11-30 | 1 | -35/+49 |
| | | | | llvm-svn: 24548 | ||||
* | CALLSEQ_START/END nodes don't get memoized, do not add them in when | Chris Lattner | 2005-11-30 | 1 | -0/+4 |
| | | | | | | replaceAllUses'ing. llvm-svn: 24539 | ||||
* | At long last, you can say that f32 isn't supported for setcc | Andrew Lenharth | 2005-11-30 | 1 | -1/+28 |
| | | | | llvm-svn: 24537 | ||||
* | First chunk of actually generating vector code for packed types. These | Nate Begeman | 2005-11-30 | 1 | -2/+12 |
| | | | | | | | | | | | | | | | | | | | | | | | changes allow us to generate the following code: _foo: li r2, 0 lvx v0, r2, r3 vaddfp v0, v0, v0 stvx v0, r2, r3 blr for this llvm: void %foo(<4 x float>* %a) { entry: %tmp1 = load <4 x float>* %a %tmp2 = add <4 x float> %tmp1, %tmp1 store <4 x float> %tmp2, <4 x float>* %a ret void } llvm-svn: 24534 | ||||
* | add support for custom lowering SINT_TO_FP | Andrew Lenharth | 2005-11-30 | 1 | -0/+13 |
| | | | | llvm-svn: 24531 | ||||
* | Fix a problem with llvm-ranlib that (on some platforms) caused the archive | Reid Spencer | 2005-11-30 | 1 | -0/+30 |
| | | | | | | | | | | file to become corrupted due to interactions between mmap'd memory segments and file descriptors closing. The problem is completely avoiding by using a third temporary file. Patch provided by Evan Jones llvm-svn: 24527 | ||||
* | Fixed a bug introduced by my last commit: TargetGlobalValues should key on | Evan Cheng | 2005-11-30 | 1 | -7/+13 |
| | | | | | | GlobalValue * and index pair. Update getGlobalAddress() for symmetry. llvm-svn: 24524 | ||||
* | Added an index field to GlobalAddressSDNode so it can represent X+12, etc. | Evan Cheng | 2005-11-30 | 3 | -3/+23 |
| | | | | llvm-svn: 24523 | ||||
* | Add support for a new STRING and LOCATION node for line number support, patch | Chris Lattner | 2005-11-29 | 4 | -2/+113 |
| | | | | | | contributed by Daniel Berlin, with a few cleanups here and there by me. llvm-svn: 24515 | ||||
* | Add the majority of the vector machien value types we expect to support, | Nate Begeman | 2005-11-29 | 1 | -2/+2 |
| | | | | | | | and make a few changes to the legalization machinery to support more than 16 types. llvm-svn: 24511 | ||||
* | Check in code to scalarize arbitrarily wide packed types for some simple | Nate Begeman | 2005-11-22 | 3 | -5/+81 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vector operations (load, add, sub, mul). This allows us to codegen: void %foo(<4 x float> * %a) { entry: %tmp1 = load <4 x float> * %a; %tmp2 = add <4 x float> %tmp1, %tmp1 store <4 x float> %tmp2, <4 x float> *%a ret void } on ppc as: _foo: lfs f0, 12(r3) lfs f1, 8(r3) lfs f2, 4(r3) lfs f3, 0(r3) fadds f0, f0, f0 fadds f1, f1, f1 fadds f2, f2, f2 fadds f3, f3, f3 stfs f0, 12(r3) stfs f1, 8(r3) stfs f2, 4(r3) stfs f3, 0(r3) blr llvm-svn: 24484 | ||||
* | Rather than attempting to legalize 1 x float, make sure the SD ISel never | Nate Begeman | 2005-11-22 | 2 | -48/+24 |
| | | | | | | | | | | | generates it. Make MVT::Vector expand-only, and remove the code in Legalize that attempts to legalize it. The plan for supporting N x Type is to continually epxand it in ExpandOp until it gets down to 2 x Type, where it will be scalarized into a pair of scalars. llvm-svn: 24482 | ||||
* | Legalize MERGE_VALUES, expand READCYCLECOUNTER correctly, so it doesn't | Chris Lattner | 2005-11-20 | 1 | -8/+13 |
| | | | | | | break control dependence. llvm-svn: 24437 | ||||
* | The first patch of X86 support for read cycle counter | Andrew Lenharth | 2005-11-20 | 1 | -0/+12 |
| | | | | llvm-svn: 24429 | ||||
* | more progress towards bug 291 being finished. Patch by Owen Anderson, | Chris Lattner | 2005-11-20 | 1 | -12/+17 |
| | | | | | | HAVE_GV case fixed up by me. llvm-svn: 24428 | ||||
* | Unbreak codegen of bools. This should fix the llc/jit/llc-beta failures | Chris Lattner | 2005-11-19 | 1 | -1/+1 |
| | | | | | | from last night. llvm-svn: 24427 | ||||
* | Improve Selection DAG printer portability. Patch by Owen Anderson! | Chris Lattner | 2005-11-19 | 1 | -4/+6 |
| | | | | llvm-svn: 24425 | ||||
* | Teach the graph viewer to handle register operands that are zero. | Chris Lattner | 2005-11-19 | 1 | -1/+1 |
| | | | | llvm-svn: 24421 | ||||
* | Silence a bogus warning | Chris Lattner | 2005-11-19 | 1 | -3/+2 |
| | | | | llvm-svn: 24420 | ||||
* | Add some method variants, patch by Evan Cheng | Chris Lattner | 2005-11-19 | 1 | -15/+41 |
| | | | | llvm-svn: 24418 | ||||
* | Teach LLVM how to scalarize packed types. Currently, this only works on | Nate Begeman | 2005-11-19 | 3 | -33/+110 |
| | | | | | | | | | | | | | | | | | | | | | | | packed types with an element count of 1, although more generic support is coming. This allows LLVM to turn the following code: void %foo(<1 x float> * %a) { entry: %tmp1 = load <1 x float> * %a; %tmp2 = add <1 x float> %tmp1, %tmp1 store <1 x float> %tmp2, <1 x float> *%a ret void } Into: _foo: lfs f0, 0(r3) fadds f0, f0, f0 stfs f0, 0(r3) blr llvm-svn: 24416 | ||||
* | Split out the shift code from visitBinary. | Nate Begeman | 2005-11-18 | 1 | -7/+14 |
| | | | | llvm-svn: 24412 | ||||
* | Allow targets to custom legalize leaf nodes like GlobalAddress. | Chris Lattner | 2005-11-17 | 1 | -1/+13 |
| | | | | llvm-svn: 24387 | ||||
* | Teach legalize about targetglobaladdress | Chris Lattner | 2005-11-17 | 1 | -0/+1 |
| | | | | llvm-svn: 24385 | ||||
* | when debugging lower dbg intrinsics to calls | Chris Lattner | 2005-11-16 | 1 | -0/+22 |
| | | | | llvm-svn: 24377 | ||||
* | Fix operator precedence bug caught by VC++. | Jeff Cohen | 2005-11-12 | 1 | -2/+2 |
| | | | | llvm-svn: 24318 | ||||
* | added a chain output | Andrew Lenharth | 2005-11-11 | 1 | -2/+10 |
| | | | | llvm-svn: 24306 | ||||
* | continued readcyclecounter support | Andrew Lenharth | 2005-11-11 | 3 | -0/+9 |
| | | | | llvm-svn: 24300 | ||||
* | Switch the allnodes list from a vector of pointers to an ilist of nodes.This ↵ | Chris Lattner | 2005-11-09 | 4 | -46/+37 |
| | | | | | | | | 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 | ||||
* | Refactor intrinsic lowering stuff out of visitCall | Chris Lattner | 2005-11-09 | 1 | -98/+107 |
| | | | | llvm-svn: 24261 | ||||
* | Handle the trivial (but common) two-op case more efficiently | Chris Lattner | 2005-11-09 | 1 | -11/+18 |
| | | | | llvm-svn: 24259 | ||||
* | Fix CodeGen/X86/shift-folding.ll:test3 on X86 | Chris Lattner | 2005-11-09 | 1 | -1/+1 |
| | | | | llvm-svn: 24256 | ||||
* | Avoid creating a token factor node in trivially redundant cases. This | Chris Lattner | 2005-11-09 | 1 | -1/+12 |
| | | | | | | eliminates almost one node per block in common cases. llvm-svn: 24254 | ||||
* | Handle GEP's a bit more intelligently. Fold constant indices early and | Chris Lattner | 2005-11-09 | 1 | -16/+40 |
| | | | | | | turn power-of-two multiplies into shifts early to improve compile time. llvm-svn: 24253 | ||||
* | Allocate the right amount of memory for this vector up front. | Chris Lattner | 2005-11-08 | 1 | -0/+1 |
| | | | | llvm-svn: 24252 | ||||
* | Change the ValueList array for each node to be shared instead of ↵ | Chris Lattner | 2005-11-08 | 1 | -5/+48 |
| | | | | | | individuallyallocated. Further, in the common case where a node has a single value, justreference an element from a small array. This is a small compile-time win. llvm-svn: 24251 | ||||
* | Switch the operandlist/valuelist from being vectors to being just an ↵ | Chris Lattner | 2005-11-08 | 1 | -23/+33 |
| | | | | | | | | | array.This saves 12 bytes from SDNode, but doesn't speed things up substantially (our graphs apparently already fit within the cache on my g5). In any case this reduces memory usage. llvm-svn: 24249 | ||||
* | Explicitly initialize some instance vars | Chris Lattner | 2005-11-08 | 1 | -4/+5 |
| | | | | llvm-svn: 24247 | ||||
* | Clean up RemoveDeadNodes significantly, by eliminating the need for a temporary | Chris Lattner | 2005-11-08 | 1 | -32/+34 |
| | | | | | | | | set and eliminating the need to iterate whenever something is removed (which can be really slow in some cases). Thx to Jim for pointing out something silly I was getting stuck on. :) llvm-svn: 24241 | ||||
* | Let's try ignoring resource utilization on the backward pass. | Jim Laskey | 2005-11-07 | 1 | -0/+2 |
| | | | | llvm-svn: 24231 | ||||
* | Add the necessary support to the ISel to allow targets to codegen the new | Nate Begeman | 2005-11-06 | 1 | -2/+5 |
| | | | | | | | | alignment information appropriately. Includes code for PowerPC to support fixed-size allocas with alignment larger than the stack. Support for arbitrarily aligned dynamic allocas coming soon. llvm-svn: 24224 | ||||
* | Fix logic bug in finding retry slot in tally. | Jim Laskey | 2005-11-05 | 1 | -15/+33 |
| | | | | llvm-svn: 24188 |