This pr adds the equivalent validation of `llvm.loop` metadata that is
[done in
DXC](8f21027f2a/lib/DxilValidation/DxilValidation.cpp (L3010)).
This is done as follows:
- Add `llvm.loop` to the metadata allow-list in `DXILTranslateMetadata`
- Iterate through all `llvm.loop` metadata nodes and strip all
incompatible ones
- Raise an error for ill-formed nodes that are compatible with DXIL
Resolves: https://github.com/llvm/llvm-project/issues/137387
24 lines
563 B
LLVM
24 lines
563 B
LLVM
; RUN: not opt -S -dxil-translate-metadata %s 2>&1 | FileCheck %s
|
|
target triple = "dxil-pc-shadermodel6.8-compute"
|
|
|
|
; CHECK: Non-library shader: One and only one entry expected
|
|
|
|
define void @entry_as() #0 {
|
|
entry:
|
|
ret void
|
|
}
|
|
|
|
define i32 @entry_ms(i32 %a) #1 {
|
|
entry:
|
|
ret i32 %a
|
|
}
|
|
|
|
define float @entry_cs(float %f) #3 {
|
|
entry:
|
|
ret float %f
|
|
}
|
|
|
|
attributes #0 = { noinline nounwind "hlsl.shader"="amplification" }
|
|
attributes #1 = { noinline nounwind "hlsl.shader"="mesh" }
|
|
attributes #3 = { noinline nounwind "hlsl.numthreads"="1,2,1" "hlsl.shader"="compute" }
|