When gvn decides to replace an instruction with another, we have to patch the
[oota-llvm.git] / test / Transforms / GVN / 2008-07-02-Unreachable.ll
1 ; RUN: opt < %s -basicaa -gvn -S | grep {ret i8 \[%\]tmp3}
2 ; PR2503
3
4 @g_3 = external global i8               ; <i8*> [#uses=2]
5
6 define i8 @func_1() nounwind  {
7 entry:
8   %A = alloca i8
9         br i1 false, label %ifelse, label %ifthen
10
11 ifthen:         ; preds = %entry
12         br label %ifend
13
14 ifelse:         ; preds = %entry
15         %tmp3 = load i8* @g_3           ; <i8> [#uses=0]
16         store i8 %tmp3, i8* %A
17         br label %forcond.thread
18
19 forcond.thread:         ; preds = %ifelse
20         br label %afterfor
21
22 forcond:                ; preds = %forinc
23         br i1 false, label %afterfor, label %forbody
24
25 forbody:                ; preds = %forcond
26         br label %forinc
27
28 forinc:         ; preds = %forbody
29         br label %forcond
30
31 afterfor:               ; preds = %forcond, %forcond.thread
32         %tmp10 = load i8* @g_3          ; <i8> [#uses=0]
33         ret i8 %tmp10
34
35 ifend:          ; preds = %afterfor, %ifthen
36         ret i8 0
37 }