blob: 3b4c84a2f81b614906741eda2d5d8bd19fb0c961 [file] [log] [blame]
Chandler Carruth5da53432012-07-02 18:37:59 +00001; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
Dan Gohman4e7e7952011-06-03 20:17:36 +00002
3; When merging MustAlias and PartialAlias, merge to PartialAlias
4; instead of MayAlias.
5
6
7target 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
9; CHECK: PartialAlias: i16* %bigbase0, i8* %phi
10define i8 @test0(i8* %base, i1 %x) {
11entry:
David Blaikie79e6c742015-02-27 19:29:02 +000012 %baseplusone = getelementptr i8, i8* %base, i64 1
Dan Gohman4e7e7952011-06-03 20:17:36 +000013 br i1 %x, label %red, label %green
14red:
15 br label %green
16green:
17 %phi = phi i8* [ %baseplusone, %red ], [ %base, %entry ]
18 store i8 0, i8* %phi
19
20 %bigbase0 = bitcast i8* %base to i16*
21 store i16 -1, i16* %bigbase0
22
David Blaikiea79ac142015-02-27 21:17:42 +000023 %loaded = load i8, i8* %phi
Dan Gohman4e7e7952011-06-03 20:17:36 +000024 ret i8 %loaded
25}
26
27; CHECK: PartialAlias: i16* %bigbase1, i8* %sel
28define i8 @test1(i8* %base, i1 %x) {
29entry:
David Blaikie79e6c742015-02-27 19:29:02 +000030 %baseplusone = getelementptr i8, i8* %base, i64 1
Dan Gohman4e7e7952011-06-03 20:17:36 +000031 %sel = select i1 %x, i8* %baseplusone, i8* %base
32 store i8 0, i8* %sel
33
34 %bigbase1 = bitcast i8* %base to i16*
35 store i16 -1, i16* %bigbase1
36
David Blaikiea79ac142015-02-27 21:17:42 +000037 %loaded = load i8, i8* %sel
Dan Gohman4e7e7952011-06-03 20:17:36 +000038 ret i8 %loaded
39}