must-and-partial.ll 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ; RUN: opt < %s -basicaa -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. ; CHECK: PartialAlias: i16* %bigbase0, i8* %phi
  6. define i8 @test0(i8* %base, i1 %x) {
  7. entry:
  8. %baseplusone = getelementptr i8, i8* %base, i64 1
  9. br i1 %x, label %red, label %green
  10. red:
  11. br label %green
  12. green:
  13. %phi = phi i8* [ %baseplusone, %red ], [ %base, %entry ]
  14. store i8 0, i8* %phi
  15. %bigbase0 = bitcast i8* %base to i16*
  16. store i16 -1, i16* %bigbase0
  17. %loaded = load i8, i8* %phi
  18. ret i8 %loaded
  19. }
  20. ; CHECK: PartialAlias: i16* %bigbase1, i8* %sel
  21. define i8 @test1(i8* %base, i1 %x) {
  22. entry:
  23. %baseplusone = getelementptr i8, i8* %base, i64 1
  24. %sel = select i1 %x, i8* %baseplusone, i8* %base
  25. store i8 0, i8* %sel
  26. %bigbase1 = bitcast i8* %base to i16*
  27. store i16 -1, i16* %bigbase1
  28. %loaded = load i8, i8* %sel
  29. ret i8 %loaded
  30. }