1; RUN: opt -disable-output -licm -enable-new-pm=0 -print-memoryssa -enable-mssa-loop-dependency=true < %s 2>&1 | FileCheck %s 2; RUN: opt -disable-output -aa-pipeline=basic-aa -passes='loop-mssa(licm),print<memoryssa>' < %s 2>&1 | FileCheck %s 3 4; CHECK-LABEL: @f() 5 6; CHECK: lbl1: 7; CHECK-NEXT: ; [[NO4:.*]] = MemoryPhi({entry,liveOnEntry},{lbl1.backedge,[[NO9:.*]]}) 8; CHECK-NEXT: ; [[NO2:.*]] = MemoryDef([[NO4]]) 9; CHECK-NEXT: call void @g() 10; CHECK-NEXT: br i1 undef, label %for.end, label %if.else 11 12; CHECK: for.end: 13; CHECK-NEXT: br i1 undef, label %lbl3, label %lbl2 14 15; CHECK: lbl2: 16; CHECK-NEXT: ; [[NO8:.*]] = MemoryPhi({lbl3,[[NO7:.*]]},{for.end,[[NO2]]}) 17; CHECK-NEXT: br label %lbl3 18 19; CHECK: lbl3: 20; CHECK-NEXT: [[NO7]] = MemoryPhi({lbl2,[[NO8]]},{for.end,2}) 21 22; CHECK: cleanup: 23; CHECK-NEXT: MemoryUse([[NO7]]) 24; CHECK-NEXT: %cleanup.dest = load i32, i32* undef, align 1 25 26; CHECK: lbl1.backedge: 27; CHECK-NEXT: [[NO9]] = MemoryPhi({cleanup,[[NO7]]},{if.else,2}) 28; CHECK-NEXT: br label %lbl1 29 30; CHECK: cleanup.cont: 31; CHECK-NEXT: ; [[NO6:.*]] = MemoryDef([[NO7]]) 32; CHECK-NEXT: store i16 undef, i16* %e, align 1 33; CHECK-NEXT: 3 = MemoryDef([[NO6]]) 34; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* null) 35 36define void @f() { 37entry: 38 %e = alloca i16, align 1 39 br label %lbl1 40 41lbl1: ; preds = %if.else, %cleanup, %entry 42 store i16 undef, i16* %e, align 1 43 call void @g() 44 br i1 undef, label %for.end, label %if.else 45 46for.end: ; preds = %lbl1 47 br i1 undef, label %lbl3, label %lbl2 48 49lbl2: ; preds = %lbl3, %for.end 50 br label %lbl3 51 52lbl3: ; preds = %lbl2, %for.end 53 br i1 undef, label %lbl2, label %cleanup 54 55cleanup: ; preds = %lbl3 56 %cleanup.dest = load i32, i32* undef, align 1 57 %switch = icmp ult i32 %cleanup.dest, 1 58 br i1 %switch, label %cleanup.cont, label %lbl1 59 60cleanup.cont: ; preds = %cleanup 61 call void @llvm.lifetime.end.p0i8(i64 1, i8* null) 62 ret void 63 64if.else: ; preds = %lbl1 65 br label %lbl1 66} 67 68declare void @g() 69 70; Function Attrs: argmemonly nounwind willreturn 71declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) 72