1; RUN: opt %s -S -disable-basic-aa -cfl-steens-aa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
2;
3; Regression: we weren't properly checking constexpr selects.
4
5@g = extern_weak dso_local global i32, align 4
6@g2 = extern_weak dso_local global i32, align 4
7@g3 = extern_weak dso_local global i32, align 4
8
9; CHECK-LABEL: Function: foo
10; CHECK: NoAlias: i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3), i32** %a
11; CHECK: NoAlias: i32* %b, i32** %a
12; CHECK: MayAlias: i32* %b, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
13; CHECK: NoAlias: i32* @g2, i32** %a
14; CHECK: MayAlias: i32* @g2, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
15; CHECK: MayAlias: i32* %b, i32* @g2
16; CHECK: NoAlias: i32* @g3, i32** %a
17; CHECK: MayAlias: i32* @g3, i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3)
18; CHECK: MayAlias: i32* %b, i32* @g3
19; CHECK: MayAlias: i32* @g2, i32* @g3
20
21define void @foo() {
22entry:
23  %a = alloca i32*, align 8
24  store i32* select (i1 icmp ne (i32* @g, i32* null), i32* @g2, i32* @g3), i32** %a
25  %b = load i32*, i32** %a
26  %c = load i32, i32* %b
27  %d = load i32, i32* @g2
28  %e = load i32, i32* @g3
29  ret void
30}
31