Guest User

Untitled

a guest
Jan 20th, 2018
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. ; ModuleID = 'opt_test5.bc'
  2. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  3. target triple = "x86_64-pc-linux-gnu"
  4.  
  5. @.str = private unnamed_addr constant [32 x i8] c"Final sum %i, Final value = %i\0A\00", align 1
  6.  
  7. ; Function Attrs: nounwind uwtable
  8. define i32 @main() #0 {
  9. call void @update(i32 100, i32 200, i32 150)
  10. call void @update(i32 100, i32 200, i32 100)
  11. call void @update(i32 200, i32 100, i32 150)
  12. call void @update(i32 200, i32 100, i32 100)
  13. %1 = call i32 @getBias()
  14. %2 = call i32 @computeFinalValue(i32 300, i32 %1)
  15. %3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i32 0, i32 0), i32 300, i32 %2)
  16. %4 = call i32 @getBias()
  17. %5 = call i32 @computeFinalValue(i32 300, i32 %4)
  18. ret i32 %5
  19. }
  20.  
  21. ; Function Attrs: nounwind uwtable
  22. define internal void @update(i32 %a, i32 %b, i32 %threshold) #0 {
  23. %1 = icmp sgt i32 %a, %threshold
  24. br i1 %1, label %2, label %4
  25.  
  26. ; <label>:2 ; preds = %0
  27. %3 = add nsw i32 %a, %b
  28. br label %5
  29.  
  30. ; <label>:4 ; preds = %0
  31. br label %5
  32.  
  33. ; <label>:5 ; preds = %4, %2
  34. ret void
  35. }
  36.  
  37. declare i32 @printf(i8*, ...) #1
  38.  
  39. ; Function Attrs: nounwind uwtable
  40. define internal i32 @computeFinalValue(i32 %value, i32 %bias) #0 {
  41. %1 = sdiv i32 %value, 5
  42. %2 = sub nsw i32 100, %1
  43. %3 = mul nsw i32 %2, 10
  44. %4 = icmp sgt i32 %3, 100
  45. br i1 %4, label %5, label %7
  46.  
  47. ; <label>:5 ; preds = %0
  48. %6 = sub nsw i32 %3, 100
  49. br label %9
  50.  
  51. ; <label>:7 ; preds = %0
  52. %8 = add nsw i32 %3, 100
  53. br label %9
  54.  
  55. ; <label>:9 ; preds = %7, %5
  56. %c.0 = phi i32 [ %6, %5 ], [ %8, %7 ]
  57. %10 = icmp sgt i32 %2, %c.0
  58. br i1 %10, label %11, label %14
  59.  
  60. ; <label>:11 ; preds = %9
  61. %12 = add nsw i32 %2, %c.0
  62. %13 = sdiv i32 %12, 2
  63. call void @update(i32 %2, i32 %c.0, i32 %13)
  64. br label %17
  65.  
  66. ; <label>:14 ; preds = %9
  67. %15 = add nsw i32 %2, %c.0
  68. %16 = sdiv i32 %15, 2
  69. call void @update(i32 %c.0, i32 %2, i32 %16)
  70. br label %17
  71.  
  72. ; <label>:17 ; preds = %14, %11
  73. %18 = add nsw i32 %value, %bias
  74. ret i32 %18
  75. }
  76.  
  77. ; Function Attrs: nounwind uwtable
  78. define internal i32 @getBias() #0 {
  79. ret i32 100
  80. }
  81.  
  82. attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "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" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
  83. attributes #1 = { "disable-tail-calls"="false" "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" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
  84.  
  85. !llvm.ident = !{!0}
  86.  
  87. !0 = !{!"clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)"}
Add Comment
Please, Sign In to add comment