~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/Transforms/IPConstantProp/dangling-block-address.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: opt < %s -internalize -ipsccp -S | FileCheck %s
 
2
; PR5569
 
3
 
 
4
; IPSCCP should prove that the blocks are dead and delete them, and
 
5
; properly handle the dangling blockaddress constants.
 
6
 
 
7
; CHECK: @bar.l = internal constant [2 x i8*] [i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 1 to i8*)]
 
8
 
 
9
@code = global [5 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1], align 4 ; <[5 x i32]*> [#uses=0]
 
10
@bar.l = internal constant [2 x i8*] [i8* blockaddress(@bar, %lab0), i8* blockaddress(@bar, %end)] ; <[2 x i8*]*> [#uses=1]
 
11
 
 
12
define void @foo(i32 %x) nounwind readnone {
 
13
entry:
 
14
  %b = alloca i32, align 4                        ; <i32*> [#uses=1]
 
15
  store volatile i32 -1, i32* %b
 
16
  ret void
 
17
}
 
18
 
 
19
define void @bar(i32* nocapture %pc) nounwind readonly {
 
20
entry:
 
21
  br label %indirectgoto
 
22
 
 
23
lab0:                                             ; preds = %indirectgoto
 
24
  %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=1]
 
25
  br label %indirectgoto
 
26
 
 
27
end:                                              ; preds = %indirectgoto
 
28
  ret void
 
29
 
 
30
indirectgoto:                                     ; preds = %lab0, %entry
 
31
  %indvar = phi i32 [ %indvar.next, %lab0 ], [ 0, %entry ] ; <i32> [#uses=2]
 
32
  %pc.addr.0 = getelementptr i32, i32* %pc, i32 %indvar ; <i32*> [#uses=1]
 
33
  %tmp1.pn = load i32, i32* %pc.addr.0                 ; <i32> [#uses=1]
 
34
  %indirect.goto.dest.in = getelementptr inbounds [2 x i8*], [2 x i8*]* @bar.l, i32 0, i32 %tmp1.pn ; <i8**> [#uses=1]
 
35
  %indirect.goto.dest = load i8*, i8** %indirect.goto.dest.in ; <i8*> [#uses=1]
 
36
  indirectbr i8* %indirect.goto.dest, [label %lab0, label %end]
 
37
}
 
38
 
 
39
define i32 @main() nounwind readnone {
 
40
entry:
 
41
  ret i32 0
 
42
}