• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>' -disable-output < %s 2>&1 | FileCheck %s
3; This test checks a number of things:
4; First, the lifetime markers should not clobber any uses of Q or P.
5; Second, the loads of P are MemoryUse(LiveOnEntry) due to the placement of the markers vs the loads.
6
7define i8 @test(i8* %P, i8* %Q) {
8entry:
9; CHECK:  1 = MemoryDef(liveOnEntry)
10; CHECK-NEXT:   call void @llvm.lifetime.start.p0i8(i64 32, i8* %P)
11  call void @llvm.lifetime.start.p0i8(i64 32, i8* %P)
12; CHECK:  MemoryUse(1)
13; CHECK-NEXT:   %0 = load i8, i8* %P
14  %0 = load i8, i8* %P
15; CHECK:  2 = MemoryDef(1)
16; CHECK-NEXT:   store i8 1, i8* %P
17  store i8 1, i8* %P
18; CHECK:  3 = MemoryDef(2)
19; CHECK-NEXT:   call void @llvm.lifetime.end.p0i8(i64 32, i8* %P)
20  call void @llvm.lifetime.end.p0i8(i64 32, i8* %P)
21; CHECK:  MemoryUse(liveOnEntry)
22; CHECK-NEXT:   %1 = load i8, i8* %P
23  %1 = load i8, i8* %P
24; CHECK:  MemoryUse(2)
25; CHECK-NEXT:   %2 = load i8, i8* %Q
26  %2 = load i8, i8* %Q
27  ret i8 %1
28}
29declare void @llvm.lifetime.start.p0i8(i64 %S, i8* nocapture %P) readonly
30declare void @llvm.lifetime.end.p0i8(i64 %S, i8* nocapture %P)
31