~ubuntu-branches/ubuntu/quantal/llvm-3.1/quantal

« back to all changes in this revision

Viewing changes to test/Transforms/DeadStoreElimination/const-pointers.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-03-29 19:09:51 UTC
  • Revision ID: package-import@ubuntu.com-20120329190951-aq83ivog4cg8bxun
Tags: upstream-3.1~svn153643
ImportĀ upstreamĀ versionĀ 3.1~svn153643

Show diffs side-by-side

added added

removed removed

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