blob: f1db15cc577d5e64dddbbd1ccbe863e735746017 [file] [log] [blame]
Daniel Berlindf101192016-08-03 00:01:46 +00001; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -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)
Matt Arsenaultf10061e2017-04-10 20:18:21 +000010; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 32, i8* %P)
11 call void @llvm.lifetime.start.p0i8(i64 32, i8* %P)
Daniel Berlin74603a62017-04-10 18:46:00 +000012; CHECK: MemoryUse(1)
Daniel Berlindf101192016-08-03 00:01:46 +000013; 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)
Matt Arsenaultf10061e2017-04-10 20:18:21 +000019; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 32, i8* %P)
20 call void @llvm.lifetime.end.p0i8(i64 32, i8* %P)
Daniel Berlindf101192016-08-03 00:01:46 +000021; 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}
Matt Arsenaultf10061e2017-04-10 20:18:21 +000029declare void @llvm.lifetime.start.p0i8(i64 %S, i8* nocapture %P) readonly
30declare void @llvm.lifetime.end.p0i8(i64 %S, i8* nocapture %P)