| Commit message (Collapse) | Author | Age | Files | Lines | 
| ... |  | 
| | 
| 
| 
|  | 
llvm-svn: 19548
 | 
| | 
| 
| 
|  | 
llvm-svn: 19545
 | 
| | 
| 
| 
|  | 
llvm-svn: 19544
 | 
| | 
| 
| 
| 
| 
|  | 
This allows us to better optimize begin() -> end() comparisons in common cases.
llvm-svn: 19542
 | 
| | 
| 
| 
|  | 
llvm-svn: 19541
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
the 'sim' program and probably elsewhere.  In sim, it comes up for cases
like this:
#define round(x) ((x)>0.0 ? (x)+0.5 : (x)-0.5)
double G;
void T(double X) { G = round(X); }
(it uses the round macro a lot).  This changes the LLVM code from:
        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %tmp.4 = add double %X, 5.000000e-01            ; <double> [#uses=1]
        %tmp.6 = sub double %X, 5.000000e-01            ; <double> [#uses=1]
        %mem_tmp.0 = select bool %tmp.1, double %tmp.4, double %tmp.6
        store double %mem_tmp.0, double* %G
to:
        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %mem_tmp.0.p = select bool %tmp.1, double 5.000000e-01, double -5.000000e-01
        %mem_tmp.0 = add double %mem_tmp.0.p, %X
        store double %mem_tmp.0, double* %G
        ret void
llvm-svn: 19537
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
_Bool test2(int X, int Y) {
  return &arr[X][Y] == arr;
}
instead of generating this:
bool %test2(int %X, int %Y) {
        %tmp.3.idx = mul int %X, 160            ; <int> [#uses=1]
        %tmp.3.idx1 = shl int %Y, ubyte 2               ; <int> [#uses=1]
        %tmp.3.offs2 = sub int 0, %tmp.3.idx            ; <int> [#uses=1]
        %tmp.7 = seteq int %tmp.3.idx1, %tmp.3.offs2            ; <bool> [#uses=1]
        ret bool %tmp.7
}
generate this:
bool %test2(int %X, int %Y) {
        seteq int %X, 0         ; <bool>:0 [#uses=1]
        seteq int %Y, 0         ; <bool>:1 [#uses=1]
        %tmp.7 = and bool %0, %1                ; <bool> [#uses=1]
        ret bool %tmp.7
}
This idiom occurs in C++ programs when iterating from begin() to end(),
in a vector or array.  For example, we now compile this:
void test(int X, int Y) {
  for (int *i = arr; i != arr+100; ++i)
    foo(*i);
}
to this:
no_exit:                ; preds = %entry, %no_exit
	...
        %exitcond = seteq uint %indvar.next, 100                ; <bool> [#uses=1]
        br bool %exitcond, label %return, label %no_exit
instead of this:
no_exit:                ; preds = %entry, %no_exit
	...
        %inc5 = getelementptr [100 x [40 x int]]* %arr, int 0, int 0, int %inc.rec              ; <int*> [#uses=1]
        %tmp.8 = seteq int* %inc5, getelementptr ([100 x [40 x int]]* %arr, int 0, int 100, int 0)              ; <bool> [#uses=1]
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=1]
        br bool %tmp.8, label %return, label %no_exit
llvm-svn: 19536
 | 
| | 
| 
| 
|  | 
llvm-svn: 19535
 | 
| | 
| 
| 
|  | 
llvm-svn: 19534
 | 
| | 
| 
| 
|  | 
llvm-svn: 19533
 | 
| | 
| 
| 
| 
| 
|  | 
pressure.
llvm-svn: 19532
 | 
| | 
| 
| 
|  | 
llvm-svn: 19531
 | 
| | 
| 
| 
|  | 
llvm-svn: 19529
 | 
| | 
| 
| 
|  | 
llvm-svn: 19528
 | 
| | 
| 
| 
|  | 
llvm-svn: 19527
 | 
| | 
| 
| 
|  | 
llvm-svn: 19526
 | 
| | 
| 
| 
| 
| 
| 
|  | 
of cases where we accidentally emitted a load folded once and unfolded
elsewhere.
llvm-svn: 19522
 | 
| | 
| 
| 
| 
| 
|  | 
This fixes llvm-test/SingleSource/Regression/C/casts.c
llvm-svn: 19519
 | 
| | 
| 
| 
| 
| 
| 
|  | 
Checking to see if the load has two uses is not equivalent, as the chain
value may have zero uses.
llvm-svn: 19518
 | 
| | 
| 
| 
|  | 
llvm-svn: 19517
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
movsbl 4(%esp), %eax
        movl %eax, %edx
        sarl $7, %edx
Now we generate:
        movsbl 4(%esp), %eax
        movl %eax, %edx
        sarl $31, %edx
Which is right.
llvm-svn: 19515
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
imul %EAX, %EAX, 400
        add %ECX, %EAX
        add %ESI, DWORD PTR [%ECX + 4*%EDX]
        inc %EDX
        cmp %EDX, 100
instead of this:
        imul %EAX, %EAX, 400
        add %ECX, %EAX
        mov %EAX, %EDX
        shl %EAX, 2
        add %ECX, %EAX
        add %ESI, DWORD PTR [%ECX]
        inc %EDX
        cmp %EDX, 100
llvm-svn: 19513
 | 
| | 
| 
| 
|  | 
llvm-svn: 19512
 | 
| | 
| 
| 
|  | 
llvm-svn: 19511
 | 
| | 
| 
| 
| 
| 
|  | 
This fails for shifts because the constant is always 8 bits.
llvm-svn: 19508
 | 
| | 
| 
| 
| 
| 
|  | 
This fixes FreeBench/pcompress
llvm-svn: 19507
 | 
| | 
| 
| 
|  | 
llvm-svn: 19506
 | 
| | 
| 
| 
|  | 
llvm-svn: 19504
 | 
| | 
| 
| 
| 
| 
|  | 
to be dynamically initialized. :(
llvm-svn: 19503
 | 
| | 
| 
| 
| 
| 
|  | 
FP_REG_KILL into a block that had a successor with a FP PHI node.
llvm-svn: 19502
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
mov %AX, WORD PTR [0]
instead of like this:
        mov %AX, WORD PTR []
llvm-svn: 19501
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
movw 0, %ax
instead of like this:
        movw , %ax
llvm-svn: 19500
 | 
| | 
| 
| 
|  | 
llvm-svn: 19499
 | 
| | 
| 
| 
|  | 
llvm-svn: 19498
 | 
| | 
| 
| 
|  | 
llvm-svn: 19496
 | 
| | 
| 
| 
| 
| 
| 
|  | 
contain FP PHI nodes but no other FP defining instructions.  This fixes
183.equake
llvm-svn: 19495
 | 
| | 
| 
| 
|  | 
llvm-svn: 19494
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
|  | 
256.bzip2 from 7142 to 7103 lines of .s file.
Second, add initial support for folding loads into compares, though this code
is dynamically dead for now. :(
llvm-svn: 19493
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
several times in 256.bzip2:
        mov %EAX, DWORD PTR [%ESP + 204]
-       mov %EAX, DWORD PTR [%EAX]
-       or %EAX, 2097152
-       mov %ECX, DWORD PTR [%ESP + 204]
-       mov DWORD PTR [%ECX], %EAX
+       or DWORD PTR [%EAX], 2097152
llvm-svn: 19492
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
mov %AL, BYTE PTR [%EDX + l18_length_code]
  movzx %EAX, %AL
Emit:
  movzx %EAX, BYTE PTR [%EDX + l18_length_code]
llvm-svn: 19489
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
Select [mem] += Val operations.  For constants, we used to get:
  mov %ECX, -32768
  add %ECX, DWORD PTR [l4_match_start]
  mov DWORD PTR [l4_match_start], %ECX
Now we get:
  add DWORD PTR [l4_match_start], -32768
For other values we used to get:
  mov %EBP, %EDI   ;; because the add destroys the value
  add %EBP, DWORD PTR [l4_input_len]
  mov DWORD PTR [l4_input_len], %EBP
now we get:
  add DWORD PTR [l4_input_len], %EDI
Both of these use less registers than the alternative, are faster and smaller.
llvm-svn: 19488
 | 
| | 
| 
| 
|  | 
llvm-svn: 19487
 | 
| | 
| 
| 
| 
| 
|  | 
folded into an instruction.
llvm-svn: 19486
 | 
| | 
| 
| 
|  | 
llvm-svn: 19485
 | 
| | 
| 
| 
| 
| 
|  | 
same for PHI nodes.
llvm-svn: 19484
 | 
| | 
| 
| 
| 
| 
| 
|  | 
* Fold loads into Add, sub, and, or, xor and mul when possible.
* Codegen shl X, 1 as add X, X
llvm-svn: 19483
 | 
| | 
| 
| 
|  | 
llvm-svn: 19482
 | 
| | 
| 
| 
|  | 
llvm-svn: 19480
 | 
| | 
| 
| 
|  | 
llvm-svn: 19475
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
mov %ECX, %EAX
        add %ECX, 32768
        mov %SI, WORD PTR [2*%ECX + l13_prev]
Generate this:
        mov %SI, WORD PTR [2*%ECX + l13_prev + 65536]
This occurs when you have a GEP instruction where an index is
"something + imm".
llvm-svn: 19472
 |