[PHITransAddr] Don't assume that instruction operands are translatable
[oota-llvm.git] / test / Transforms / GVN / calls-nonlocal.ll
1 ; RUN: opt < %s -basicaa -gvn -S | grep strlen | count 2
2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
3 target triple = "i386-apple-darwin9"
4
5 define i32 @test(i32 %g, i8* %P) nounwind  {
6 entry:
7         %tmp2 = call i32 @strlen( i8* %P ) nounwind readonly            ; <i32> [#uses=1]
8         %tmp3 = icmp eq i32 %tmp2, 100          ; <i1> [#uses=1]
9         %tmp34 = zext i1 %tmp3 to i8            ; <i8> [#uses=1]
10         %toBool = icmp ne i8 %tmp34, 0          ; <i1> [#uses=1]
11         br i1 %toBool, label %bb, label %bb6
12
13 bb:             ; preds = %entry
14         br label %bb27
15
16 bb6:            ; preds = %entry
17         %tmp8 = add i32 %g, 42          ; <i32> [#uses=2]
18         %tmp10 = call i32 @strlen( i8* %P ) nounwind readonly           ; <i32> [#uses=1]
19         %tmp11 = icmp eq i32 %tmp10, 100                ; <i1> [#uses=1]
20         %tmp1112 = zext i1 %tmp11 to i8         ; <i8> [#uses=1]
21         %toBool13 = icmp ne i8 %tmp1112, 0              ; <i1> [#uses=1]
22         br i1 %toBool13, label %bb14, label %bb16
23
24 bb14:           ; preds = %bb6
25         br label %bb27
26
27 bb16:           ; preds = %bb6
28         %tmp18 = mul i32 %tmp8, 2               ; <i32> [#uses=1]
29         %tmp20 = call i32 @strlen( i8* %P ) nounwind readonly           ; <i32> [#uses=1]
30         %tmp21 = icmp eq i32 %tmp20, 100                ; <i1> [#uses=1]
31         %tmp2122 = zext i1 %tmp21 to i8         ; <i8> [#uses=1]
32         %toBool23 = icmp ne i8 %tmp2122, 0              ; <i1> [#uses=1]
33         br i1 %toBool23, label %bb24, label %bb26
34
35 bb24:           ; preds = %bb16
36         br label %bb27
37
38 bb26:           ; preds = %bb16
39         br label %bb27
40
41 bb27:           ; preds = %bb26, %bb24, %bb14, %bb
42         %tmp.0 = phi i32 [ 11, %bb26 ], [ %tmp18, %bb24 ], [ %tmp8, %bb14 ], [ %g, %bb ]                ; <i32> [#uses=1]
43         br label %return
44
45 return:         ; preds = %bb27
46         ret i32 %tmp.0
47 }
48
49 declare i32 @strlen(i8*) nounwind readonly