llvm.org GIT mirror llvm / 61b8c9b
The pattern isel is aggressively codegen'ing all of the loads in these functions together at the start of the basic block, causing massive spillage. The old isel codegened the loads wherever they happened to land, so it generated good code for the first case, but bad code for the second. We really want the pattern isel to generate (the same) good code for both. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19448 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 15 years ago
1 changed file(s) with 72 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ;; Both functions in this testcase should codegen to the same function, and
1 ;; neither of them should require spilling anything to the stack.
2
3 ; RUN: llvm-as < %s | llc -march=x86 -disable-pattern-isel=0 -stats 2>&1 | not grep 'Number of register spills'
4
5 ;; This can be compiled to use three registers if the loads are not
6 ;; folded into the multiplies, 2 registers otherwise.
7 int %regpressure1(int* %P) {
8 %A = load int* %P
9 %Bp = getelementptr int* %P, int 1
10 %B = load int* %Bp
11 %s1 = mul int %A, %B
12 %Cp = getelementptr int* %P, int 2
13 %C = load int* %Cp
14 %s2 = mul int %s1, %C
15 %Dp = getelementptr int* %P, int 3
16 %D = load int* %Dp
17 %s3 = mul int %s2, %D
18 %Ep = getelementptr int* %P, int 4
19 %E = load int* %Ep
20 %s4 = mul int %s3, %E
21 %Fp = getelementptr int* %P, int 5
22 %F = load int* %Fp
23 %s5 = mul int %s4, %F
24 %Gp = getelementptr int* %P, int 6
25 %G = load int* %Gp
26 %s6 = mul int %s5, %G
27 %Hp = getelementptr int* %P, int 7
28 %H = load int* %Hp
29 %s7 = mul int %s6, %H
30 %Ip = getelementptr int* %P, int 8
31 %I = load int* %Ip
32 %s8 = mul int %s7, %I
33 %Jp = getelementptr int* %P, int 9
34 %J = load int* %Jp
35 %s9 = mul int %s8, %J
36 ret int %s9
37 }
38
39 ;; This testcase should produce identical code to the test above.
40 int %regpressure2(int* %P) {
41 %A = load int* %P
42 %Bp = getelementptr int* %P, int 1
43 %B = load int* %Bp
44 %Cp = getelementptr int* %P, int 2
45 %C = load int* %Cp
46 %Dp = getelementptr int* %P, int 3
47 %D = load int* %Dp
48 %Ep = getelementptr int* %P, int 4
49 %E = load int* %Ep
50 %Fp = getelementptr int* %P, int 5
51 %F = load int* %Fp
52 %Gp = getelementptr int* %P, int 6
53 %G = load int* %Gp
54 %Hp = getelementptr int* %P, int 7
55 %H = load int* %Hp
56 %Ip = getelementptr int* %P, int 8
57 %I = load int* %Ip
58 %Jp = getelementptr int* %P, int 9
59 %J = load int* %Jp
60 %s1 = mul int %A, %B
61 %s2 = mul int %s1, %C
62 %s3 = mul int %s2, %D
63 %s4 = mul int %s3, %E
64 %s5 = mul int %s4, %F
65 %s6 = mul int %s5, %G
66 %s7 = mul int %s6, %H
67 %s8 = mul int %s7, %I
68 %s9 = mul int %s8, %J
69 ret int %s9
70 }
71