Skip to content

Conversation

@farzonl
Copy link
Member

@farzonl farzonl commented Oct 27, 2025

fixes #165051

Change is just to let the assume intrinsic pass on unmodified. Test is to confirm the DXIL disassembler doesn't blow up whe we generate DXIL with this intrinsic.

fixes llvm#165051

Change is just to let the assume intrinsic pass on unmodified.
Test is to confirm the DXIL disassembler doesn't blow up whe we
generate DXIL with this intrinsic.
@llvmbot
Copy link
Member

llvmbot commented Oct 27, 2025

@llvm/pr-subscribers-backend-directx

Author: Farzon Lotfi (farzonl)

Changes

fixes #165051

Change is just to let the assume intrinsic pass on unmodified. Test is to confirm the DXIL disassembler doesn't blow up whe we generate DXIL with this intrinsic.


Full diff: https://github.com/llvm/llvm-project/pull/165311.diff

2 Files Affected:

  • (modified) llvm/lib/Target/DirectX/DXILOpLowering.cpp (+2)
  • (added) llvm/test/tools/dxil-dis/llvm_assume.ll (+11)
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index e46a393e50906..8720460cceb20 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -904,6 +904,8 @@ class OpLowerer {
       case Intrinsic::dx_resource_casthandle:
       // NOTE: llvm.dbg.value is supported as is in DXIL.
       case Intrinsic::dbg_value:
+      // NOTE: llvm.assume is supported as is in DXIL.
+      case Intrinsic::assume:
       case Intrinsic::not_intrinsic:
         if (F.use_empty())
           F.eraseFromParent();
diff --git a/llvm/test/tools/dxil-dis/llvm_assume.ll b/llvm/test/tools/dxil-dis/llvm_assume.ll
new file mode 100644
index 0000000000000..f5be66c0d192f
--- /dev/null
+++ b/llvm/test/tools/dxil-dis/llvm_assume.ll
@@ -0,0 +1,11 @@
+; RUN: llc --filetype=obj %s -o - | dxil-dis -o - | FileCheck %s
+
+target triple = "dxil-pc-shadermodel6.7-library"
+
+define void @test_llvm_assume(i1 %0)  {
+; CHECK-LABEL: test_llvm_assume
+; CHECK-NEXT: tail call void @llvm.assume(i1 %0)
+tail call void @llvm.assume(i1 %0)
+ret void
+}
+

@farzonl
Copy link
Member Author

farzonl commented Oct 28, 2025

Just a note, we will want to use the offload test suite to see if the AMD, Intel, Nvidia, and Qualcomm gpu drivers can handle the assume llvm intrinsic. If they can't we should just remove this intrinsic. But for now we will allow it to pass on so we can run experiments. I can confirm right now that the metal tests are working with llvm.assume.

@farzonl farzonl merged commit dc76ac6 into llvm:main Oct 28, 2025
12 of 13 checks passed
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
fixes llvm#165051

Change is just to let the assume intrinsic pass on unmodified. Test is
to confirm the DXIL disassembler doesn't blow up whe we generate DXIL
with this intrinsic.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
fixes llvm#165051

Change is just to let the assume intrinsic pass on unmodified. Test is
to confirm the DXIL disassembler doesn't blow up whe we generate DXIL
with this intrinsic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DirectX] Add support for llvm.assume intrinsic to fix crash in DXIL Embedder

4 participants