llvm.org GIT mirror llvm / 4c07450
Update this testcase. The output needs to be disabled to pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45478 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 11 years ago
1 changed file(s) with 23 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llvm-upgrade < %s | llvm-as | opt -licm -stats |& \
0 ; RUN: llvm-as < %s | opt -licm -disable-output -stats |& \
11 ; RUN: grep {memory locations promoted to register}
2 @X = global i32 7 ; [#uses=4]
23
3 %X = global int 7
4
5 void %testfunc(int %i) {
4 define void @testfunc(i32 %i) {
5 ;
66 br label %Loop
77
8 Loop:
9 %j = phi uint [0, %0], [%Next, %Loop]
8 Loop: ; preds = %Loop, %0
9 %j = phi i32 [ 0, %0 ], [ %Next, %Loop ] ; [#uses=1]
10 %x = load i32* @X ; [#uses=1]
11 %x2 = add i32 %x, 1 ; [#uses=1]
12 store i32 %x2, i32* @X
13 %Next = add i32 %j, 1 ; [#uses=2]
14 %cond = icmp eq i32 %Next, 0 ; [#uses=1]
15 br i1 %cond, label %Out, label %Loop
1016
11 %x = load int* %X ; Should promote this to a register inside of loop!
12 %x2 = add int %x, 1
13 store int %x2, int* %X
14
15 %Next = add uint %j, 1
16 %cond = seteq uint %Next, 0
17 br bool %cond, label %Out, label %Loop
18
19 Out:
17 Out: ; preds = %Loop
2018 ret void
2119 }
2220
23 void %testhard(int %i) {
21 define void @testhard(i32 %i) {
2422 br label %Loop
25 Loop:
26 %X1 = getelementptr int* %X, long 0
27 %A = load int* %X1 ; Aliases X, needs to be rewritten
28 %V = add int %A, 1
29 %X2 = getelementptr int* %X, long 0
30 store int %V, int* %X2
31 br bool false, label %Loop, label %Exit
3223
33 Exit:
24 Loop: ; preds = %Loop, %0
25 %X1 = getelementptr i32* @X, i64 0 ; [#uses=1]
26 %A = load i32* %X1 ; [#uses=1]
27 %V = add i32 %A, 1 ; [#uses=1]
28 %X2 = getelementptr i32* @X, i64 0 ; [#uses=1]
29 store i32 %V, i32* %X2
30 br i1 false, label %Loop, label %Exit
31
32 Exit: ; preds = %Loop
3433 ret void
35
3634 }