crash_binaryop.ll 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
  2. target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
  3. target triple = "x86_64-apple-darwin13.3.0"
  4. @a = common global double 0.000000e+00, align 8
  5. define i32 @fn1() {
  6. entry:
  7. %init = load double, double* @a, align 8
  8. br label %loop
  9. loop:
  10. %phi = phi double [ %add2, %loop ], [ %init, %entry ]
  11. %postadd1_phi = phi double [ %postadd1, %loop ], [ %init, %entry ]
  12. %postadd2_phi = phi double [ %postadd2, %loop ], [ %init, %entry ]
  13. %add1 = fadd double %postadd1_phi, undef
  14. %add2 = fadd double %postadd2_phi, %phi
  15. %mul2 = fmul double %add2, 0.000000e+00
  16. %binaryop_B = fadd double %postadd1_phi, %mul2
  17. %mul1 = fmul double %add1, 0.000000e+00
  18. %tmp = fadd double %postadd2_phi, 0.000000e+00
  19. ; tryToVectorize() starts with this binary instruction.
  20. ; At the same time vectorization wraps around the loop, vectorizes
  21. ; postadd1/2 and eventually binary_V and tmp. So binary_V itself is replaced
  22. ; with a vector instruction.
  23. ; The SLPVectorizer crashed because it tried to use binary_V
  24. ; after vectorization to re-arrange instructions.
  25. %binary_V = fadd double %mul1, %binaryop_B
  26. %postadd1 = fadd double %binary_V, 0.000000e+00
  27. %postadd2 = fadd double %tmp, 1.000000e+00
  28. %tobool = fcmp une double %postadd1, 0.000000e+00
  29. br i1 %tobool, label %exit, label %loop
  30. exit:
  31. ret i32 1
  32. }