[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / Analysis / MemorySSA / print-dot-cfg-mssa.ll
blob825edf05417294b9ac09c36628be7dc1edb6e0ae
1 ; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>' -dot-cfg-mssa=out.dot < %s 2>&1 > /dev/null
2 ; RUN: FileCheck %s -input-file=out.dot
4 ; Test -dot-cfg-mssa option for -print-memoryssa.
5 ; Test is based on following C code with some forwarding basic blocks
6 ; added to show that only those blocks with memory ssa comments
7 ; are colourized.
9 ;void g();
11 ;int f(int *p, int *q, int *r) {
12 ;  int i = 0;
13 ;  if (*r)
14 ;    i = 1;
15 ;  else
16 ;    g();
17 ;  *p = *q + 1;
18 ;  if (i)
19 ;    ++i;
20 ;  return *q;
23 define signext i32 @f(i32* %p, i32* %q, i32* %r) {
24 entry:
25   br label %bb1
27 bb1:
28   %p.addr = alloca i32*, align 8
29   %q.addr = alloca i32*, align 8
30   %r.addr = alloca i32*, align 8
31   %i = alloca i32, align 4
32   store i32* %p, i32** %p.addr, align 8
33   store i32* %q, i32** %q.addr, align 8
34   store i32* %r, i32** %r.addr, align 8
35   %0 = bitcast i32* %i to i8*
36   store i32 0, i32* %i, align 4
37   %1 = load i32*, i32** %r.addr, align 8
38   %2 = load i32, i32* %1, align 4
39   %tobool = icmp ne i32 %2, 0
40   br i1 %tobool, label %if.then, label %if.else
42 if.then:
43   store i32 1, i32* %i, align 4
44   br label %bb2
46 bb2:
47   br label %if.end
49 if.else:
50   call void bitcast (void (...)* @g to void ()*)()
51   br label %if.end
53 if.end:
54   %3 = load i32*, i32** %q.addr, align 8
55   %4 = load i32, i32* %3, align 4
56   %add = add nsw i32 %4, 1
57   %5 = load i32*, i32** %p.addr, align 8
58   store i32 %add, i32* %5, align 4
59   %6 = load i32, i32* %i, align 4
60   %tobool1 = icmp ne i32 %6, 0
61   br i1 %tobool1, label %if.then2, label %if.end3
63 if.then2:
64   %7 = load i32, i32* %i, align 4
65   %inc = add nsw i32 %7, 1
66   br label %bb3
68 bb3:
69   store i32 %inc, i32* %i, align 4
70   br label %if.end3
72 if.end3:
73   br label %bb4
75 bb4:
76   %8 = load i32*, i32** %q.addr, align 8
77   %9 = load i32, i32* %8, align 4
78   %10 = bitcast i32* %i to i8*
79   ret i32 %9
82 declare void @g(...)
84 ; CHECK: digraph "MSSA"
85 ; CHECK-NEXT: label="MSSA";
86 ; CHECK: {{Node0x.* [shape=record,label="{entry:.*}"]}}
87 ; CHECK: {{[shape=record,style=filled, fillcolor=lightpink,label="{bb1:.*1 = MemoryDef(liveOnEntry).*2 = MemoryDef(1).*3 = MemoryDef(2).*4 = MemoryDef(3).*MemoryUse(3).*MemoryUse(liveOnEntry).*}"]}}
88 ; CHECK {{[shape=record,style=filled, fillcolor=lightpink,label="{if.then:.*5 = MemoryDef(4).*}"]}}
89 ; CHECK {{[shape=record,label="{bb2:.*}"]}}
90 ; CHECK {{[shape=record,style=filled, fillcolor=lightpink,label="{if.else:.*6 = MemoryDef(4).*}"]}}
91 ; CHECK {{[shape=record,style=filled, fillcolor=lightpink,label="{if.end:.*10 = MemoryPhi({bb2,5},{if.else,6})/*MemoryUse(2).*MemoryUse(10).*MemoryUse(1).*7 = MemoryDef(10).*MemoryUse(10).*}"]}}
92 ; CHECK {{[shape=record,style=filled, fillcolor=lightpink,label="{if.then2:.*MemoryUse(10).*}"]}}
93 ; CHECK {{[shape=record,style=filled, fillcolor=lightpink,label="{bb3:.*8 = MemoryDef(7).*}"]}}
94 ; CHECK {{[shape=record,style=filled, fillcolor=lightpink,label="{if.end3:.*9 = MemoryPhi({if.end,7},{bb3,8}).*}"]}}
95 ; CHECK {{[shape=record,style=filled, fillcolor=lightpink,label="{bb4:.*MemoryUse(2).*MemoryUse(7).*}"]}}