cond_br2.ll 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
  2. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
  3. %"class.llvm::SmallVector" = type { %"class.llvm::SmallVectorImpl", [1 x %"union.llvm::SmallVectorBase::U"] }
  4. %"class.llvm::SmallVectorImpl" = type { %"class.llvm::SmallVectorTemplateBase" }
  5. %"class.llvm::SmallVectorTemplateBase" = type { %"class.llvm::SmallVectorTemplateCommon" }
  6. %"class.llvm::SmallVectorTemplateCommon" = type { %"class.llvm::SmallVectorBase" }
  7. %"class.llvm::SmallVectorBase" = type { i8*, i8*, i8*, %"union.llvm::SmallVectorBase::U" }
  8. %"union.llvm::SmallVectorBase::U" = type { x86_fp80 }
  9. ; Function Attrs: ssp uwtable
  10. define void @_Z4testv() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
  11. ; CHECK: @_Z4testv()
  12. ; CHECK: invoke.cont:
  13. ; CHECK: br i1 true, label %new.notnull.i11, label %if.end.i14
  14. ; CHECK: Retry.i10:
  15. entry:
  16. %sv = alloca %"class.llvm::SmallVector", align 16
  17. %0 = bitcast %"class.llvm::SmallVector"* %sv to i8*
  18. call void @llvm.lifetime.start(i64 64, i8* %0) #1
  19. %BeginX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 0
  20. %FirstEl.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 3
  21. %1 = bitcast %"union.llvm::SmallVectorBase::U"* %FirstEl.i.i.i.i.i.i to i8*
  22. store i8* %1, i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4
  23. %EndX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 1
  24. store i8* %1, i8** %EndX.i.i.i.i.i.i, align 8, !tbaa !4
  25. %CapacityX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 2
  26. %add.ptr.i.i.i.i2.i.i = getelementptr inbounds %"union.llvm::SmallVectorBase::U", %"union.llvm::SmallVectorBase::U"* %FirstEl.i.i.i.i.i.i, i64 2
  27. %add.ptr.i.i.i.i.i.i = bitcast %"union.llvm::SmallVectorBase::U"* %add.ptr.i.i.i.i2.i.i to i8*
  28. store i8* %add.ptr.i.i.i.i.i.i, i8** %CapacityX.i.i.i.i.i.i, align 16, !tbaa !4
  29. %EndX.i = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 1
  30. %2 = load i8*, i8** %EndX.i, align 8, !tbaa !4
  31. %CapacityX.i = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 2
  32. %cmp.i = icmp ult i8* %2, %add.ptr.i.i.i.i.i.i
  33. br i1 %cmp.i, label %Retry.i, label %if.end.i
  34. Retry.i: ; preds = %.noexc, %entry
  35. %3 = phi i8* [ %2, %entry ], [ %.pre.i, %.noexc ]
  36. %new.isnull.i = icmp eq i8* %3, null
  37. br i1 %new.isnull.i, label %invoke.cont, label %new.notnull.i
  38. new.notnull.i: ; preds = %Retry.i
  39. %4 = bitcast i8* %3 to i32*
  40. store i32 1, i32* %4, align 4, !tbaa !5
  41. br label %invoke.cont
  42. if.end.i: ; preds = %entry
  43. %5 = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0
  44. invoke void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"* %5, i64 0, i64 4)
  45. to label %.noexc unwind label %lpad
  46. .noexc: ; preds = %if.end.i
  47. %.pre.i = load i8*, i8** %EndX.i, align 8, !tbaa !4
  48. br label %Retry.i
  49. invoke.cont: ; preds = %new.notnull.i, %Retry.i
  50. %add.ptr.i = getelementptr inbounds i8, i8* %3, i64 4
  51. store i8* %add.ptr.i, i8** %EndX.i, align 8, !tbaa !4
  52. %6 = load i8*, i8** %CapacityX.i, align 16, !tbaa !4
  53. %cmp.i8 = icmp ult i8* %add.ptr.i, %6
  54. br i1 %cmp.i8, label %new.notnull.i11, label %if.end.i14
  55. Retry.i10: ; preds = %if.end.i14
  56. %.pre.i13 = load i8*, i8** %EndX.i, align 8, !tbaa !4
  57. %new.isnull.i9 = icmp eq i8* %.pre.i13, null
  58. br i1 %new.isnull.i9, label %invoke.cont2, label %new.notnull.i11
  59. new.notnull.i11: ; preds = %invoke.cont, %Retry.i10
  60. %7 = phi i8* [ %.pre.i13, %Retry.i10 ], [ %add.ptr.i, %invoke.cont ]
  61. %8 = bitcast i8* %7 to i32*
  62. store i32 2, i32* %8, align 4, !tbaa !5
  63. br label %invoke.cont2
  64. if.end.i14: ; preds = %invoke.cont
  65. %9 = getelementptr inbounds %"class.llvm::SmallVector", %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0
  66. invoke void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"* %9, i64 0, i64 4)
  67. to label %Retry.i10 unwind label %lpad
  68. invoke.cont2: ; preds = %new.notnull.i11, %Retry.i10
  69. %10 = phi i8* [ null, %Retry.i10 ], [ %7, %new.notnull.i11 ]
  70. %add.ptr.i12 = getelementptr inbounds i8, i8* %10, i64 4
  71. store i8* %add.ptr.i12, i8** %EndX.i, align 8, !tbaa !4
  72. invoke void @_Z1gRN4llvm11SmallVectorIiLj8EEE(%"class.llvm::SmallVector"* %sv)
  73. to label %invoke.cont3 unwind label %lpad
  74. invoke.cont3: ; preds = %invoke.cont2
  75. %11 = load i8*, i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4
  76. %cmp.i.i.i.i19 = icmp eq i8* %11, %1
  77. br i1 %cmp.i.i.i.i19, label %_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21, label %if.then.i.i.i20
  78. if.then.i.i.i20: ; preds = %invoke.cont3
  79. call void @free(i8* %11) #1
  80. br label %_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21
  81. _ZN4llvm11SmallVectorIiLj8EED1Ev.exit21: ; preds = %invoke.cont3, %if.then.i.i.i20
  82. call void @llvm.lifetime.end(i64 64, i8* %0) #1
  83. ret void
  84. lpad: ; preds = %if.end.i14, %if.end.i, %invoke.cont2
  85. %12 = landingpad { i8*, i32 }
  86. cleanup
  87. %13 = load i8*, i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4
  88. %cmp.i.i.i.i = icmp eq i8* %13, %1
  89. br i1 %cmp.i.i.i.i, label %eh.resume, label %if.then.i.i.i
  90. if.then.i.i.i: ; preds = %lpad
  91. call void @free(i8* %13) #1
  92. br label %eh.resume
  93. eh.resume: ; preds = %if.then.i.i.i, %lpad
  94. resume { i8*, i32 } %12
  95. }
  96. ; Function Attrs: nounwind
  97. declare void @llvm.lifetime.start(i64, i8* nocapture) #1
  98. declare i32 @__gxx_personality_v0(...)
  99. declare void @_Z1gRN4llvm11SmallVectorIiLj8EEE(%"class.llvm::SmallVector"*) #2
  100. ; Function Attrs: nounwind
  101. declare void @llvm.lifetime.end(i64, i8* nocapture) #1
  102. declare void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"*, i64, i64) #2
  103. ; Function Attrs: nounwind
  104. declare void @free(i8* nocapture) #3
  105. attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
  106. attributes #1 = { nounwind }
  107. attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
  108. attributes #3 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
  109. !0 = !{!"any pointer", !1}
  110. !1 = !{!"omnipotent char", !2}
  111. !2 = !{!"Simple C/C++ TBAA"}
  112. !3 = !{!"int", !1}
  113. !4 = !{!0, !0, i64 0}
  114. !5 = !{!3, !3, i64 0}