[RS4GC] Fix crash in the case that a live variable has a constant base.
[oota-llvm.git] / test / Transforms / JumpThreading / pr9331.ll
1 ; RUN: opt -jump-threading -S < %s
2
3 define void @func(i8 zeroext %p_44) nounwind {
4 entry:
5   br i1 false, label %for.cond2, label %if.end50
6
7 for.cond2:                                        ; preds = %for.inc46, %lor.end, %entry
8   %p_44.addr.1 = phi i8 [ %p_44.addr.1, %lor.end ], [ %p_44, %entry ], [ %p_44.addr.1, %for.inc46 ]
9   br i1 undef, label %for.inc46, label %for.body5
10
11 for.body5:                                        ; preds = %for.cond2
12   br i1 undef, label %lbl_465, label %if.then9
13
14 if.then9:                                         ; preds = %for.body5
15   br label %return
16
17 lbl_465:                                          ; preds = %lbl_465, %for.body5
18   %tobool19 = icmp eq i8 undef, 0
19   br i1 %tobool19, label %if.end21, label %lbl_465
20
21 if.end21:                                         ; preds = %lbl_465
22   %conv23 = zext i8 %p_44.addr.1 to i64
23   %xor = xor i64 %conv23, 1
24   %tobool.i = icmp eq i64 %conv23, 0
25   br i1 %tobool.i, label %cond.false.i, label %safe_mod_func_uint64_t_u_u.exit
26
27 cond.false.i:                                     ; preds = %if.end21
28   %div.i = udiv i64 %xor, %conv23
29   br label %safe_mod_func_uint64_t_u_u.exit
30
31 safe_mod_func_uint64_t_u_u.exit:                  ; preds = %cond.false.i, %if.end21
32   %cond.i = phi i64 [ %div.i, %cond.false.i ], [ %conv23, %if.end21 ]
33   %tobool28 = icmp eq i64 %cond.i, 0
34   br i1 %tobool28, label %lor.rhs, label %lor.end
35
36 lor.rhs:                                          ; preds = %safe_mod_func_uint64_t_u_u.exit
37   br label %lor.end
38
39 lor.end:                                          ; preds = %lor.rhs, %safe_mod_func_uint64_t_u_u.exit
40   br label %for.cond2
41
42 for.inc46:                                        ; preds = %for.cond2
43   br label %for.cond2
44
45 if.end50:                                         ; preds = %entry
46   br label %return
47
48 return:                                           ; preds = %if.end50, %if.then9
49   ret void
50 }