34 lines · plain
1; RUN: opt -S --dxil-translate-metadata %s | FileCheck %s2 3; Test that only metadata nodes that are valid in DXIL are allowed through4 5target triple = "dxilv1.0-unknown-shadermodel6.0-compute"6 7; Function Attrs: noinline nounwind memory(readwrite, inaccessiblemem: none)8define void @main(i32* %ptr) {9entry: 10 ; metadata ID changes to 0 once the current !0 and !1 are removed11 ; since they aren't in the allowlist. range needs a payload.12 ; CHECK: %val = load i32, ptr %ptr, align 4, !range [[RANGEMD:![0-9]+]]13 %val = load i32, ptr %ptr, align 4, !range !214 15 %cmp.i = icmp ult i32 1, 216 ; Ensure that the !llvm.loop metadata node gets dropped.17 ; CHECK: br i1 %cmp.i, label %_Z4mainDv3_j.exit, label %_Z4mainDv3_j.exit, !llvm.loop [[LOOPMD:![0-9]+]]18 br i1 %cmp.i, label %_Z4mainDv3_j.exit, label %_Z4mainDv3_j.exit, !llvm.loop !019 20_Z4mainDv3_j.exit: ; preds = %for.body.i, %entry21 ret void22}23 24; These next check lines check that only the range metadata remains25; No more metadata should be necessary, the rest (the current 0 and 1)26; should be removed.27; CHECK-NOT: !{!"llvm.loop.mustprogress"}28; CHECK-DAG: [[RANGEMD]] = !{i32 1, i32 5}29; CHECK-DAG: [[LOOPMD]] = distinct !{[[LOOPMD]]}30; CHECK-NOT: !{!"llvm.loop.mustprogress"}31!0 = distinct !{!0, !1}32!1 = !{!"llvm.loop.mustprogress"}33!2 = !{i32 1, i32 5}34