1 ; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
3 ; Testing many dominators, specifically from a switch statement in C.
5 declare i1 @getBool() readnone
7 define i32 @foo(ptr %p) {
12 ; CHECK: 8 = MemoryPhi({entry,liveOnEntry},{sw.epilog,6})
14 %n = phi i32 [ 0, %entry ], [ %1, %sw.epilog ]
15 %m = alloca i32, align 4
16 switch i32 %n, label %sw.default [
24 ; CHECK: 1 = MemoryDef(8)
25 ; CHECK-NEXT: store i32 1
26 store i32 1, ptr %m, align 4
30 ; CHECK: 2 = MemoryDef(8)
31 ; CHECK-NEXT: store i32 2
32 store i32 2, ptr %m, align 4
36 ; CHECK: 3 = MemoryDef(8)
37 ; CHECK-NEXT: store i32 3
38 store i32 3, ptr %m, align 4
42 ; CHECK: 4 = MemoryDef(8)
43 ; CHECK-NEXT: store i32 4
44 store i32 4, ptr %m, align 4
48 ; CHECK: 5 = MemoryDef(8)
49 ; CHECK-NEXT: store i32 5
50 store i32 5, ptr %m, align 4
54 ; CHECK: 7 = MemoryPhi({sw.default,5},{sw.bb,1},{sw.bb1,2},{sw.bb2,3},{sw.bb3,4})
55 ; CHECK-NEXT: MemoryUse(7)
57 %0 = load i32, ptr %m, align 4
58 ; CHECK: 6 = MemoryDef(7)
60 %1 = load volatile i32, ptr %p, align 4
61 %2 = icmp eq i32 %0, %1
62 br i1 %2, label %exit, label %loopbegin