blob: d61473136f652bddb2de3df99b431caeeec57642 [file] [log] [blame]
Chris Lattner086c0142006-02-03 06:21:43 +00001Target Independent Opportunities:
2
3===-------------------------------------------------------------------------===
4
5FreeBench/mason contains code like this:
6
7static p_type m0u(p_type p) {
8 int m[]={0, 8, 1, 2, 16, 5, 13, 7, 14, 9, 3, 4, 11, 12, 15, 10, 17, 6};
9 p_type pu;
10 pu.a = m[p.a];
11 pu.b = m[p.b];
12 pu.c = m[p.c];
13 return pu;
14}
15
16We currently compile this into a memcpy from a static array into 'm', then
17a bunch of loads from m. It would be better to avoid the memcpy and just do
18loads from the static array.
19
20===-------------------------------------------------------------------------===
21
22Get the C front-end to expand hypot(x,y) -> llvm.sqrt(x*x+y*y) when errno and
23precision don't matter (ffastmath). Misc/mandel will like this. :)
24
25===-------------------------------------------------------------------------===
26
27For all targets, not just X86:
28When llvm.memcpy, llvm.memset, or llvm.memmove are lowered, they should be
29optimized to a few store instructions if the source is constant and the length
30is smallish (< 8). This will greatly help some tests like Shootout/strcat.c
31and fldry.
32
33//===---------------------------------------------------------------------===//
34
35Solve this DAG isel folding deficiency:
36
37int X, Y;
38
39void fn1(void)
40{
41 X = X | (Y << 3);
42}
43
44compiles to
45
46fn1:
47 movl Y, %eax
48 shll $3, %eax
49 orl X, %eax
50 movl %eax, X
51 ret
52
53The problem is the store's chain operand is not the load X but rather
54a TokenFactor of the load X and load Y, which prevents the folding.
55
56There are two ways to fix this:
57
581. The dag combiner can start using alias analysis to realize that y/x
59 don't alias, making the store to X not dependent on the load from Y.
602. The generated isel could be made smarter in the case it can't
61 disambiguate the pointers.
62
63Number 1 is the preferred solution.
64
65//===---------------------------------------------------------------------===//
66
Chris Lattner5946fef2006-02-15 19:52:06 +000067DAG combine this into mul A, 8:
68
69int %test(int %A) {
70 %B = mul int %A, 8 ;; shift
71 %C = add int %B, 7 ;; dead, no demanded bits.
72 %D = and int %C, -8 ;; dead once add is gone.
73 ret int %D
74}
75
76This sort of thing occurs in the alloca lowering code and other places that
77are generating alignment of an already aligned value.
78