1 ; RUN: opt -disable-output -aa-pipeline=basic-aa -passes='loop-mssa(licm),print<memoryssa>' < %s 2>&1 | FileCheck %s
3 ; CHECK-LABEL: @f(i1 %arg)
6 ; CHECK-NEXT: ; [[NO4:.*]] = MemoryPhi({entry,liveOnEntry},{lbl1.backedge,[[NO9:.*]]})
7 ; CHECK-NEXT: ; [[NO2:.*]] = MemoryDef([[NO4]])
8 ; CHECK-NEXT: call void @g()
9 ; CHECK-NEXT: br i1 %arg, label %for.end, label %if.else
12 ; CHECK-NEXT: br i1 %arg, label %lbl3, label %lbl2
15 ; CHECK-NEXT: ; [[NO8:.*]] = MemoryPhi({lbl3,[[NO7:.*]]},{for.end,[[NO2]]})
16 ; CHECK-NEXT: br label %lbl3
19 ; CHECK-NEXT: [[NO7]] = MemoryPhi({lbl2,[[NO8]]},{for.end,2})
22 ; CHECK-NEXT: MemoryUse([[NO2]])
23 ; CHECK-NEXT: %cleanup.dest = load i32, ptr undef, align 1
25 ; CHECK: lbl1.backedge:
26 ; CHECK-NEXT: [[NO9]] = MemoryPhi({cleanup,[[NO7]]},{if.else,2})
27 ; CHECK-NEXT: br label %lbl1
29 ; CHECK: cleanup.cont:
30 ; CHECK-NEXT: ; [[NO6:.*]] = MemoryDef([[NO7]])
31 ; CHECK-NEXT: store i16 undef, ptr %e, align 1
32 ; CHECK-NEXT: 3 = MemoryDef([[NO6]])
33 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr null)
35 define void @f(i1 %arg) {
37 %e = alloca i16, align 1
40 lbl1: ; preds = %if.else, %cleanup, %entry
41 store i16 undef, ptr %e, align 1
43 br i1 %arg, label %for.end, label %if.else
45 for.end: ; preds = %lbl1
46 br i1 %arg, label %lbl3, label %lbl2
48 lbl2: ; preds = %lbl3, %for.end
51 lbl3: ; preds = %lbl2, %for.end
52 br i1 %arg, label %lbl2, label %cleanup
54 cleanup: ; preds = %lbl3
55 %cleanup.dest = load i32, ptr undef, align 1
56 %switch = icmp ult i32 %cleanup.dest, 1
57 br i1 %switch, label %cleanup.cont, label %lbl1
59 cleanup.cont: ; preds = %cleanup
60 call void @llvm.lifetime.end.p0(i64 1, ptr null)
63 if.else: ; preds = %lbl1
69 ; Function Attrs: argmemonly nounwind willreturn
70 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)