must-and-partial.ll 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ; RUN: opt < %s -cfl-aa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
  2. ; When merging MustAlias and PartialAlias, merge to PartialAlias
  3. ; instead of MayAlias.
  4. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
  5. ; FIXME: This could be PartialAlias but CFLAA can't currently prove it
  6. ; CHECK: MayAlias: i16* %bigbase0, i8* %phi
  7. define i8 @test0(i1 %x) {
  8. entry:
  9. %base = alloca i8, align 4
  10. %baseplusone = getelementptr i8, i8* %base, i64 1
  11. br i1 %x, label %red, label %green
  12. red:
  13. br label %green
  14. green:
  15. %phi = phi i8* [ %baseplusone, %red ], [ %base, %entry ]
  16. store i8 0, i8* %phi
  17. %bigbase0 = bitcast i8* %base to i16*
  18. store i16 -1, i16* %bigbase0
  19. %loaded = load i8, i8* %phi
  20. ret i8 %loaded
  21. }
  22. ; FIXME: This could be PartialAlias but CFLAA can't currently prove it
  23. ; CHECK: MayAlias: i16* %bigbase1, i8* %sel
  24. define i8 @test1(i1 %x) {
  25. entry:
  26. %base = alloca i8, align 4
  27. %baseplusone = getelementptr i8, i8* %base, i64 1
  28. %sel = select i1 %x, i8* %baseplusone, i8* %base
  29. store i8 0, i8* %sel
  30. %bigbase1 = bitcast i8* %base to i16*
  31. store i16 -1, i16* %bigbase1
  32. %loaded = load i8, i8* %sel
  33. ret i8 %loaded
  34. }
  35. ; Incoming pointer arguments should not be PartialAlias because we do not know their initial state
  36. ; even if they are nocapture
  37. ; CHECK: MayAlias: double* %A, double* %Index
  38. define void @testr2(double* nocapture readonly %A, double* nocapture readonly %Index) {
  39. %arrayidx22 = getelementptr inbounds double, double* %Index, i64 2
  40. %1 = load double, double* %arrayidx22
  41. %arrayidx25 = getelementptr inbounds double, double* %A, i64 2
  42. %2 = load double, double* %arrayidx25
  43. %mul26 = fmul double %1, %2
  44. ret void
  45. }