Skip to content

Commit bcf7267

Browse files
authored
[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: llvm/llvm-project#164473.
1 parent c208a23 commit bcf7267

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

llvm/lib/Target/DirectX/DXILPrepare.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,14 @@ class DXILPrepareModule : public ModulePass {
294294
if (NamedMDNode *RootSignature = M.getNamedMetadata("dx.rootsignatures"))
295295
RootSignature->eraseFromParent();
296296

297+
// llvm.errno.tbaa was recently added but is not supported in LLVM 3.7 and
298+
// causes all tests using the DXIL Validator to fail.
299+
//
300+
// This is a temporary fix and should be replaced with a whitelist once
301+
// we have determined all metadata that the DXIL Validator allows
302+
if (NamedMDNode *ErrNo = M.getNamedMetadata("llvm.errno.tbaa"))
303+
ErrNo->eraseFromParent();
304+
297305
return true;
298306
}
299307

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: opt -S -dxil-prepare < %s | FileCheck %s
2+
3+
; Ensures that dxil-prepare will remove the llvm.errno.tbaa metadata
4+
5+
target triple = "dxil-unknown-shadermodel6.0-compute"
6+
7+
define void @main() {
8+
entry:
9+
ret void
10+
}
11+
12+
; CHECK-NOT: !llvm.errno.tbaa
13+
; CHECK-NOT: {{^!}}
14+
15+
!llvm.errno.tbaa = !{!0}
16+
17+
!0 = !{!1, !1, i64 0}
18+
!1 = !{!"omnipotent char", !2}
19+
!2 = !{!"Simple C/C++ TBAA"}

0 commit comments

Comments
 (0)