| 1 |
; RUN: llc --filetype=obj %s -o - | dxil-dis -o - | FileCheck %s |
| 2 |
target triple = "dxil-unknown-shadermodel6.7-library" |
| 3 |
|
| 4 |
define void @test_lifetimes() { |
| 5 |
; CHECK-LABEL: test_lifetimes |
| 6 |
; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [2 x i32], align 4 |
| 7 |
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast [2 x i32]* [[ALLOCA]] to i8* |
| 8 |
; CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* nonnull [[BITCAST]]) |
| 9 |
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast [2 x i32]* [[ALLOCA]] to i8* |
| 10 |
; CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* nonnull [[BITCAST]]) |
| 11 |
; CHECK-NEXT: ret void |
| 12 |
; |
| 13 |
%a = alloca [2 x i32], align 4 |
| 14 |
%gep = getelementptr [2 x i32], ptr %a, i32 0, i32 0 |
| 15 |
call void @llvm.lifetime.start.p0(ptr nonnull %a) |
| 16 |
store i32 0, ptr %gep, align 4 |
| 17 |
call void @llvm.lifetime.end.p0(ptr nonnull %a) |
| 18 |
ret void |
| 19 |
} |
| 20 |
|
| 21 |
; CHECK-DAG: attributes [[LIFETIME_ATTRS:#.*]] = { nounwind } |
| 22 |
|
| 23 |
; CHECK-DAG: ; Function Attrs: nounwind |
| 24 |
; CHECK-DAG: declare void @llvm.lifetime.start(i64, i8* nocapture) [[LIFETIME_ATTRS]] |
| 25 |
|
| 26 |
; CHECK-DAG: ; Function Attrs: nounwind |
| 27 |
; CHECK-DAG: declare void @llvm.lifetime.end(i64, i8* nocapture) [[LIFETIME_ATTRS]] |
| 28 |
|
| 29 |
; Function Attrs: nounwind memory(argmem: readwrite) |
| 30 |
declare void @llvm.lifetime.end.p0(ptr) #0 |
| 31 |
|
| 32 |
; Function Attrs: nounwind memory(argmem: readwrite) |
| 33 |
declare void @llvm.lifetime.start.p0(ptr) #0 |
| 34 |
|
| 35 |
attributes #0 = { nounwind memory(argmem: readwrite) } |
| 36 |
|