crash.ll 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. ; RUN: opt < %s -inline -argpromotion -instcombine -disable-output
  2. ; This test was failing because the inliner would inline @list_DeleteElement
  3. ; into @list_DeleteDuplicates and then into @inf_GetBackwardPartnerLits,
  4. ; turning the indirect call into a direct one. This allowed instcombine to see
  5. ; the bitcast and eliminate it, deleting the original call and introducing
  6. ; another one. This crashed the inliner because the new call was not in the
  7. ; callgraph.
  8. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
  9. target triple = "i386-apple-darwin10.0"
  10. define void @list_DeleteElement(i32 (i8*, i8*)* nocapture %Test) nounwind ssp {
  11. entry:
  12. %0 = call i32 %Test(i8* null, i8* undef) nounwind
  13. ret void
  14. }
  15. define void @list_DeleteDuplicates(i32 (i8*, i8*)* nocapture %Test) nounwind ssp {
  16. foo:
  17. call void @list_DeleteElement(i32 (i8*, i8*)* %Test) nounwind ssp
  18. call fastcc void @list_Rplacd1284() nounwind ssp
  19. unreachable
  20. }
  21. define internal i32 @inf_LiteralsHaveSameSubtermAndAreFromSameClause(i32* nocapture %L1, i32* nocapture %L2) nounwind readonly ssp {
  22. entry:
  23. unreachable
  24. }
  25. define internal fastcc void @inf_GetBackwardPartnerLits(i32* nocapture %Flags) nounwind ssp {
  26. test:
  27. call void @list_DeleteDuplicates(i32 (i8*, i8*)* bitcast (i32 (i32*, i32*)* @inf_LiteralsHaveSameSubtermAndAreFromSameClause to i32 (i8*, i8*)*)) nounwind
  28. ret void
  29. }
  30. define void @inf_BackwardEmptySortPlusPlus() nounwind ssp {
  31. entry:
  32. call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp
  33. unreachable
  34. }
  35. define void @inf_BackwardWeakening() nounwind ssp {
  36. entry:
  37. call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp
  38. unreachable
  39. }
  40. declare fastcc void @list_Rplacd1284() nounwind ssp
  41. ;============================
  42. ; PR5208
  43. define void @AAA() personality i32 (...)* @__gxx_personality_v0 {
  44. entry:
  45. %A = alloca i8, i32 undef, align 1
  46. invoke fastcc void @XXX()
  47. to label %invcont98 unwind label %lpad156
  48. invcont98:
  49. unreachable
  50. lpad156:
  51. %exn = landingpad {i8*, i32}
  52. cleanup
  53. unreachable
  54. }
  55. declare i32 @__gxx_personality_v0(...)
  56. declare fastcc void @YYY()
  57. define internal fastcc void @XXX() personality i32 (...)* @__gxx_personality_v0 {
  58. entry:
  59. %B = alloca i8, i32 undef, align 1
  60. invoke fastcc void @YYY()
  61. to label %bb260 unwind label %lpad
  62. bb260:
  63. ret void
  64. lpad:
  65. %exn = landingpad {i8*, i32}
  66. cleanup
  67. resume { i8*, i32 } %exn
  68. }
  69. ;; This exposed a crash handling devirtualized calls.
  70. define void @f1(void ()* %f) ssp {
  71. entry:
  72. call void %f()
  73. ret void
  74. }
  75. define void @f4(i32 %size) ssp personality i32 (...)* @__gxx_personality_v0 {
  76. entry:
  77. invoke void @f1(void ()* @f3)
  78. to label %invcont3 unwind label %lpad18
  79. invcont3: ; preds = %bb1
  80. ret void
  81. lpad18: ; preds = %invcont3, %bb1
  82. %exn = landingpad {i8*, i32}
  83. cleanup
  84. unreachable
  85. }
  86. define void @f3() ssp {
  87. entry:
  88. unreachable
  89. }
  90. declare void @f5() ssp