Daniel Berlin | df10119 | 2016-08-03 00:01:46 +0000 | [diff] [blame] | 1 | ; 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 | |
| 7 | define i8 @test(i8* %P, i8* %Q) { |
| 8 | entry: |
| 9 | ; CHECK: 1 = MemoryDef(liveOnEntry) |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 10 | ; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 32, i8* %P) |
| 11 | call void @llvm.lifetime.start.p0i8(i64 32, i8* %P) |
Daniel Berlin | 74603a6 | 2017-04-10 18:46:00 +0000 | [diff] [blame] | 12 | ; CHECK: MemoryUse(1) |
Daniel Berlin | df10119 | 2016-08-03 00:01:46 +0000 | [diff] [blame] | 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) |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 19 | ; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 32, i8* %P) |
| 20 | call void @llvm.lifetime.end.p0i8(i64 32, i8* %P) |
Daniel Berlin | df10119 | 2016-08-03 00:01:46 +0000 | [diff] [blame] | 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 | } |
Matt Arsenault | f10061e | 2017-04-10 20:18:21 +0000 | [diff] [blame] | 29 | declare void @llvm.lifetime.start.p0i8(i64 %S, i8* nocapture %P) readonly |
| 30 | declare void @llvm.lifetime.end.p0i8(i64 %S, i8* nocapture %P) |