• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
2; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
3define void @F(i8*) {
4  br i1 true, label %left, label %right
5left:
6; CHECK: 1 = MemoryDef(liveOnEntry)
7  store i8 16, i8* %0
8  br label %merge
9right:
10  br label %merge
11
12merge:
13; CHECK-NOT: 2 = MemoryPhi
14ret void
15}
16
17define void @F2(i8*) {
18  br i1 true, label %left, label %right
19left:
20; CHECK: 1 = MemoryDef(liveOnEntry)
21  store i8 16, i8* %0
22  br label %merge
23right:
24  br label %merge
25
26merge:
27; CHECK: 2 = MemoryPhi({left,1},{right,liveOnEntry})
28%c = load i8, i8* %0
29ret void
30}
31
32; Ensure we treat def-only blocks as though they have uses for phi placement.
33; CHECK-LABEL: define void @F3
34define void @F3() {
35  %a = alloca i8
36; CHECK: 1 = MemoryDef(liveOnEntry)
37; CHECK-NEXT: store i8 0, i8* %a
38  store i8 0, i8* %a
39  br i1 undef, label %if.then, label %if.end
40
41if.then:
42; CHECK: 2 = MemoryDef(1)
43; CHECK-NEXT: store i8 1, i8* %a
44  store i8 1, i8* %a
45  br label %if.end
46
47if.end:
48; CHECK: 4 = MemoryPhi({%0,1},{if.then,2})
49; CHECK: 3 = MemoryDef(4)
50; CHECK-NEXT: store i8 2, i8* %a
51  store i8 2, i8* %a
52  ret void
53}
54