1 ; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>' -verify-memoryssa < %s 2>&1 | FileCheck %s
3 ; Things that BasicAA can prove points to constant memory should be
4 ; liveOnEntry, as well.
6 declare void @clobberAllTheThings()
8 @str = private unnamed_addr constant [2 x i8] c"hi"
11 ; CHECK: 1 = MemoryDef(liveOnEntry)
12 ; CHECK-NEXT: call void @clobberAllTheThings()
13 call void @clobberAllTheThings()
14 ; CHECK: MemoryUse(liveOnEntry)
15 ; CHECK-NEXT: %1 = load i8
16 %1 = load i8, ptr @str, align 1
17 %2 = getelementptr [2 x i8], ptr @str, i64 0, i64 1
18 ; CHECK: MemoryUse(liveOnEntry)
19 ; CHECK-NEXT: %3 = load i8
20 %3 = load i8, ptr %2, align 1
25 define i8 @select(i1 %b) {
26 %1 = alloca i8, align 1
27 ; CHECK: 1 = MemoryDef(liveOnEntry)
28 ; CHECK-NEXT: store i8 0
29 store i8 0, ptr %1, align 1
31 ; CHECK: 2 = MemoryDef(1)
32 ; CHECK-NEXT: call void @clobberAllTheThings()
33 call void @clobberAllTheThings()
34 %2 = select i1 %b, ptr @str, ptr %1
36 ; CHECK-NEXT: %3 = load i8
37 %3 = load i8, ptr %2, align 1