1 ; RUN: opt < %s -basicaa -licm -S | FileCheck %s
2 ; RUN: opt -aa-pipeline=type-based-aa,basic-aa -passes='require<aa>,require<targetir>,require<scalar-evolution>,require<opt-remark-emit>,loop(licm)' -S %s | FileCheck %s
4 ; Make sure we don't hoist a conditionally-executed store out of the loop;
5 ; it would violate the concurrency memory model
7 @g = common global i32 0, align 4
9 define void @bar(i32 %n, i32 %b) nounwind uwtable ssp {
13 for.cond: ; preds = %for.inc, %entry
14 %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc ]
15 %cmp = icmp slt i32 %i.0, %n
16 br i1 %cmp, label %for.body, label %for.end
18 for.body: ; preds = %for.cond
19 %tobool = icmp eq i32 %b, 0
20 br i1 %tobool, label %for.inc, label %if.then
22 if.then: ; preds = %for.body
23 %tmp3 = load i32, i32* @g, align 4
24 %inc = add nsw i32 %tmp3, 1
25 store i32 %inc, i32* @g, align 4
28 ; CHECK: load i32, i32*
30 ; CHECK-NEXT: store i32
32 for.inc: ; preds = %for.body, %if.then
33 %inc5 = add nsw i32 %i.0, 1
36 for.end: ; preds = %for.cond