1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -newgvn -S %s | FileCheck %s
4 @f = external local_unnamed_addr global i64
5 @b = external local_unnamed_addr global i64
6 @e = external local_unnamed_addr global i64
8 define void @patatino() {
9 ; CHECK-LABEL: @patatino(
11 ; CHECK-NEXT: br i1 undef, label [[IF_END24:%.*]], label [[FOR_COND16:%.*]]
12 ; CHECK: for.cond2thread-pre-split:
13 ; CHECK-NEXT: br i1 false, label [[FOR_BODY:%.*]], label [[FOR_COND8_PREHEADER:%.*]]
14 ; CHECK: for.cond8.preheader:
15 ; CHECK-NEXT: br i1 undef, label [[L1:%.*]], label %for.cond11thread-pre-split.lr.ph
16 ; CHECK: for.cond11thread-pre-split.lr.ph:
17 ; CHECK-NEXT: br label [[L1]]
19 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ne i64 [[K_2:%.*]], 3
20 ; CHECK-NEXT: [[CONV4:%.*]] = zext i1 [[CMP3]] to i64
21 ; CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* @f
22 ; CHECK-NEXT: [[OR:%.*]] = or i64 [[TMP0]], [[CONV4]]
23 ; CHECK-NEXT: store i64 [[OR]], i64* @f
24 ; CHECK-NEXT: [[TOBOOL7:%.*]] = icmp ne i64 [[K_2]], 0
25 ; CHECK-NEXT: br i1 [[TOBOOL7]], label %for.cond2thread-pre-split, label [[LOR_RHS:%.*]]
27 ; CHECK-NEXT: store i64 1, i64* @b, align 8
28 ; CHECK-NEXT: br label %for.cond2thread-pre-split
30 ; CHECK-NEXT: [[K_2]] = phi i64 [ undef, [[L1_PREHEADER:%.*]] ], [ 15, [[FOR_COND8_PREHEADER]] ], [ 5, %for.cond11thread-pre-split.lr.ph ]
31 ; CHECK-NEXT: store i64 7, i64* [[J_3:%.*]]
32 ; CHECK-NEXT: br label [[FOR_BODY]]
34 ; CHECK-NEXT: [[J_0:%.*]] = phi i64* [ @f, [[ENTRY:%.*]] ], [ undef, [[FOR_COND20:%.*]] ], [ @e, [[FOR_COND16]] ]
35 ; CHECK-NEXT: br i1 undef, label [[FOR_COND20]], label [[FOR_COND16]]
37 ; CHECK-NEXT: [[J_2:%.*]] = phi i64* [ [[J_0]], [[FOR_COND16]] ], [ undef, [[IF_END24]] ]
38 ; CHECK-NEXT: br i1 true, label [[IF_END24]], label [[FOR_COND16]]
40 ; CHECK-NEXT: [[J_3]] = phi i64* [ [[J_2]], [[FOR_COND20]] ], [ undef, [[ENTRY]] ]
41 ; CHECK-NEXT: br i1 false, label [[FOR_COND20]], label [[L1_PREHEADER]]
42 ; CHECK: l1.preheader:
43 ; CHECK-NEXT: br label [[L1]]
46 br i1 undef, label %if.end24, label %for.cond16
48 for.cond2thread-pre-split:
49 br i1 false, label %for.body, label %for.cond8.preheader
52 br i1 undef, label %l1, label %for.cond11thread-pre-split.lr.ph
54 for.cond11thread-pre-split.lr.ph:
58 %k.031 = phi i64 [ %k.2, %l1 ], [ 15, %for.cond2thread-pre-split ]
59 %cmp3 = icmp ne i64 %k.031, 3
60 %conv4 = zext i1 %cmp3 to i64
61 %0 = load i64, i64* @f
62 %or = or i64 %0, %conv4
63 store i64 %or, i64* @f
64 %tobool7 = icmp ne i64 %k.031, 0
65 %or.cond = or i1 %tobool7, false
66 br i1 %or.cond, label %for.cond2thread-pre-split, label %lor.rhs
69 store i64 1, i64* @b, align 8
70 br label %for.cond2thread-pre-split
73 %k.2 = phi i64 [ undef, %l1.preheader ], [ 15, %for.cond8.preheader ], [ 5, %for.cond11thread-pre-split.lr.ph ]
74 store i64 7, i64* %j.3
78 %j.0 = phi i64* [ @f, %entry ], [ %j.2, %for.cond20 ], [ @e, %for.cond16 ]
79 br i1 undef, label %for.cond20, label %for.cond16
82 %j.2 = phi i64* [ %j.0, %for.cond16 ], [ %j.3, %if.end24 ]
83 br i1 true, label %if.end24, label %for.cond16
86 %j.3 = phi i64* [ %j.2, %for.cond20 ], [ undef, %entry ]
87 br i1 false, label %for.cond20, label %l1.preheader