• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -simplifycfg < %s -S | FileCheck %s
2
3; The dead code would cause a select that had itself
4; as an operand to be analyzed. This would then cause
5; infinite recursion and eventual crash.
6
7define void @PR36045(i1 %t, i32* %b) {
8; CHECK-LABEL: @PR36045(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    ret void
11;
12entry:
13  br i1 %t, label %if, label %end
14
15if:
16  br i1 %t, label %unreach, label %pre
17
18unreach:
19  unreachable
20
21pre:
22  %p = phi i32 [ 70, %if ], [ %sel, %for ]
23  br label %for
24
25for:
26  %cmp = icmp sgt i32 %p, 8
27  %add = add i32 %p, 2
28  %sel = select i1 %cmp, i32 %p, i32 %add
29  %cmp21 = icmp ult i32 %sel, 21
30  br i1 %cmp21, label %pre, label %for.end
31
32for.end:
33  br i1 %t, label %unreach2, label %then12
34
35then12:
36  store i32 0, i32* %b
37  br label %unreach2
38
39unreach2:
40  %spec = phi i32 [ %sel, %for.end ], [ 42, %then12 ]
41  unreachable
42
43end:
44  ret void
45}
46
47