no_outside_user.ll 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ; RUN: opt -S -loop-vectorize -force-vector-interleave=1 -force-vector-width=2 -pass-remarks-analysis=loop-vectorize < %s 2>&1 | FileCheck %s
  2. ; CHECK: remark: {{.*}}: loop not vectorized: value could not be identified as an induction or reduction variable
  3. ; CHECK: remark: {{.*}}: loop not vectorized: use of induction value outside of the loop is not handled by vectorizer
  4. 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:32:32-n8:16:32-S128"
  5. @f = common global i32 0, align 4
  6. @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
  7. @c = common global i32 0, align 4
  8. @a = common global i32 0, align 4
  9. @b = common global i32 0, align 4
  10. @e = common global i32 0, align 4
  11. ; We used to vectorize this loop. But it has a value that is used outside of the
  12. ; and is not a recognized reduction variable "tmp17".
  13. ; CHECK-LABEL: @main(
  14. ; CHECK-NOT: <2 x i32>
  15. define i32 @main() {
  16. bb:
  17. %b.promoted = load i32, i32* @b, align 4
  18. br label %.lr.ph.i
  19. .lr.ph.i:
  20. %tmp8 = phi i32 [ %tmp18, %bb16 ], [ %b.promoted, %bb ]
  21. %tmp2 = icmp sgt i32 %tmp8, 10
  22. br i1 %tmp2, label %bb16, label %bb10
  23. bb10:
  24. br label %bb16
  25. bb16:
  26. %tmp17 = phi i32 [ 0, %bb10 ], [ 1, %.lr.ph.i ]
  27. %tmp18 = add nsw i32 %tmp8, 1
  28. %tmp19 = icmp slt i32 %tmp18, 4
  29. br i1 %tmp19, label %.lr.ph.i, label %f1.exit.loopexit
  30. f1.exit.loopexit:
  31. %.lcssa = phi i32 [ %tmp17, %bb16 ]
  32. ret i32 %.lcssa
  33. }
  34. ; Don't vectorize this loop. Its phi node (induction variable) has an outside
  35. ; loop user. We currently don't handle this case.
  36. ; PR17179
  37. ; CHECK-LABEL: @test2(
  38. ; CHECK-NOT: <2 x
  39. @x1 = common global i32 0, align 4
  40. @x2 = common global i32 0, align 4
  41. @x0 = common global i32 0, align 4
  42. define i32 @test2() {
  43. entry:
  44. store i32 0, i32* @x1, align 4
  45. %0 = load i32, i32* @x0, align 4
  46. br label %for.cond1.preheader
  47. for.cond1.preheader:
  48. %inc7 = phi i32 [ 0, %entry ], [ %inc, %for.cond1.preheader ]
  49. %inc = add nsw i32 %inc7, 1
  50. %cmp = icmp eq i32 %inc, 52
  51. br i1 %cmp, label %for.end5, label %for.cond1.preheader
  52. for.end5:
  53. %inc7.lcssa = phi i32 [ %inc7, %for.cond1.preheader ]
  54. %xor = xor i32 %inc7.lcssa, %0
  55. store i32 52, i32* @x1, align 4
  56. store i32 1, i32* @x2, align 4
  57. ret i32 %xor
  58. }