[clang] [llvm] [DXIL] Remove incompatible metadata types when preparing DXIL. (PR #136386)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 25 17:04:18 PDT 2025
================
@@ -0,0 +1,39 @@
+; RUN: opt -S --dxil-prepare %s | FileCheck %s
+
+; This test tests the whitelist inside of DxilPrepare.cpp.
+; It ensures that certain metadata nodes are removed that aren't
+; in the whitelist, and that certain nodes may remain that
+; are on the whitelist.
+
+target triple = "dxilv1.0-unknown-shadermodel6.0-compute"
+
+; Function Attrs: noinline nounwind memory(readwrite, inaccessiblemem: none)
+define void @main(i32* %ptr) {
+entry:
+ ; metadata ID changes to 0 once the current !0 and !1 are removed
+ ; since they aren't in the whitelist. range needs a payload.
+ ; CHECK: %val = load i32, ptr %ptr, align 4, !range !0
+ %val = load i32, ptr %ptr, align 4, !range !2
+
+ ; dx.nonuniform is a valid metadata node kind on the whitelist,
+ ; so give it a bogus payload and ensure it sticks around
+ ; CHECK-next: %cmp.i1.not = icmp eq i32 1, 0, !dx.nonuniform !0
+ %cmp.i1.not = icmp eq i32 1, 0, !dx.nonuniform !2
----------------
bogner wrote:
Probably better to either get an instruction with a valid payload here or omit this one - the check that `!range` gets through probably proves that we're hitting this codepath well enough
https://github.com/llvm/llvm-project/pull/136386
More information about the cfe-commits
mailing list