1 ; RUN: llvm-as < %s | opt -licm -disable-output -stats |& \
2 ; RUN: grep {memory locations promoted to register}
3 @X = global i32 7 ; <i32*> [#uses=4]
5 define void @testfunc(i32 %i) {
9 Loop: ; preds = %Loop, %0
10 %j = phi i32 [ 0, %0 ], [ %Next, %Loop ] ; <i32> [#uses=1]
11 %x = load i32* @X ; <i32> [#uses=1]
12 %x2 = add i32 %x, 1 ; <i32> [#uses=1]
13 store i32 %x2, i32* @X
14 %Next = add i32 %j, 1 ; <i32> [#uses=2]
15 %cond = icmp eq i32 %Next, 0 ; <i1> [#uses=1]
16 br i1 %cond, label %Out, label %Loop
22 define void @testhard(i32 %i) {
25 Loop: ; preds = %Loop, %0
26 %X1 = getelementptr i32* @X, i64 0 ; <i32*> [#uses=1]
27 %A = load i32* %X1 ; <i32> [#uses=1]
28 %V = add i32 %A, 1 ; <i32> [#uses=1]
29 %X2 = getelementptr i32* @X, i64 0 ; <i32*> [#uses=1]
30 store i32 %V, i32* %X2
31 br i1 false, label %Loop, label %Exit