[llvm] bcf7267 - [DirectX] remove unrecognized 'llvm.errno.tbaa' named metadata for DXIL target (#164472)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 12:30:18 PDT 2025


Author: Finn Plummer
Date: 2025-10-21T12:30:13-07:00
New Revision: bcf726793719c41ffc1a26fa421107bc98282d63

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

LOG: [DirectX] remove unrecognized 'llvm.errno.tbaa' named metadata for DXIL target (#164472)

This is a temporary measure to explicitly remove the unrecognized named
metadata when targeting DXIL.

This should be removed for an allowlist as tracked here:
https://github.com/llvm/llvm-project/issues/164473.

Added: 
    llvm/test/CodeGen/DirectX/strip-llvm-errno-tbaa.ll

Modified: 
    llvm/lib/Target/DirectX/DXILPrepare.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/DirectX/DXILPrepare.cpp b/llvm/lib/Target/DirectX/DXILPrepare.cpp
index c8866bfefdfc5..42e90f0e27517 100644
--- a/llvm/lib/Target/DirectX/DXILPrepare.cpp
+++ b/llvm/lib/Target/DirectX/DXILPrepare.cpp
@@ -294,6 +294,14 @@ class DXILPrepareModule : public ModulePass {
     if (NamedMDNode *RootSignature = M.getNamedMetadata("dx.rootsignatures"))
       RootSignature->eraseFromParent();
 
+    // llvm.errno.tbaa was recently added but is not supported in LLVM 3.7 and
+    // causes all tests using the DXIL Validator to fail.
+    //
+    // This is a temporary fix and should be replaced with a whitelist once
+    // we have determined all metadata that the DXIL Validator allows
+    if (NamedMDNode *ErrNo = M.getNamedMetadata("llvm.errno.tbaa"))
+      ErrNo->eraseFromParent();
+
     return true;
   }
 

diff  --git a/llvm/test/CodeGen/DirectX/strip-llvm-errno-tbaa.ll b/llvm/test/CodeGen/DirectX/strip-llvm-errno-tbaa.ll
new file mode 100644
index 0000000000000..9190d0305d63f
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/strip-llvm-errno-tbaa.ll
@@ -0,0 +1,19 @@
+; RUN: opt -S -dxil-prepare < %s | FileCheck %s
+
+; Ensures that dxil-prepare will remove the llvm.errno.tbaa metadata
+
+target triple = "dxil-unknown-shadermodel6.0-compute"
+
+define void @main() {
+entry:
+  ret void
+}
+
+; CHECK-NOT: !llvm.errno.tbaa
+; CHECK-NOT: {{^!}}
+
+!llvm.errno.tbaa = !{!0}
+
+!0 = !{!1, !1, i64 0}
+!1 = !{!"omnipotent char", !2}
+!2 = !{!"Simple C/C++ TBAA"}


        


More information about the llvm-commits mailing list