1 ; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %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 %1 = getelementptr [2 x i8], [2 x i8]* @str, i64 0, i64 0
15 ; CHECK: MemoryUse(liveOnEntry)
16 ; CHECK-NEXT: %2 = load i8
17 %2 = load i8, i8* %1, align 1
18 %3 = getelementptr [2 x i8], [2 x i8]* @str, i64 0, i64 1
19 ; CHECK: MemoryUse(liveOnEntry)
20 ; CHECK-NEXT: %4 = load i8
21 %4 = load i8, i8* %3, align 1
26 define i8 @select(i1 %b) {
27 %1 = alloca i8, align 1
28 ; CHECK: 1 = MemoryDef(liveOnEntry)
29 ; CHECK-NEXT: store i8 0
30 store i8 0, i8* %1, align 1
32 ; CHECK: 2 = MemoryDef(1)
33 ; CHECK-NEXT: call void @clobberAllTheThings()
34 call void @clobberAllTheThings()
35 %2 = getelementptr [2 x i8], [2 x i8]* @str, i64 0, i64 0
36 %3 = select i1 %b, i8* %2, i8* %1
38 ; CHECK-NEXT: %4 = load i8
39 %4 = load i8, i8* %3, align 1