1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
| ; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
; hfinkel's case
; [entry]
; |
; .....
; (clobbering access - b)
; |
; .... ________________________________
; \ / |
; (x) |
; ...... |
; | |
; | ______________________ |
; \ / | |
; (starting access) | |
; ... | |
; (clobbering access - a) | |
; ... | |
; | | | |
; | |_______________________| |
; | |
; |_________________________________|
;
; More specifically, one access, with multiple clobbering accesses. One of
; which strictly dominates the access, the other of which has a backedge
; readnone so we don't have a 1:1 mapping of MemorySSA edges to Instructions.
declare void @doThingWithoutReading() readnone
declare i8 @getValue() readnone
declare i1 @getBool() readnone
define hidden void @testcase(i8* %Arg) {
Entry:
call void @doThingWithoutReading()
%Val.Entry = call i8 @getValue()
; CHECK: 1 = MemoryDef(liveOnEntry)
; CHECK-NEXT: store i8 %Val.Entry
store i8 %Val.Entry, i8* %Arg
call void @doThingWithoutReading()
br label %OuterLoop
OuterLoop:
; CHECK: 5 = MemoryPhi({Entry,1},{InnerLoop.Tail,3})
; CHECK-NEXT: %Val.Outer =
%Val.Outer = call i8 @getValue()
; CHECK: 2 = MemoryDef(5)
; CHECK-NEXT: store i8 %Val.Outer
store i8 %Val.Outer, i8* %Arg
call void @doThingWithoutReading()
br label %InnerLoop
InnerLoop:
; CHECK: 4 = MemoryPhi({OuterLoop,2},{InnerLoop,3})
; CHECK-NEXT: ; MemoryUse(4)
; CHECK-NEXT: %StartingAccess = load
%StartingAccess = load i8, i8* %Arg, align 4
%Val.Inner = call i8 @getValue()
; CHECK: 3 = MemoryDef(4)
; CHECK-NEXT: store i8 %Val.Inner
store i8 %Val.Inner, i8* %Arg
call void @doThingWithoutReading()
%KeepGoing = call i1 @getBool()
br i1 %KeepGoing, label %InnerLoop.Tail, label %InnerLoop
InnerLoop.Tail:
%KeepGoing.Tail = call i1 @getBool()
br i1 %KeepGoing.Tail, label %End, label %OuterLoop
End:
ret void
}
|