-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[DirectX] Allow llvm lifetime intrinsics to pass on to the DirectX backend #136622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ckend fixes llvm#136620 It was determined that the lifetime intrinsics generated by clang are likely more correct than the ones in DXC hence explaining the missing lifetimes between the IR diffs. As such we are legalizing lllvm lifetime intrinsics by letting them all pass on through.
@llvm/pr-subscribers-backend-directx Author: Farzon Lotfi (farzonl) Changesfixes #136620 It was determined that the lifetime intrinsics generated by clang are likely more correct than the ones in DXC hence explaining the missing lifetimes between the IR diffs. As such we are legalizing lllvm lifetime intrinsics by letting them all pass on through. Full diff: https://github.com/llvm/llvm-project/pull/136622.diff 2 Files Affected:
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index f28171b6d4908..fe6dff57e2625 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -753,6 +753,8 @@ class OpLowerer {
case Intrinsic::dx_resource_casthandle:
// NOTE: llvm.dbg.value is supported as is in DXIL.
case Intrinsic::dbg_value:
+ case Intrinsic::lifetime_start:
+ case Intrinsic::lifetime_end:
case Intrinsic::not_intrinsic:
continue;
default: {
diff --git a/llvm/test/CodeGen/DirectX/legalize-lifetimes.ll b/llvm/test/CodeGen/DirectX/legalize-lifetimes.ll
new file mode 100644
index 0000000000000..7997734a75c1d
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/legalize-lifetimes.ll
@@ -0,0 +1,20 @@
+; RUN: opt -S -passes='dxil-op-lower' -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
+
+; CHECK-NOT: error: Unsupported intrinsic llvm.lifetime.start.p0 for DXIL lowering
+; CHECK-NOT: error: Unsupported intrinsic llvm.lifetime.end.p0 for DXIL lowering
+; CHECK-LABEL: define void @test_legal_lifetime() {
+; CHECK-NEXT: [[ACCUM_I_FLAT:%.*]] = alloca [1 x i32], align 4
+; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[ACCUM_I_FLAT]], i32 0
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[ACCUM_I_FLAT]])
+; CHECK-NEXT: store i32 0, ptr [[GEP]], align 4
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr nonnull [[ACCUM_I_FLAT]])
+; CHECK-NEXT: ret void
+;
+define void @test_legal_lifetime() {
+ %accum.i.flat = alloca [1 x i32], align 4
+ %gep = getelementptr i32, ptr %accum.i.flat, i32 0
+ call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %accum.i.flat)
+ store i32 0, ptr %gep, align 4
+ call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %accum.i.flat)
+ ret void
+}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/16452 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/51/builds/14845 Here is the relevant piece of the build log for the reference
|
…ckend (llvm#136622) fixes llvm#136620 It was determined that the lifetime intrinsics generated by clang are likely more correct than the ones in DXC hence explaining the missing lifetimes between the IR diffs. As such we are legalizing lllvm lifetime intrinsics by letting them all pass on through.
…ckend (llvm#136622) fixes llvm#136620 It was determined that the lifetime intrinsics generated by clang are likely more correct than the ones in DXC hence explaining the missing lifetimes between the IR diffs. As such we are legalizing lllvm lifetime intrinsics by letting them all pass on through.
…ckend (llvm#136622) fixes llvm#136620 It was determined that the lifetime intrinsics generated by clang are likely more correct than the ones in DXC hence explaining the missing lifetimes between the IR diffs. As such we are legalizing lllvm lifetime intrinsics by letting them all pass on through.
fixes #136620
It was determined that the lifetime intrinsics generated by clang are likely more correct than the ones in DXC hence explaining the missing lifetimes between the IR diffs.
As such we are legalizing lllvm lifetime intrinsics by letting them all pass on through.