1; RUN: opt -globals-aa -gvn < %s -S | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6; @o and @m are initialized to @i, so they should not be classed as
7; indirect globals referring only to allocation functions.
8@o = internal global i32* @i, align 8
9@m = internal global i32* @i, align 8
10@i = internal global i32 0, align 4
11
12; CHECK-LABEL: @f
13define i1 @f() {
14entry:
15  %0 = load i32*, i32** @o, align 8
16  store i32 0, i32* %0, align 4
17  %1 = load volatile i32*, i32** @m, align 8
18  store i32 1, i32* %1, align 4
19  ; CHECK: %[[a:.*]] = load i32*
20  %2 = load i32*, i32** @o, align 8
21  ; CHECK: %[[b:.*]] = load i32, i32* %[[a]]
22  %3 = load i32, i32* %2, align 4
23  ; CHECK: %[[c:.*]] = icmp ne i32 %[[b]], 0
24  %tobool.i = icmp ne i32 %3, 0
25  ; CHECK: ret i1 %[[c]]
26  ret i1 %tobool.i
27}
28