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