1; RUN: opt -basicaa -dse -S < %s | FileCheck %s
2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3
4%t = type { i32 }
5
6@g = global i32 42
7
8define void @test1(%t* noalias %pp) {
9  %p = getelementptr inbounds %t, %t* %pp, i32 0, i32 0
10
11  store i32 1, i32* %p; <-- This is dead
12  %x = load i32, i32* inttoptr (i32 12345 to i32*)
13  store i32 %x, i32* %p
14  ret void
15; CHECK-LABEL: define void @test1(
16; CHECK: store
17; CHECK-NOT: store
18; CHECK: ret void
19}
20
21define void @test3() {
22  store i32 1, i32* @g; <-- This is dead.
23  store i32 42, i32* @g
24  ret void
25; CHECK-LABEL: define void @test3(
26; CHECK: store
27; CHECK-NOT: store
28; CHECK: ret void
29}
30
31define void @test4(i32* %p) {
32  store i32 1, i32* %p
33  %x = load i32, i32* @g; <-- %p and @g could alias
34  store i32 %x, i32* %p
35  ret void
36; CHECK-LABEL: define void @test4(
37; CHECK: store
38; CHECK: store
39; CHECK: ret void
40}
41