59 lines · plain
1; RUN: split-file %s %t2; RUN: opt -S --dxil-translate-metadata %t/not-distinct.ll 2>&1 | FileCheck %t/not-distinct.ll3; RUN: opt -S --dxil-translate-metadata %t/not-md.ll 2>&1 | FileCheck %t/not-md.ll4 5; Test that DXIL incompatible loop metadata is stripped6 7;--- not-distinct.ll8 9; Ensure it is stripped because it is not provided a distinct loop parent10; CHECK-NOT: {!"llvm.loop.unroll.disable"}11 12target triple = "dxilv1.0-unknown-shadermodel6.0-library"13 14define void @example_loop(i32 %n) {15entry:16 br label %loop.header17 18loop.header:19 %i = phi i32 [ 0, %entry ], [ %i.next, %loop.body ]20 %cmp = icmp slt i32 %i, %n21 br i1 %cmp, label %loop.body, label %exit22 23loop.body:24 %i.next = add nsw i32 %i, 125 br label %loop.header, !llvm.loop !126 27exit:28 ret void29}30 31!1 = !{!"llvm.loop.unroll.disable"} ; first node must be a distinct self-reference32 33 34;--- not-md.ll35 36target triple = "dxilv1.0-unknown-shadermodel6.0-library"37 38define void @example_loop(i32 %n) {39entry:40 br label %loop.header41 42loop.header:43 %i = phi i32 [ 0, %entry ], [ %i.next, %loop.body ]44 %cmp = icmp slt i32 %i, %n45 br i1 %cmp, label %loop.body, label %exit46 47loop.body:48 %i.next = add nsw i32 %i, 149 ; CHECK: br label %loop.header, !llvm.loop ![[#LOOP_MD:]]50 br label %loop.header, !llvm.loop !151 52exit:53 ret void54}55 56; CHECK: ![[#LOOP_MD:]] = distinct !{![[#LOOP_MD]]}57 58!1 = !{!1, i32 0} ; second operand is not a metadata node59