Skip to content

Commit 340f55b

Browse files
committed
Add a test to ensure that dxil-embed removes lifetimes
1 parent f155758 commit 340f55b

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

llvm/test/CodeGen/DirectX/legalize-lifetimes-valver-1.6.ll

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
; RUN: opt -S -passes='dxil-op-lower' -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefixes=CHECK,CHECK-SM63
22
; RUN: opt -S -passes='dxil-op-lower' -mtriple=dxil-pc-shadermodel6.6-library %s | FileCheck %s --check-prefixes=CHECK,CHECK-SM66
3+
; RUN: opt -S -dxil-prepare -dxil-embed -mtriple=dxil-pc-shadermodel6.6-library %s | FileCheck %s --check-prefixes=CHECK,CHECK-EMBED
4+
5+
; Lifetime intrinsics are not valid prior to shader model 6.6 and are instead
6+
; replaced with undef stores, provided the validator version is 1.6 or greater
7+
8+
; The dxil-embed pass will remove lifetime intrinsics because they transformed
9+
; in a way that is illegal in modern LLVM IR before serializing to DXIL bitcode.
10+
; So we check that no bitcast or lifetime intrinsics remain after dxil-embed
311

412
; CHECK-LABEL: define void @test_legal_lifetime() {
5-
;
6-
; CHECK-SM63-NEXT: [[ACCUM_I_FLAT:%.*]] = alloca [1 x i32], align 4
7-
; CHECK-SM63-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[ACCUM_I_FLAT]], i32 0
8-
; CHECK-SM63-NEXT: store [1 x i32] undef, ptr [[ACCUM_I_FLAT]], align 4
9-
; CHECK-SM63-NEXT: store i32 0, ptr [[GEP]], align 4
10-
; CHECK-SM63-NEXT: store [1 x i32] undef, ptr [[ACCUM_I_FLAT]], align 4
11-
;
12-
; CHECK-SM66-NEXT: [[ACCUM_I_FLAT:%.*]] = alloca [1 x i32], align 4
13-
; CHECK-SM66-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[ACCUM_I_FLAT]], i32 0
14-
; CHECK-SM66-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[ACCUM_I_FLAT]])
15-
; CHECK-SM66-NEXT: store i32 0, ptr [[GEP]], align 4
16-
; CHECK-SM66-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr nonnull [[ACCUM_I_FLAT]])
17-
;
18-
; CHECK-NEXT: ret void
13+
; CHECK-NEXT: [[ACCUM_I_FLAT:%.*]] = alloca [1 x i32], align 4
14+
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[ACCUM_I_FLAT]], i32 0
15+
; CHECK-SM63-NEXT: store [1 x i32] undef, ptr [[ACCUM_I_FLAT]], align 4
16+
; CHECK-SM66-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[ACCUM_I_FLAT]])
17+
; CHECK-EMBED-NOT: bitcast
18+
; CHECK-EMBED-NOT: lifetime
19+
; CHECK-NEXT: store i32 0, ptr [[GEP]], align 4
20+
; CHECK-SM63-NEXT: store [1 x i32] undef, ptr [[ACCUM_I_FLAT]], align 4
21+
; CHECK-SM66-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr nonnull [[ACCUM_I_FLAT]])
22+
; CHECK-EMBED-NOT: bitcast
23+
; CHECK-EMBED-NOT: lifetime
24+
; CHECK-NEXT: ret void
1925
;
2026
define void @test_legal_lifetime() {
2127
%accum.i.flat = alloca [1 x i32], align 4

0 commit comments

Comments
 (0)