[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
----------------
bogner wrote:

Better to pattern match the argument and check it later:
```
CHECK: %val = load i32, ptr %ptr, align 4, !range [[RANGEMD:![0-9]+]]
...
CHECK:  [RANGEMD] = !{i32 1, i32 5}
```

https://github.com/llvm/llvm-project/pull/136386


More information about the cfe-commits mailing list