n02.ll 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ; RUN: %opt-exe %s -normalizedxil -S | %FileCheck %s
  2. ; Should not remove the alloca because it is written to more than once
  3. ; CHECK: %.reg2mem = alloca %dx.types.Handle
  4. ; CHECK: %.reload1 = load %dx.types.Handle, %dx.types.Handle* %.reg2mem
  5. ; CHECK: %6 = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 69, %dx.types.Handle %.reload1, i32 %5, i32 undef)
  6. ; CHECK: %.reload = load %dx.types.Handle, %dx.types.Handle* %.reg2mem
  7. ; CHECK: %14 = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 69, %dx.types.Handle %.reload, i32 %13, i32 undef)
  8. %dx.types.u32 = type { i32 }
  9. %dx.types.Handle = type { i8* }
  10. %dx.types.ResRet.i32 = type { i32, i32, i32, i32, i32 }
  11. define void @main() {
  12. entry:
  13. %.reg2mem = alloca %dx.types.Handle
  14. %"reg2mem alloca point" = bitcast i32 0 to i32
  15. %0 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 0, i1 false)
  16. %x = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 1, i1 false)
  17. store %dx.types.Handle %0, %dx.types.Handle* %.reg2mem
  18. %1 = call i32 @dx.op.loadInput.i32(i32 4, i32 2, i32 0, i8 0, i32 undef)
  19. %2 = icmp slt i32 100, %1
  20. call void @dx.op.tempRegStore.i1(i32 1, i32 0, i1 %2)
  21. %3 = call i32 @dx.op.tempRegLoad.i32(i32 0, i32 0)
  22. %4 = icmp ne i32 %3, 0
  23. br i1 %4, label %if0.then, label %if0.else
  24. if0.then: ; preds = %entry
  25. %5 = call i32 @dx.op.loadInput.i32(i32 4, i32 2, i32 0, i8 0, i32 undef)
  26. %.reload1 = load %dx.types.Handle, %dx.types.Handle* %.reg2mem
  27. %6 = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 69, %dx.types.Handle %.reload1, i32 %5, i32 undef)
  28. %7 = extractvalue %dx.types.ResRet.i32 %6, 0
  29. call void @dx.op.tempRegStore.i32(i32 1, i32 0, i32 %7)
  30. %8 = call i32 @dx.op.tempRegLoad.i32(i32 0, i32 0)
  31. %9 = uitofp i32 %8 to float
  32. call void @dx.op.tempRegStore.f32(i32 1, i32 0, float %9)
  33. %10 = call float @dx.op.tempRegLoad.f32(i32 0, i32 0)
  34. %11 = call float @dx.op.loadInput.f32(i32 4, i32 1, i32 0, i8 0, i32 undef)
  35. %12 = fadd float %10, %11
  36. call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0, float %12)
  37. store %dx.types.Handle %x, %dx.types.Handle* %.reg2mem
  38. br label %if0.end
  39. if0.else: ; preds = %entry
  40. %13 = call i32 @dx.op.loadInput.i32(i32 4, i32 3, i32 0, i8 0, i32 undef)
  41. %.reload = load %dx.types.Handle, %dx.types.Handle* %.reg2mem
  42. %14 = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 69, %dx.types.Handle %.reload, i32 %13, i32 undef)
  43. %15 = extractvalue %dx.types.ResRet.i32 %14, 0
  44. call void @dx.op.tempRegStore.i32(i32 1, i32 0, i32 %15)
  45. %16 = call i32 @dx.op.tempRegLoad.i32(i32 0, i32 0)
  46. %17 = uitofp i32 %16 to float
  47. call void @dx.op.tempRegStore.f32(i32 1, i32 0, float %17)
  48. %18 = call float @dx.op.tempRegLoad.f32(i32 0, i32 0)
  49. %19 = call float @dx.op.loadInput.f32(i32 4, i32 1, i32 0, i8 0, i32 undef)
  50. %20 = fadd float %18, %19
  51. call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0, float %20)
  52. br label %if0.end
  53. if0.end: ; preds = %if0.else, %if0.then
  54. %.reload2 = load %dx.types.Handle, %dx.types.Handle* %.reg2mem
  55. %r = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 69, %dx.types.Handle %.reload2, i32 3, i32 undef)
  56. ret void
  57. }
  58. ; Function Attrs: nounwind readnone
  59. declare %dx.types.Handle @dx.op.createHandle(i32, i8, i32, i32, i1) #0
  60. ; Function Attrs: nounwind readnone
  61. declare i32 @dx.op.loadInput.i32(i32, i32, i32, i8, i32) #0
  62. ; Function Attrs: nounwind
  63. declare void @dx.op.tempRegStore.i1(i32, i32, i1) #1
  64. ; Function Attrs: nounwind readonly
  65. declare i32 @dx.op.tempRegLoad.i32(i32, i32) #2
  66. ; Function Attrs: nounwind readonly
  67. declare %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32, %dx.types.Handle, i32, i32) #2
  68. ; Function Attrs: nounwind
  69. declare void @dx.op.tempRegStore.i32(i32, i32, i32) #1
  70. ; Function Attrs: nounwind
  71. declare void @dx.op.tempRegStore.f32(i32, i32, float) #1
  72. ; Function Attrs: nounwind readonly
  73. declare float @dx.op.tempRegLoad.f32(i32, i32) #2
  74. ; Function Attrs: nounwind readnone
  75. declare float @dx.op.loadInput.f32(i32, i32, i32, i8, i32) #0
  76. ; Function Attrs: nounwind
  77. declare void @dx.op.storeOutput.f32(i32, i32, i32, i8, float) #1
  78. attributes #0 = { nounwind readnone }
  79. attributes #1 = { nounwind }
  80. attributes #2 = { nounwind readonly }