phi-edge-handling.ll
2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -newgvn -S | FileCheck %s
;; Block 6 is reachable, but edge 6->4 is not
;; This means the phi value is undef, not 0
; Function Attrs: ssp uwtable
define i16 @hoge() local_unnamed_addr #0 align 2 {
; CHECK-LABEL: @hoge(
; CHECK-NEXT: bb:
; CHECK-NEXT: switch i8 undef, label [[BB7:%.*]] [
; CHECK-NEXT: i8 0, label [[BB1:%.*]]
; CHECK-NEXT: i8 12, label [[BB2:%.*]]
; CHECK-NEXT: ]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB6:%.*]]
; CHECK: bb2:
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb3:
; CHECK-NEXT: unreachable
; CHECK: bb4:
; CHECK-NEXT: ret i16 undef
; CHECK: bb6:
; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[BB4]], !llvm.loop !1
; CHECK: bb7:
; CHECK-NEXT: unreachable
;
bb:
switch i8 undef, label %bb7 [
i8 0, label %bb1
i8 12, label %bb2
]
bb1: ; preds = %bb
br label %bb6
bb2: ; preds = %bb
br label %bb4
bb3: ; preds = %bb6
unreachable
bb4: ; preds = %bb6, %bb2
%tmp = phi i16 [ 0, %bb6 ], [ undef, %bb2 ]
ret i16 %tmp
bb6: ; preds = %bb4
br i1 true, label %bb3, label %bb4, !llvm.loop !1
bb7: ; preds = %bb
unreachable
}
attributes #0 = { ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.ident = !{!0}
!0 = !{!"clang version 5.0.0"}
!1 = distinct !{!1, !2}
!2 = !{!"llvm.loop.unroll.disable"}