non-wrapping-pointer.ll 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s
  2. ; For this loop:
  3. ; for (int i = 0; i < n; i++)
  4. ; A[2 * i] = A[2 * i] + B[i];
  5. ;
  6. ; , SCEV is unable to prove that A[2 * i] does not overflow. However,
  7. ; analyzing the IR helps us to conclude it and in turn allow dependence
  8. ; analysis.
  9. target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
  10. ; CHECK: Memory dependences are safe{{$}}
  11. define void @f(i16* noalias %a,
  12. i16* noalias %b, i64 %N) {
  13. entry:
  14. br label %for.body
  15. for.body: ; preds = %for.body, %entry
  16. %ind = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  17. %mul = mul nuw nsw i64 %ind, 2
  18. %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %mul
  19. %loadA = load i16, i16* %arrayidxA, align 2
  20. %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %ind
  21. %loadB = load i16, i16* %arrayidxB, align 2
  22. %add = mul i16 %loadA, %loadB
  23. store i16 %add, i16* %arrayidxA, align 2
  24. %inc = add nuw nsw i64 %ind, 1
  25. %exitcond = icmp eq i64 %inc, %N
  26. br i1 %exitcond, label %for.end, label %for.body
  27. for.end: ; preds = %for.body
  28. ret void
  29. }