1 ; RUN: opt < %s -gvn -enable-load-pre -S | not grep {tmp3 = load}
3 @p = external global i32
4 define i32 @f(i32 %n) nounwind {
8 for.cond: ; preds = %for.inc, %entry
9 %i.0 = phi i32 [ 0, %entry ], [ %indvar.next, %for.inc ] ; <i32> [#uses=2]
10 %cmp = icmp slt i32 %i.0, %n ; <i1> [#uses=1]
11 br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
13 for.cond.for.end_crit_edge: ; preds = %for.cond
16 for.body: ; preds = %for.cond
17 %tmp3 = load i32* @p ; <i32> [#uses=1]
18 %dec = add i32 %tmp3, -1 ; <i32> [#uses=2]
19 store i32 %dec, i32* @p
20 %cmp6 = icmp slt i32 %dec, 0 ; <i1> [#uses=1]
21 br i1 %cmp6, label %for.body.for.end_crit_edge, label %for.inc
23 for.body.for.end_crit_edge: ; preds = %for.body
26 for.inc: ; preds = %for.body
27 %indvar.next = add i32 %i.0, 1 ; <i32> [#uses=1]
30 for.end: ; preds = %for.body.for.end_crit_edge, %for.cond.for.end_crit_edge
31 %tmp9 = load i32* @p ; <i32> [#uses=1]