array_of_structs_noopt.hlsl 1.2 KB

12345678910111213141516171819202122232425262728
  1. // RUN: %dxc -E main -T vs_6_0 -Zi -Od %s | FileCheck %s
  2. // Check that debug info is preserved with stride information
  3. // for arrays of structs getting SROA'd down into arrays of struct elements,
  4. // when compiling without optimizations.
  5. // CHECK-DAG: %[[intalloca:.*]] = alloca [2 x i32]
  6. // CHECK-DAG: %[[floatalloca:.*]] = alloca [2 x float]
  7. // CHECK-DAG: call void @llvm.dbg.declare(metadata [2 x i32]* %[[intalloca]], metadata !{{.*}}, metadata ![[intdiexpr:.*]]), !dbg !{{.*}}, !dx.dbg.varlayout ![[intlayout:.*]]
  8. // CHECK-DAG: call void @llvm.dbg.declare(metadata [2 x float]* %[[floatalloca]], metadata !{{.*}}, metadata ![[floatdiexpr:.*]]), !dbg !{{.*}}, !dx.dbg.varlayout ![[floatlayout:.*]]
  9. // Exclude quoted source file (see readme)
  10. // CHECK-LABEL: {{!"[^"]*\\0A[^"]*"}}
  11. // CHECK-DAG: !DILocalVariable(tag: DW_TAG_auto_variable, name: "var"
  12. // CHECK-DAG: ![[intdiexpr]] = !DIExpression(DW_OP_bit_piece, 0, 32)
  13. // CHECK-DAG: ![[intlayout]] = !{i32 0, i32 64, i32 2}
  14. // CHECK-DAG: ![[floatdiexpr]] = !DIExpression(DW_OP_bit_piece, 32, 32)
  15. // CHECK-DAG: ![[floatlayout]] = !{i32 32, i32 64, i32 2}
  16. struct intfloat { int i; float f; };
  17. float4 main(int i : IN) : OUT
  18. {
  19. intfloat var[2] = (intfloat[2])i;
  20. return float4(var[0].i, var[0].f, var[1].i, var[1].f);
  21. }