1 ; RUN: opt -disable-output -loop-simplify -licm -enable-new-pm=0 -print-memoryssa < %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 target triple = "x86_64-unknown-linux-gnu"
6 ; CHECK: 5 = MemoryPhi(
7 ; CHECK-NOT: 7 = MemoryPhi(
8 @v_67 = external dso_local global i32, align 1
9 @v_76 = external dso_local global i16, align 1
10 @v_86 = external dso_local global i16 *, align 1
12 define dso_local void @main() {
14 %v_59 = alloca i16, align 2
17 for.cond: ; preds = %for.body, %entry
18 br i1 undef, label %for.body, label %for.end
20 for.body: ; preds = %for.cond
21 store i16 undef, i16* %v_59, align 2
24 for.end: ; preds = %for.cond
25 br i1 undef, label %if.else568, label %cond.end82
27 cond.false69: ; No predecessors!
30 cond.end82: ; preds = %cond.false69, %cond.true55
31 br i1 undef, label %if.else568, label %land.lhs.true87
33 land.lhs.true87: ; preds = %cond.end82
34 br i1 undef, label %if.then88, label %if.else568
36 if.then88: ; preds = %land.lhs.true87
37 store i16 * @v_76, i16 ** @v_86, align 1
40 if.else568: ; preds = %land.lhs.true87, %cond.end82, %for.end
41 store volatile i32 undef, i32 * @v_67, align 1
44 if.end569: ; preds = %if.else568, %if.then88
50 ; CHECK: 7 = MemoryPhi(
51 ; CHECK: 6 = MemoryPhi(
52 ; CHECK: 10 = MemoryPhi(
53 ; CHECK: 9 = MemoryPhi(
54 ; CHECK: 8 = MemoryPhi(
57 %e = alloca i16, align 1
60 lbl1: ; preds = %if.else, %for.end5, %entry
61 store i16 undef, i16* %e, align 1
62 %0 = load i16, i16* %e, align 1
63 %call = call i16 @g(i16 %0)
64 br i1 undef, label %for.end, label %if.else
66 for.end: ; preds = %if.then
67 br i1 true, label %for.cond2, label %lbl2
69 lbl2: ; preds = %for.body4, %if.end
72 for.cond2: ; preds = %lbl3
73 br i1 undef, label %for.body4, label %for.end5
75 for.body4: ; preds = %for.cond2
78 for.end5: ; preds = %for.cond2
79 switch i32 undef, label %unreachable [
80 i32 0, label %if.end12
84 if.else: ; preds = %lbl1
85 switch i32 undef, label %unreachable [
86 i32 0, label %if.end12
90 if.end12: ; preds = %cleanup.cont11s, %cleanup.cont
91 call void @llvm.lifetime.end.p0i8(i64 1, i8* undef)
94 unreachable: ; preds = %if.else, %for.end5
100 ; Function Attrs: argmemonly nounwind willreturn
101 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)