xref: /minix3/external/bsd/llvm/dist/llvm/test/Analysis/CFLAliasAnalysis/must-and-partial.ll (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc; RUN: opt < %s -cfl-aa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc; When merging MustAlias and PartialAlias, merge to PartialAlias
4*0a6a1f1dSLionel Sambuc; instead of MayAlias.
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc
7*0a6a1f1dSLionel Sambuctarget 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"
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc; CHECK: PartialAlias:  i16* %bigbase0, i8* %phi
10*0a6a1f1dSLionel Sambucdefine i8 @test0(i8* %base, i1 %x) {
11*0a6a1f1dSLionel Sambucentry:
12*0a6a1f1dSLionel Sambuc  %baseplusone = getelementptr i8* %base, i64 1
13*0a6a1f1dSLionel Sambuc  br i1 %x, label %red, label %green
14*0a6a1f1dSLionel Sambucred:
15*0a6a1f1dSLionel Sambuc  br label %green
16*0a6a1f1dSLionel Sambucgreen:
17*0a6a1f1dSLionel Sambuc  %phi = phi i8* [ %baseplusone, %red ], [ %base, %entry ]
18*0a6a1f1dSLionel Sambuc  store i8 0, i8* %phi
19*0a6a1f1dSLionel Sambuc
20*0a6a1f1dSLionel Sambuc  %bigbase0 = bitcast i8* %base to i16*
21*0a6a1f1dSLionel Sambuc  store i16 -1, i16* %bigbase0
22*0a6a1f1dSLionel Sambuc
23*0a6a1f1dSLionel Sambuc  %loaded = load i8* %phi
24*0a6a1f1dSLionel Sambuc  ret i8 %loaded
25*0a6a1f1dSLionel Sambuc}
26*0a6a1f1dSLionel Sambuc
27*0a6a1f1dSLionel Sambuc; CHECK: PartialAlias:  i16* %bigbase1, i8* %sel
28*0a6a1f1dSLionel Sambucdefine i8 @test1(i8* %base, i1 %x) {
29*0a6a1f1dSLionel Sambucentry:
30*0a6a1f1dSLionel Sambuc  %baseplusone = getelementptr i8* %base, i64 1
31*0a6a1f1dSLionel Sambuc  %sel = select i1 %x, i8* %baseplusone, i8* %base
32*0a6a1f1dSLionel Sambuc  store i8 0, i8* %sel
33*0a6a1f1dSLionel Sambuc
34*0a6a1f1dSLionel Sambuc  %bigbase1 = bitcast i8* %base to i16*
35*0a6a1f1dSLionel Sambuc  store i16 -1, i16* %bigbase1
36*0a6a1f1dSLionel Sambuc
37*0a6a1f1dSLionel Sambuc  %loaded = load i8* %sel
38*0a6a1f1dSLionel Sambuc  ret i8 %loaded
39*0a6a1f1dSLionel Sambuc}
40