unroll.ll 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ; This test makes sure that loop will not be unrolled in vectorization if VF computed
  2. ; equals to 1.
  3. ; RUN: opt < %s -loop-vectorize -S | FileCheck %s
  4. ; Make sure there are no geps being merged.
  5. ; CHECK-LABEL: @foo(
  6. ; CHECK: getelementptr
  7. ; CHECK-NOT: getelementptr
  8. @N = common global i32 0, align 4
  9. @a = common global [1000 x i32] zeroinitializer, align 16
  10. define void @foo() #0 {
  11. entry:
  12. %0 = load i32, i32* @N, align 4
  13. %cmp5 = icmp sgt i32 %0, 0
  14. br i1 %cmp5, label %for.body.lr.ph, label %for.end
  15. for.body.lr.ph: ; preds = %entry
  16. %conv = sext i32 %0 to i64
  17. br label %for.body
  18. for.body: ; preds = %for.body.lr.ph, %for.body
  19. %i.06 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
  20. %mul = mul nuw nsw i64 %i.06, 7
  21. %arrayidx = getelementptr inbounds [1000 x i32], [1000 x i32]* @a, i64 0, i64 %mul
  22. store i32 3, i32* %arrayidx, align 4
  23. %inc = add nuw nsw i64 %i.06, 1
  24. %cmp = icmp slt i64 %inc, %conv
  25. br i1 %cmp, label %for.body, label %for.end.loopexit
  26. for.end.loopexit: ; preds = %for.body
  27. br label %for.end
  28. for.end: ; preds = %for.end.loopexit, %entry
  29. ret void
  30. }