1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -dse -S %s | FileCheck %s
3
4@b = local_unnamed_addr global i32 0, align 4
5
6; Reduced test case for PR47285.
7
8; `store i32 9, i32* @b` in %interesting is not killed by `store i32 23, i32* @b`
9; in %killer, because it is not overwritten before reaching the end of the
10; function via %bb.2 -> %no.overwrite.exit.
11
12define void @test(i1 %c.0, i1 %c.2, i1 %c.3, i1 %c.4, i1 %c.5, i1 %c.6) {
13; CHECK-LABEL: @test(
14; CHECK-NEXT:  entry:
15; CHECK-NEXT:    br label [[BB_2:%.*]]
16; CHECK:       bb.2:
17; CHECK-NEXT:    br i1 [[C_0:%.*]], label [[BB_3:%.*]], label [[NO_OVERWRITE_EXIT:%.*]]
18; CHECK:       no.overwrite.exit:
19; CHECK-NEXT:    ret void
20; CHECK:       bb.3:
21; CHECK-NEXT:    br i1 [[C_2:%.*]], label [[BB_4:%.*]], label [[BB_7:%.*]]
22; CHECK:       bb.4:
23; CHECK-NEXT:    br i1 [[C_4:%.*]], label [[BB_5:%.*]], label [[BB_6:%.*]]
24; CHECK:       bb.5:
25; CHECK-NEXT:    store i32 99, i32* @b, align 4
26; CHECK-NEXT:    br i1 [[C_3:%.*]], label [[BB_5]], label [[BB_2]]
27; CHECK:       bb.6:
28; CHECK-NEXT:    store i32 91, i32* @b, align 4
29; CHECK-NEXT:    br i1 [[C_5:%.*]], label [[SPLIT_CRIT_EDGE_2:%.*]], label [[BB_2]]
30; CHECK:       split_crit_edge.2:
31; CHECK-NEXT:    store i32 27, i32* @b, align 4
32; CHECK-NEXT:    br label [[EXIT:%.*]]
33; CHECK:       bb.7:
34; CHECK-NEXT:    br i1 [[C_4]], label [[INTERESTING:%.*]], label [[BB_8:%.*]]
35; CHECK:       interesting:
36; CHECK-NEXT:    store i32 9, i32* @b, align 4
37; CHECK-NEXT:    br i1 [[C_6:%.*]], label [[KILLER:%.*]], label [[BB_2]]
38; CHECK:       killer:
39; CHECK-NEXT:    store i32 23, i32* @b, align 4
40; CHECK-NEXT:    ret void
41; CHECK:       bb.8:
42; CHECK-NEXT:    store i32 19, i32* @b, align 4
43; CHECK-NEXT:    br i1 [[C_4]], label [[EXIT]], label [[BB_2]]
44; CHECK:       exit:
45; CHECK-NEXT:    ret void
46;
47entry:
48  br label %bb.2
49
50bb.2:                                             ; preds = %bb.8, %interesting, %bb.6, %bb.5, %entry
51  br i1 %c.0, label %bb.3, label %no.overwrite.exit
52
53no.overwrite.exit:                                ; preds = %bb.2
54  ret void
55
56bb.3:                                             ; preds = %bb.2
57  br i1 %c.2, label %bb.4, label %bb.7
58
59bb.4:                                             ; preds = %bb.3
60  br i1 %c.4, label %bb.5, label %bb.6
61
62bb.5:                                             ; preds = %bb.5, %bb.4
63  store i32 99, i32* @b, align 4
64  br i1 %c.3, label %bb.5, label %bb.2
65
66bb.6:                                             ; preds = %bb.4
67  store i32 91, i32* @b, align 4
68  br i1 %c.5, label %split_crit_edge.2, label %bb.2
69
70split_crit_edge.2:                                ; preds = %bb.6
71  store i32 27, i32* @b, align 4
72  br label %exit
73
74bb.7:                                             ; preds = %bb.3
75  br i1 %c.4, label %interesting, label %bb.8
76
77interesting:                                      ; preds = %bb.7
78  store i32 9, i32* @b, align 4
79  br i1 %c.6, label %killer, label %bb.2
80
81killer:                                           ; preds = %interesting
82  store i32 23, i32* @b, align 4
83  ret void
84
85bb.8:                                             ; preds = %bb.7
86  store i32 19, i32* @b, align 4
87  br i1 %c.4, label %exit, label %bb.2
88
89exit:                                             ; preds = %bb.8, %split_crit_edge.2
90  ret void
91}
92