1 ; RUN: opt -passes=gvn -S < %s | FileCheck %s
3 @a = external local_unnamed_addr global i32, align 4
4 @b = external local_unnamed_addr global i32, align 4
6 ; Function Attrs: nounwind readnone
7 declare ptr @j() local_unnamed_addr #0
9 ; CHECK: define {{.*}}@k()
11 define i64 @k() local_unnamed_addr {
13 br i1 undef, label %bb10.preheader, label %bb3
15 bb10.preheader: ; preds = %bb
19 %i4 = load i32, ptr @a, align 4
20 %i5.not = icmp eq i32 %i4, 0
24 %i8 = tail call ptr @j()
27 bb13: ; preds = %bb34, %bb10.preheader
28 br i1 undef, label %bb30thread-pre-split, label %bb16
31 %i17 = tail call ptr @j()
32 br i1 undef, label %bb22thread-pre-split, label %bb37.loopexit
34 bb22thread-pre-split: ; preds = %bb16
37 bb27: ; preds = %bb22thread-pre-split
38 br i1 undef, label %bb30thread-pre-split, label %bb37.loopexit
40 bb30thread-pre-split: ; preds = %bb27, %bb13
41 %i31.pr = load i32, ptr @a, align 4
42 %i32.not2 = icmp eq i32 %i31.pr, 0
45 bb34: ; preds = %bb30thread-pre-split
46 br i1 undef, label %bb37.loopexit, label %bb13
48 bb37.loopexit: ; preds = %bb34, %bb27, %bb16
51 bb37: ; preds = %bb37.loopexit, %bb7
52 %i38 = load i32, ptr @a, align 4
53 store i32 %i38, ptr @b, align 4
54 %i39 = tail call ptr @j()
58 attributes #0 = { nounwind readnone }