[llvm] ee4d815 - [DX] Remove IntrNoMem from create handle intrinsic

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 15:00:49 PDT 2022


Author: Chris Bieneman
Date: 2022-08-02T16:57:22-05:00
New Revision: ee4d8150083792242b3c56e5a7f9fe8aaa374b72

URL: https://github.com/llvm/llvm-project/commit/ee4d8150083792242b3c56e5a7f9fe8aaa374b72
DIFF: https://github.com/llvm/llvm-project/commit/ee4d8150083792242b3c56e5a7f9fe8aaa374b72.diff

LOG: [DX] Remove IntrNoMem from create handle intrinsic

The create handle intrinsic calls can't be removed, so it was incorrect
to mark them as IntrNoMem.

Added: 
    llvm/test/Transforms/EarlyCSE/DirectX/create_handle.ll

Modified: 
    llvm/include/llvm/IR/IntrinsicsDirectX.td

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/IntrinsicsDirectX.td b/llvm/include/llvm/IR/IntrinsicsDirectX.td
index 80e5b7919b9c6..2fe4fdfd5953b 100644
--- a/llvm/include/llvm/IR/IntrinsicsDirectX.td
+++ b/llvm/include/llvm/IR/IntrinsicsDirectX.td
@@ -18,5 +18,5 @@ def int_dx_thread_id_in_group : Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoM
 def int_dx_flattened_thread_id_in_group : Intrinsic<[llvm_i32_ty], [], [IntrNoMem, IntrWillReturn]>;
 
 def int_dx_create_handle : ClangBuiltin<"__builtin_hlsl_create_handle">,
-    Intrinsic<[ llvm_ptr_ty ], [llvm_i8_ty], [IntrNoMem, IntrWillReturn]>;
+    Intrinsic<[ llvm_ptr_ty ], [llvm_i8_ty], [IntrWillReturn]>;
 }

diff  --git a/llvm/test/Transforms/EarlyCSE/DirectX/create_handle.ll b/llvm/test/Transforms/EarlyCSE/DirectX/create_handle.ll
new file mode 100644
index 0000000000000..c58072119156c
--- /dev/null
+++ b/llvm/test/Transforms/EarlyCSE/DirectX/create_handle.ll
@@ -0,0 +1,17 @@
+; RUN: opt %s -early-cse -S | FileCheck %s
+
+define void @fn() {
+entry:
+  %0 = tail call ptr @llvm.dx.create.handle(i8 1)
+  %1 = tail call ptr @llvm.dx.create.handle(i8 1)
+  ret void
+}
+
+; Function Attrs: mustprogress nounwind willreturn
+declare ptr @llvm.dx.create.handle(i8) #0
+
+attributes #0 = { mustprogress nounwind willreturn }
+
+; CSE needs to leave this alone
+; CHECK: %0 = tail call ptr @llvm.dx.create.handle(i8 1)
+; CHECK: %1 = tail call ptr @llvm.dx.create.handle(i8 1)
\ No newline at end of file


        


More information about the llvm-commits mailing list