Advertisement
Guest User

Untitled

a guest
Apr 14th, 2019
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LLVM 6.79 KB | None | 0 0
  1. ; ModuleID = 'test.ibc.opt.1'
  2. source_filename = "llvm-link"
  3. target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
  4. target triple = "x86_64-apple-macosx10.14.0"
  5.  
  6. ; Function Attrs: noinline nounwind ssp uwtable
  7. define void @solve(float* %a, float* %b, float* %c, float* %d, float* %e, i32 %n) #0 {
  8. entry:
  9.   br label %for.cond
  10.  
  11. for.cond:                                         ; preds = %for.inc, %entry
  12.   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
  13.   %cmp = icmp slt i32 %i.0, %n
  14.   br i1 %cmp, label %for.body, label %for.end
  15.  
  16. for.body:                                         ; preds = %for.cond
  17.   %tmp = zext i32 %i.0 to i64
  18.   %arrayidx = getelementptr inbounds float, float* %b, i64 %tmp
  19.   %tmp1 = load float, float* %arrayidx, align 4
  20.   %arrayidx2 = getelementptr inbounds float, float* %c, i64 %tmp
  21.   %tmp2 = load float, float* %arrayidx2, align 4
  22.   %add = fadd float %tmp1, %tmp2
  23.   %arrayidx4 = getelementptr inbounds float, float* %d, i64 %tmp
  24.   %tmp3 = load float, float* %arrayidx4, align 4
  25.   %arrayidx6 = getelementptr inbounds float, float* %e, i64 %tmp
  26.   %tmp4 = load float, float* %arrayidx6, align 4
  27.   %mul = fmul float %tmp3, %tmp4
  28.   %mul7 = fmul float %add, %mul
  29.   %arrayidx9 = getelementptr inbounds float, float* %a, i64 %tmp
  30.   %tmp5 = load float, float* %arrayidx9, align 4
  31.   %add10 = fadd float %tmp5, %mul7
  32.   store float %add10, float* %arrayidx9, align 4
  33.   br label %for.inc
  34.  
  35. for.inc:                                          ; preds = %2, %for.body
  36.   %inc = add nuw nsw i32 %i.0, 1
  37.   br label %for.cond
  38.  
  39. for.end:                                          ; preds = %for.cond
  40.   ret void
  41.  
  42. for.body.opt:                                     ; No predecessors!
  43.   %tmp.opt = zext i32 %i.0 to i64
  44.   %arrayidx.opt = getelementptr inbounds float, float* %b, i64 %tmp
  45.   %tmp1.opt = load float, float* %arrayidx, align 4
  46.   %arrayidx2.opt = getelementptr inbounds float, float* %c, i64 %tmp
  47.   %tmp2.opt = load float, float* %arrayidx2, align 4
  48.   %add.opt = fadd float %tmp1, %tmp2
  49.   %arrayidx4.opt = getelementptr inbounds float, float* %d, i64 %tmp
  50.   %tmp3.opt = load float, float* %arrayidx4, align 4
  51.   %arrayidx6.opt = getelementptr inbounds float, float* %e, i64 %tmp
  52.   %tmp4.opt = load float, float* %arrayidx6, align 4
  53.   %mul.opt = fmul float %tmp3, %tmp4
  54.   %mul7.opt = fmul float %add, %mul
  55.   %arrayidx9.opt = getelementptr inbounds float, float* %a, i64 %tmp
  56.   %tmp5.opt = load float, float* %arrayidx9, align 4
  57.   %add10.opt = fadd float %tmp5, %mul7
  58.   %0 = fcmp one float %tmp4, 0.000000e+00
  59.   br i1 %0, label %1, label %2
  60.  
  61. ; <label>:1:                                      ; preds = %for.body.opt
  62.   store float %add10, float* %arrayidx9, align 4
  63.   br label %2
  64.  
  65. ; <label>:2:                                      ; preds = %for.body.opt, %1
  66.   br label %for.inc
  67. }
  68.  
  69. ; Function Attrs: noinline nounwind ssp uwtable
  70. define i32 @main(i32 %argc, i8** %argv) #0 {
  71. entry:
  72.   %arrayidx = getelementptr inbounds i8*, i8** %argv, i64 1
  73.   %tmp = load i8*, i8** %arrayidx, align 8
  74.   %call = call i32 @atoi(i8* %tmp) #3
  75.   %conv = sext i32 %call to i64
  76.   %mul = shl nsw i64 %conv, 2
  77.   %call1 = call i8* @malloc(i64 %mul) #4
  78.   %tmp1 = bitcast i8* %call1 to float*
  79.   %call4 = call i8* @malloc(i64 %mul) #4
  80.   %tmp2 = bitcast i8* %call4 to float*
  81.   %call7 = call i8* @malloc(i64 %mul) #4
  82.   %tmp3 = bitcast i8* %call7 to float*
  83.   %call10 = call i8* @malloc(i64 %mul) #4
  84.   %tmp4 = bitcast i8* %call10 to float*
  85.   %call13 = call i8* @malloc(i64 %mul) #4
  86.   %tmp5 = bitcast i8* %call13 to float*
  87.   br label %for.cond
  88.  
  89. for.cond:                                         ; preds = %for.inc, %entry
  90.   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
  91.   %cmp = icmp slt i32 %i.0, %call
  92.   br i1 %cmp, label %for.body, label %for.end
  93.  
  94. for.body:                                         ; preds = %for.cond
  95.   %conv15 = sitofp i32 %i.0 to double
  96.   %conv16 = fptrunc double %conv15 to float
  97.   %tmp6 = zext i32 %i.0 to i64
  98.   %arrayidx17 = getelementptr inbounds float, float* %tmp1, i64 %tmp6
  99.   store float %conv16, float* %arrayidx17, align 4
  100.   %arrayidx19 = getelementptr inbounds float, float* %tmp2, i64 %tmp6
  101.   store float 0.000000e+00, float* %arrayidx19, align 4
  102.   %mul21 = fmul double %conv15, 2.000000e+00
  103.   %conv22 = fptrunc double %mul21 to float
  104.   %arrayidx24 = getelementptr inbounds float, float* %tmp3, i64 %tmp6
  105.   store float %conv22, float* %arrayidx24, align 4
  106.   %arrayidx29 = getelementptr inbounds float, float* %tmp4, i64 %tmp6
  107.   store float %conv22, float* %arrayidx29, align 4
  108.   %arrayidx34 = getelementptr inbounds float, float* %tmp5, i64 %tmp6
  109.   store float %conv22, float* %arrayidx34, align 4
  110.   br label %for.inc
  111.  
  112. for.inc:                                          ; preds = %for.body
  113.   %inc = add nuw nsw i32 %i.0, 1
  114.   br label %for.cond
  115.  
  116. for.end:                                          ; preds = %for.cond
  117.   call void @solve(float* %tmp1, float* %tmp2, float* %tmp3, float* %tmp4, float* %tmp5, i32 %call)
  118.   ret i32 0
  119. }
  120.  
  121. declare i32 @atoi(i8*) #1
  122.  
  123. ; Function Attrs: allocsize(0)
  124. declare i8* @malloc(i64) #2
  125.  
  126. attributes #0 = { noinline nounwind ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "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-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
  127. attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "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" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
  128. attributes #2 = { allocsize(0) "correctly-rounded-divide-sqrt-fp-math"="false" "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" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
  129. attributes #3 = { nounwind }
  130. attributes #4 = { nounwind allocsize(0) }
  131.  
  132. !llvm.ident = !{!0}
  133. !llvm.module.flags = !{!1, !2}
  134.  
  135. !0 = !{!"clang version 6.0.1 (tags/RELEASE_601/final 342957)"}
  136. !1 = !{i32 1, !"wchar_size", i32 4}
  137. !2 = !{i32 7, !"PIC Level", i32 2}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement