mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
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. llvm-svn: 19448
This commit is contained in:
parent
07a3ade230
commit
0c47dfe0ce
72
test/Regression/CodeGen/X86/regpressure.ll
Normal file
72
test/Regression/CodeGen/X86/regpressure.ll
Normal file
@ -0,0 +1,72 @@
|
||||
;; Both functions in this testcase should codegen to the same function, and
|
||||
;; neither of them should require spilling anything to the stack.
|
||||
|
||||
; RUN: llvm-as < %s | llc -march=x86 -disable-pattern-isel=0 -stats 2>&1 | not grep 'Number of register spills'
|
||||
|
||||
;; This can be compiled to use three registers if the loads are not
|
||||
;; folded into the multiplies, 2 registers otherwise.
|
||||
int %regpressure1(int* %P) {
|
||||
%A = load int* %P
|
||||
%Bp = getelementptr int* %P, int 1
|
||||
%B = load int* %Bp
|
||||
%s1 = mul int %A, %B
|
||||
%Cp = getelementptr int* %P, int 2
|
||||
%C = load int* %Cp
|
||||
%s2 = mul int %s1, %C
|
||||
%Dp = getelementptr int* %P, int 3
|
||||
%D = load int* %Dp
|
||||
%s3 = mul int %s2, %D
|
||||
%Ep = getelementptr int* %P, int 4
|
||||
%E = load int* %Ep
|
||||
%s4 = mul int %s3, %E
|
||||
%Fp = getelementptr int* %P, int 5
|
||||
%F = load int* %Fp
|
||||
%s5 = mul int %s4, %F
|
||||
%Gp = getelementptr int* %P, int 6
|
||||
%G = load int* %Gp
|
||||
%s6 = mul int %s5, %G
|
||||
%Hp = getelementptr int* %P, int 7
|
||||
%H = load int* %Hp
|
||||
%s7 = mul int %s6, %H
|
||||
%Ip = getelementptr int* %P, int 8
|
||||
%I = load int* %Ip
|
||||
%s8 = mul int %s7, %I
|
||||
%Jp = getelementptr int* %P, int 9
|
||||
%J = load int* %Jp
|
||||
%s9 = mul int %s8, %J
|
||||
ret int %s9
|
||||
}
|
||||
|
||||
;; This testcase should produce identical code to the test above.
|
||||
int %regpressure2(int* %P) {
|
||||
%A = load int* %P
|
||||
%Bp = getelementptr int* %P, int 1
|
||||
%B = load int* %Bp
|
||||
%Cp = getelementptr int* %P, int 2
|
||||
%C = load int* %Cp
|
||||
%Dp = getelementptr int* %P, int 3
|
||||
%D = load int* %Dp
|
||||
%Ep = getelementptr int* %P, int 4
|
||||
%E = load int* %Ep
|
||||
%Fp = getelementptr int* %P, int 5
|
||||
%F = load int* %Fp
|
||||
%Gp = getelementptr int* %P, int 6
|
||||
%G = load int* %Gp
|
||||
%Hp = getelementptr int* %P, int 7
|
||||
%H = load int* %Hp
|
||||
%Ip = getelementptr int* %P, int 8
|
||||
%I = load int* %Ip
|
||||
%Jp = getelementptr int* %P, int 9
|
||||
%J = load int* %Jp
|
||||
%s1 = mul int %A, %B
|
||||
%s2 = mul int %s1, %C
|
||||
%s3 = mul int %s2, %D
|
||||
%s4 = mul int %s3, %E
|
||||
%s5 = mul int %s4, %F
|
||||
%s6 = mul int %s5, %G
|
||||
%s7 = mul int %s6, %H
|
||||
%s8 = mul int %s7, %I
|
||||
%s9 = mul int %s8, %J
|
||||
ret int %s9
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user